From e775c940e52c52c06758072559fbb6a877384a08 Mon Sep 17 00:00:00 2001 From: Rodolphe Date: Sat, 29 Aug 2026 15:18:27 -0400 Subject: [PATCH 1/8] fix(demo): replace inaccurate C++ break examples Conan's fmt 9.1->10.2 fixture claimed compile-time format-string checking, fmt::runtime(), and fmt::join's header move as 9->10 breaks; none of those are real for that version pair. Replaced with fmt 10.0's actual, documented removal of implicit enum-to-integer conversions in formatting. vcpkg's spdlog 1.11->1.14 fixture claimed rotating_logger_mt's max_file_size changed type (it didn't) and leaned on unverified runtime-format claims. Replaced the dependency entirely with Catch2 2.13->3.5: the v2 single header and CATCH_CONFIG_MAIN both genuinely stop working in v3, a boring and undeniable break. Co-Authored-By: Claude Sonnet 5 --- .devcontainer/vcpkg/devcontainer.json | 2 +- demos/conan/src/main.cpp | 38 +++++++++++--------------- demos/vcpkg/CMakeLists.txt | 6 ++--- demos/vcpkg/demo.json | 17 ++++++++---- demos/vcpkg/src/main.cpp | 39 --------------------------- demos/vcpkg/src/tests.cpp | 23 ++++++++++++++++ demos/vcpkg/vcpkg.json | 6 ++--- 7 files changed, 57 insertions(+), 74 deletions(-) delete mode 100644 demos/vcpkg/src/main.cpp create mode 100644 demos/vcpkg/src/tests.cpp diff --git a/.devcontainer/vcpkg/devcontainer.json b/.devcontainer/vcpkg/devcontainer.json index 7085aa8..fc65ccb 100644 --- a/.devcontainer/vcpkg/devcontainer.json +++ b/.devcontainer/vcpkg/devcontainer.json @@ -42,7 +42,7 @@ "codespaces": { "openFiles": [ "demos/vcpkg/DEMO.md", - "demos/vcpkg/src/main.cpp", + "demos/vcpkg/src/tests.cpp", "demos/vcpkg/vcpkg.json" ] } diff --git a/demos/conan/src/main.cpp b/demos/conan/src/main.cpp index 5bb9d9b..fc47763 100644 --- a/demos/conan/src/main.cpp +++ b/demos/conan/src/main.cpp @@ -1,35 +1,27 @@ #include -#include #include -#include // This file is written against fmt 9.1. -// The Codespace upgraded the dependency to fmt 10.2 without touching this -// code. fmt 10 tightened its API considerably, so every marked call below -// stopped compiling. +// The Codespace upgraded the dependency to fmt 10.2 without touching this code. -std::string report(const std::string& name, int count) { - // ── BREAKING 1 ──────────────────────────────────────────────────────── - // fmt 10 made compile-time format-string checking the default for - // fmt::format. A runtime std::string as the format argument is now a - // compile error unless you wrap it in fmt::runtime(..). - std::string pattern = "{}: {} items\n"; - return fmt::format(pattern, name, count); -} +// An ordinary unscoped enum, formatted directly. +enum LogLevel { Debug, Info, Warning, Error }; -std::string join_names(const std::vector& names) { - // ── BREAKING 2 ──────────────────────────────────────────────────────── - // fmt::join moved out of into in fmt 10, so - // this no longer resolves with the headers included above. - return fmt::format("{}", fmt::join(names, ", ")); +// ── BREAKING ────────────────────────────────────────────────────────────── +// fmt 10.0.0 "removed deprecated implicit conversions for enums and +// conversions to primitive types for compatibility with std::format and to +// prevent potential ODR violations. Use `format_as` instead." +// +// In fmt 9 an unscoped enum was implicitly mapped to its underlying integer, +// so this compiled and printed "level=2". In fmt 10 that conversion is gone +// and LogLevel has no formatter, so this is a compile error until the project +// adds `auto format_as(LogLevel l) { return fmt::underlying(l); }`. +std::string describe(LogLevel level) { + return fmt::format("level={}", level); } int main() { - // ── BREAKING 3 ──────────────────────────────────────────────────────── - // fmt::print(FILE*, ..) with a non-constexpr format string is affected by - // the same compile-time checking change as fmt::format above. - fmt::print(stdout, report("widgets", 3)); - fmt::print("{}\n", join_names({"ada", "grace"})); + fmt::print("{}\n", describe(Warning)); return 0; } diff --git a/demos/vcpkg/CMakeLists.txt b/demos/vcpkg/CMakeLists.txt index 6d1942d..8bba5f4 100644 --- a/demos/vcpkg/CMakeLists.txt +++ b/demos/vcpkg/CMakeLists.txt @@ -3,7 +3,7 @@ project(drift_demo CXX) set(CMAKE_CXX_STANDARD 17) -find_package(spdlog CONFIG REQUIRED) +find_package(Catch2 CONFIG REQUIRED) -add_executable(drift_demo src/main.cpp) -target_link_libraries(drift_demo PRIVATE spdlog::spdlog) +add_executable(drift_demo_tests src/tests.cpp) +target_link_libraries(drift_demo_tests PRIVATE Catch2::Catch2) diff --git a/demos/vcpkg/demo.json b/demos/vcpkg/demo.json index 6ffc9f1..fe64dca 100644 --- a/demos/vcpkg/demo.json +++ b/demos/vcpkg/demo.json @@ -1,9 +1,16 @@ { - "dependency": "spdlog", - "from": "1.11.0", - "to": "1.14.1", + "dependency": "catch2", + "from": "2.13.9", + "to": "3.5.2", "edits": [ - { "file": "vcpkg.json", "find": "\"version\": \"1.11.0\"", "replace": "\"version\": \"1.14.1\"" } + { + "file": "vcpkg.json", + "find": "\"version\": \"2.13.9\"", + "replace": "\"version\": \"3.5.2\"" + } ], - "open": ["src/main.cpp", "vcpkg.json"] + "open": [ + "src/tests.cpp", + "vcpkg.json" + ] } diff --git a/demos/vcpkg/src/main.cpp b/demos/vcpkg/src/main.cpp deleted file mode 100644 index e714eff..0000000 --- a/demos/vcpkg/src/main.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#include -#include - -#include - -// This file is written against spdlog 1.11. -// The Codespace upgraded the dependency to spdlog 1.14 without touching this -// code. spdlog 1.12 bundled fmt 10, which turned several previously-accepted -// call shapes into compile errors, so the marked lines below broke. - -void configure() { - // ── BREAKING 1 ──────────────────────────────────────────────────────── - // spdlog::set_pattern is fine, but from 1.12 spdlog vendors fmt 10, whose - // compile-time format checking rejects a runtime std::string as a format - // string. This call now needs fmt::runtime(..). - std::string pattern = "[%Y-%m-%d %H:%M:%S] %v"; - spdlog::set_pattern(pattern); -} - -void log_progress(const std::string& stage, int percent) { - // ── BREAKING 2 ──────────────────────────────────────────────────────── - // Same cause: a non-constexpr format string passed to a logging call is a - // compile error under the bundled fmt 10. - std::string message = "{} is {}% complete"; - spdlog::info(message, stage, percent); -} - -int main() { - configure(); - - // ── BREAKING 3 ──────────────────────────────────────────────────────── - // spdlog::rotating_logger_mt's max_file_size argument became strongly - // typed in later 1.x releases; passing a plain signed literal here relies - // on a conversion that no longer applies cleanly. - auto file_logger = spdlog::rotating_logger_mt("file", "logs/app.log", -1, 3); - - log_progress("indexing", 40); - return 0; -} diff --git a/demos/vcpkg/src/tests.cpp b/demos/vcpkg/src/tests.cpp new file mode 100644 index 0000000..9fc69cb --- /dev/null +++ b/demos/vcpkg/src/tests.cpp @@ -0,0 +1,23 @@ +// ── BREAKING 1 ──────────────────────────────────────────────────────────── +// Catch2 v3 deleted the v2 single header. `catch2/catch.hpp` shipped for the +// whole 2.x line and does not exist in 3.x at all — the library was split into +// many headers, and a test file includes `catch2/catch_test_macros.hpp` +// instead. This include fails outright. +#define CATCH_CONFIG_MAIN +#include + +// ── BREAKING 2 ──────────────────────────────────────────────────────────── +// CATCH_CONFIG_MAIN is gone in Catch2 v3. Catch2's own migration guide says to +// "delete TU with CATCH_CONFIG_RUNNER or CATCH_CONFIG_MAIN defined" and link +// against Catch2::Catch2WithMain instead, so defining it above no longer +// generates a main(). + +// This file is written against Catch2 2.13, installed through vcpkg. +// The Codespace upgraded the dependency to Catch2 3.5 without touching it. + +int add(int a, int b) { return a + b; } + +TEST_CASE("addition works", "[math]") { + REQUIRE(add(2, 2) == 4); + REQUIRE(add(-1, 1) == 0); +} diff --git a/demos/vcpkg/vcpkg.json b/demos/vcpkg/vcpkg.json index 39a1a9d..564b596 100644 --- a/demos/vcpkg/vcpkg.json +++ b/demos/vcpkg/vcpkg.json @@ -2,12 +2,12 @@ "name": "drift-demo", "version": "0.1.0", "dependencies": [ - "spdlog" + "catch2" ], "overrides": [ { - "name": "spdlog", - "version": "1.11.0" + "name": "catch2", + "version": "2.13.9" } ], "builtin-baseline": "3508985146f1b1d248c67ead13f8f54be5b4f5da" From d257cc2786618113a3d35ca4136a0e65d309e4af Mon Sep 17 00:00:00 2001 From: Rodolphe Date: Sat, 29 Aug 2026 15:18:43 -0400 Subject: [PATCH 2/8] fix(demo): keep fixtures focused on proven breaks Drop the implicit expectation that every ecosystem needs 3-5 breaking examples. One indisputable break beats several arguable ones, so trim the Hex, OCaml, PHP, and Dart fixtures down to only the breaks that are real and documented, and update make-demo-docs.mjs's marker/wording to read naturally for a single break as well as several. Co-Authored-By: Claude Sonnet 5 --- demos/hex/lib/server.ex | 23 +++++----------------- demos/opam/lib/scheduler.ml | 30 ++++++++++------------------- demos/packagist/src/Logging.php | 34 ++++++--------------------------- demos/pub/lib/api_client.dart | 30 ++++++----------------------- scripts/make-demo-docs.mjs | 5 +++-- 5 files changed, 30 insertions(+), 92 deletions(-) diff --git a/demos/hex/lib/server.ex b/demos/hex/lib/server.ex index e09736e..3bcfd86 100644 --- a/demos/hex/lib/server.ex +++ b/demos/hex/lib/server.ex @@ -3,28 +3,15 @@ defmodule DriftDemo.Server do HTTP entry point. This module is written against Plug 1.13. The Codespace upgraded the - dependency to Plug 1.15 without touching this code, so every marked call - below refers to something that no longer exists. + dependency to Plug 1.15 without touching this code. """ - # ── BREAKING 1 ────────────────────────────────────────────────────────── + # ── BREAKING ──────────────────────────────────────────────────────────── # Plug.Adapters.Cowboy2 was removed in Plug 1.15. It had been a deprecated - # shim for the separate :plug_cowboy package since Plug 1.7. + # shim for the separate :plug_cowboy package since Plug 1.7, and + # lib/plug/adapters/cowboy2.ex is simply gone from the 1.15 release, so this + # call raises UndefinedFunctionError. def child_spec(port) do Plug.Adapters.Cowboy2.child_spec(scheme: :http, plug: __MODULE__, options: [port: port]) end - - # ── BREAKING 2 ────────────────────────────────────────────────────────── - # Plug.Adapters.Test.Conn was removed in the same sweep; the test helper is - # Plug.Test now. - def test_conn(method, path) do - Plug.Adapters.Test.Conn.conn(%Plug.Conn{}, method, path, nil) - end - - # ── BREAKING 3 ────────────────────────────────────────────────────────── - # Plug.Parsers.JSON was removed — JSON parsing goes through - # Plug.Parsers with a :json_decoder option. - def parser_opts do - [parsers: [Plug.Parsers.JSON], pass: ["application/json"]] - end end diff --git a/demos/opam/lib/scheduler.ml b/demos/opam/lib/scheduler.ml index 56c2e2b..3587ba7 100644 --- a/demos/opam/lib/scheduler.ml +++ b/demos/opam/lib/scheduler.ml @@ -1,24 +1,14 @@ -(* Task scheduling helpers. +(* Background task helpers. This file is written against Lwt 4.5. The Codespace upgraded the dependency - to Lwt 5.7 without touching this code. Lwt 5.0 removed a batch of APIs that - had been deprecated through the 4.x series, so every marked call below is - gone. *) + to Lwt 5.7 without touching it. *) -(* ── BREAKING 1 ───────────────────────────────────────────────────────── - Lwt_sequence was removed from Lwt's public API in Lwt 5.0. It is an - internal module now; consumers were told to vendor it. *) -let pending : (unit -> unit Lwt.t) Lwt_sequence.t = Lwt_sequence.create () +(* ── BREAKING ─────────────────────────────────────────────────────────── + Lwt 5.0.0 narrowed [Lwt.async] from [(unit -> _ t) -> unit] to + [(unit -> unit t) -> unit]: the callback must now evaluate to [unit Lwt.t] + rather than any ['a Lwt.t]. The callback below returns [int Lwt.t], which + compiled under Lwt 4 and is a type error under Lwt 5. *) +let start_background_count () = + Lwt.async (fun () -> Lwt.return 42) -(* ── BREAKING 2 ───────────────────────────────────────────────────────── - Lwt.wrap1 (and wrap2..wrap7) were removed in Lwt 5.0. *) -let lift_read (read : string -> string) : string -> string Lwt.t = - Lwt.wrap1 read - -(* ── BREAKING 3 ───────────────────────────────────────────────────────── - Lwt.add_task_l and Lwt.add_task_r were removed in Lwt 5.0 along with the - public Lwt_sequence they operated on. *) -let enqueue () = Lwt.add_task_l pending - -let run_all () = - Lwt_sequence.fold_l (fun task acc -> Lwt.bind acc (fun () -> task ())) pending (Lwt.return_unit) +let run () = Lwt_main.run (Lwt.return_unit) diff --git a/demos/packagist/src/Logging.php b/demos/packagist/src/Logging.php index 8e8a85f..7e72289 100644 --- a/demos/packagist/src/Logging.php +++ b/demos/packagist/src/Logging.php @@ -3,48 +3,26 @@ namespace DriftDemo; use Monolog\Logger; -use Monolog\Handler\StreamHandler; // This file is written against Monolog 2.9. -// The Codespace upgraded the dependency to Monolog 3.0 without touching this -// code. Monolog 3 was a large cleanup, so every marked usage below is broken. +// The Codespace upgraded the dependency to Monolog 3.0 without touching it. // ── BREAKING 1 ──────────────────────────────────────────────────────────── // Monolog\Handler\SwiftMailerHandler was deleted in Monolog 3 — SwiftMailer -// itself is end-of-life, and the handler went with it. +// itself is end-of-life, and the handler went with it. This class does not +// exist in 3.x, so resolving the reference below is a fatal error. use Monolog\Handler\SwiftMailerHandler; class Logging { - public static function build(string $path): Logger - { - $logger = new Logger('app'); - - // ── BREAKING 2 ──────────────────────────────────────────────────── - // Handlers took an int level in Monolog 2 (Logger::WARNING === 300). - // In Monolog 3 they take a Monolog\Level enum case, and passing an - // int is a TypeError. - $logger->pushHandler(new StreamHandler($path, Logger::WARNING)); - - return $logger; - } - - // ── BREAKING 3 ──────────────────────────────────────────────────────── - // Logger::getLevels() was removed in Monolog 3; the Level enum replaces - // the int/name lookup tables entirely. + // ── BREAKING 2 ──────────────────────────────────────────────────────── + // Logger::getLevels() was removed in Monolog 3. The Level enum replaced the + // int/name lookup tables, so this static call no longer exists. public static function levelNames(): array { return array_keys(Logger::getLevels()); } - // ── BREAKING 4 ──────────────────────────────────────────────────────── - // Logger::getLevelName() was removed for the same reason — a Level enum - // case knows its own name. - public static function nameFor(int $level): string - { - return Logger::getLevelName($level); - } - public static function mailHandlerClass(): string { return SwiftMailerHandler::class; diff --git a/demos/pub/lib/api_client.dart b/demos/pub/lib/api_client.dart index f23d647..fa89618 100644 --- a/demos/pub/lib/api_client.dart +++ b/demos/pub/lib/api_client.dart @@ -3,16 +3,16 @@ import 'package:dio/dio.dart'; /// HTTP client wrapper. /// /// This file is written against Dio 4.0. The Codespace upgraded the dependency -/// to Dio 5.0 without touching this code — Dio 5 was a large API cleanup, so -/// every marked usage below is broken. +/// to Dio 5.0 without touching it. class ApiClient { final Dio _dio = Dio(); /// Hold outgoing requests while the auth token is refreshed. Future refreshToken(Future Function() refresh) async { // ── BREAKING 1 ──────────────────────────────────────────────────────── - // Dio.lock() / unlock() / clear() were removed in Dio 5. Queue control is - // done with QueuedInterceptor now. + // Dio.lock() / unlock() / clear() were removed in Dio 5. Request-queue + // control is done with QueuedInterceptor now, so these three calls no + // longer resolve. _dio.lock(); try { await refresh(); @@ -25,27 +25,9 @@ class ApiClient { /// Configure timeouts. void configureTimeouts() { // ── BREAKING 2 ──────────────────────────────────────────────────────── - // connectTimeout / receiveTimeout took an int of milliseconds in Dio 4. - // In Dio 5 they take a Duration, so an int no longer type-checks. + // connectTimeout and receiveTimeout took an int of milliseconds in Dio 4. + // In Dio 5 they are `Duration?`, so assigning an int no longer type-checks. _dio.options.connectTimeout = 5000; _dio.options.receiveTimeout = 3000; } - - /// Swap in a custom HTTP adapter. - void useCustomAdapter() { - // ── BREAKING 3 ──────────────────────────────────────────────────────── - // DefaultHttpClientAdapter was removed in Dio 5, replaced by - // IOHttpClientAdapter. - _dio.httpClientAdapter = DefaultHttpClientAdapter(); - } - - /// Describe a failure. - String describe(Object error) { - // ── BREAKING 4 ──────────────────────────────────────────────────────── - // DioError was renamed to DioException in Dio 5. - if (error is DioError) { - return 'request failed: ${error.message}'; - } - return 'unknown error'; - } } diff --git a/scripts/make-demo-docs.mjs b/scripts/make-demo-docs.mjs index 8fef56b..b3ee09b 100644 --- a/scripts/make-demo-docs.mjs +++ b/scripts/make-demo-docs.mjs @@ -21,7 +21,8 @@ for (const demo of allDemos()) { const breaks = []; const lines = source.split('\n'); for (let i = 0; i < lines.length; i += 1) { - if (!/BREAKING\s+\d+/.test(lines[i])) continue; + // The marker is a ruled comment line: `── BREAKING ──` or `── BREAKING 2 ──`. + if (!/──\s*BREAKING(\s+\d+)?\s*──/.test(lines[i])) continue; // Consume the explanation that follows the marker. Line-comment languages // end it at the first non-comment or blank line; OCaml's block comments // have no per-line marker, so there the block ends at `*)`. @@ -50,7 +51,7 @@ The Codespace upgraded it to **${demo.to}** and left the source code alone, so \`${sourceFile}\` is now written against an API that no longer exists. That is the situation Drift is built to analyse. -${breaks.length} breaking change${breaks.length === 1 ? '' : 's'} in this demo: +${breaks.length === 1 ? 'The breaking change' : `The ${breaks.length} breaking changes`} in this demo: ${breaks.map((b, i) => `${i + 1}. ${b}`).join('\n')} From 73baae14699561e288b5096a4786d59e4d04405a Mon Sep 17 00:00:00 2001 From: Rodolphe Date: Sat, 29 Aug 2026 15:20:46 -0400 Subject: [PATCH 3/8] fix(demo): regenerate DEMO.md, fix comment-parser false match on '#' make-demo-docs.mjs treated any '#'-prefixed line as a comment continuation, which is right for Python/Ruby/Elixir but swallowed the '#define'/'#include' lines immediately following the new vcpkg fixture's BREAKING comment into the generated explanation text. Only treat '#' as a comment marker when it's followed by whitespace or end of line, then regenerate all 16 DEMO.md files against the current source. Co-Authored-By: Claude Sonnet 5 --- demos/arduino/DEMO.md | 2 +- demos/cargo/DEMO.md | 2 +- demos/cocoapods/DEMO.md | 2 +- demos/conan/DEMO.md | 6 ++---- demos/go/DEMO.md | 2 +- demos/hex/DEMO.md | 6 ++---- demos/maven/DEMO.md | 2 +- demos/npm/DEMO.md | 2 +- demos/nuget/DEMO.md | 2 +- demos/opam/DEMO.md | 6 ++---- demos/packagist/DEMO.md | 8 +++----- demos/pub/DEMO.md | 8 +++----- demos/pypi/DEMO.md | 2 +- demos/rubygems/DEMO.md | 2 +- demos/swift/DEMO.md | 2 +- demos/vcpkg/DEMO.md | 17 ++++++++--------- scripts/make-demo-docs.mjs | 9 +++++++-- 17 files changed, 37 insertions(+), 43 deletions(-) diff --git a/demos/arduino/DEMO.md b/demos/arduino/DEMO.md index d5dcacf..fe1716d 100644 --- a/demos/arduino/DEMO.md +++ b/demos/arduino/DEMO.md @@ -6,7 +6,7 @@ The Codespace upgraded it to **6.21.3** and left the source code alone, so `src/main.cpp` is now written against an API that no longer exists. That is the situation Drift is built to analyse. -5 breaking changes in this demo: +The 5 breaking changes in this demo: 1. StaticJsonBuffer was removed in ArduinoJson 6, replaced by StaticJsonDocument. The buffer/document split is gone entirely. 2. JsonObject was a reference type created from the buffer in v5 (`JsonObject& root = jsonBuffer.createObject()`). In v6 it is a value type obtained from a document with `doc.to()`. diff --git a/demos/cargo/DEMO.md b/demos/cargo/DEMO.md index 0f48a49..0f6be5d 100644 --- a/demos/cargo/DEMO.md +++ b/demos/cargo/DEMO.md @@ -6,7 +6,7 @@ The Codespace upgraded it to **4.5.4** and left the source code alone, so `src/main.rs` is now written against an API that no longer exists. That is the situation Drift is built to analyse. -5 breaking changes in this demo: +The 5 breaking changes in this demo: 1. `clap::App` was renamed to `clap::Command` in clap 3 and the old name was removed in clap 4. This import no longer resolves. 2. `clap::SubCommand` was removed in clap 3 — subcommands are just `Command` values now, built with `Command::new(..)`. diff --git a/demos/cocoapods/DEMO.md b/demos/cocoapods/DEMO.md index 98fd5c8..404972b 100644 --- a/demos/cocoapods/DEMO.md +++ b/demos/cocoapods/DEMO.md @@ -6,7 +6,7 @@ The Codespace upgraded it to **5.9.1** and left the source code alone, so `DriftDemo/NetworkService.swift` is now written against an API that no longer exists. That is the situation Drift is built to analyse. -5 breaking changes in this demo: +The 5 breaking changes in this demo: 1. SessionManager was removed in Alamofire 5, replaced by Session/AF. 2. Alamofire 5 removed the SessionDelegate hooks that were assigned like this; retry and adapt are handled by a RequestInterceptor now. diff --git a/demos/conan/DEMO.md b/demos/conan/DEMO.md index 2e9c9e2..22f07a8 100644 --- a/demos/conan/DEMO.md +++ b/demos/conan/DEMO.md @@ -6,11 +6,9 @@ The Codespace upgraded it to **10.2.1** and left the source code alone, so `src/main.cpp` is now written against an API that no longer exists. That is the situation Drift is built to analyse. -3 breaking changes in this demo: +The breaking change in this demo: -1. fmt 10 made compile-time format-string checking the default for fmt::format. A runtime std::string as the format argument is now a compile error unless you wrap it in fmt::runtime(..). -2. fmt::join moved out of into in fmt 10, so this no longer resolves with the headers included above. -3. fmt::print(FILE*, ..) with a non-constexpr format string is affected by the same compile-time checking change as fmt::format above. +1. fmt 10.0.0 "removed deprecated implicit conversions for enums and conversions to primitive types for compatibility with std::format and to prevent potential ODR violations. Use `format_as` instead." ## Try it diff --git a/demos/go/DEMO.md b/demos/go/DEMO.md index ffdf6f8..c8770cc 100644 --- a/demos/go/DEMO.md +++ b/demos/go/DEMO.md @@ -6,7 +6,7 @@ The Codespace upgraded it to **v0.0.0-20231006140011-7918f672742d** and left the `main.go` is now written against an API that no longer exists. That is the situation Drift is built to analyse. -4 breaking changes in this demo: +The 4 breaking changes in this demo: 1. slices.SortFunc took `func(a, b E) bool` (a "less" predicate). It now takes `func(a, b E) int` (a "compare" function, like cmp.Compare). 2. Same change for the stable variant. diff --git a/demos/hex/DEMO.md b/demos/hex/DEMO.md index 277eb24..de8bf5e 100644 --- a/demos/hex/DEMO.md +++ b/demos/hex/DEMO.md @@ -6,11 +6,9 @@ The Codespace upgraded it to **1.15.0** and left the source code alone, so `lib/server.ex` is now written against an API that no longer exists. That is the situation Drift is built to analyse. -3 breaking changes in this demo: +The breaking change in this demo: -1. Plug.Adapters.Cowboy2 was removed in Plug 1.15. It had been a deprecated shim for the separate :plug_cowboy package since Plug 1.7. -2. Plug.Adapters.Test.Conn was removed in the same sweep; the test helper is Plug.Test now. -3. Plug.Parsers.JSON was removed — JSON parsing goes through Plug.Parsers with a :json_decoder option. +1. Plug.Adapters.Cowboy2 was removed in Plug 1.15. It had been a deprecated shim for the separate :plug_cowboy package since Plug 1.7, and lib/plug/adapters/cowboy2.ex is simply gone from the 1.15 release, so this call raises UndefinedFunctionError. ## Try it diff --git a/demos/maven/DEMO.md b/demos/maven/DEMO.md index 866ebaf..38bf084 100644 --- a/demos/maven/DEMO.md +++ b/demos/maven/DEMO.md @@ -6,7 +6,7 @@ The Codespace upgraded it to **21.0** and left the source code alone, so `src/main/java/com/example/demo/Config.java` is now written against an API that no longer exists. That is the situation Drift is built to analyse. -4 breaking changes in this demo: +The 4 breaking changes in this demo: 1. Objects.firstNonNull was removed in Guava 21. It moved to MoreObjects.firstNonNull back in Guava 18 and the old alias is now gone. 2. Objects.toStringHelper was removed in Guava 21 for the same reason — it is MoreObjects.toStringHelper now. diff --git a/demos/npm/DEMO.md b/demos/npm/DEMO.md index 6c20c1d..9547671 100644 --- a/demos/npm/DEMO.md +++ b/demos/npm/DEMO.md @@ -6,7 +6,7 @@ The Codespace upgraded it to **1.7.7** and left the source code alone, so `src/api-client.ts` is now written against an API that no longer exists. That is the situation Drift is built to analyse. -3 breaking changes in this demo: +The 3 breaking changes in this demo: 1. `AxiosTransformer` was removed in axios 1.0. Response transformers are now typed as `AxiosResponseTransformer` (and request ones as `AxiosRequestTransformer`), so this import no longer resolves at all. 2. `AxiosProxyConfig` used to carry `username` / `password` directly. In axios 1.0 those moved into a nested `auth: { username, password }` object, so these two properties no longer exist on the type. diff --git a/demos/nuget/DEMO.md b/demos/nuget/DEMO.md index 032a599..4758bf5 100644 --- a/demos/nuget/DEMO.md +++ b/demos/nuget/DEMO.md @@ -6,7 +6,7 @@ The Codespace upgraded it to **9.0.0** and left the source code alone, so `Mapping.cs` is now written against an API that no longer exists. That is the situation Drift is built to analyse. -5 breaking changes in this demo: +The 5 breaking changes in this demo: 1. The static Mapper.Initialize was removed in AutoMapper 9. You build a MapperConfiguration and inject IMapper instead. 2. IMapperConfigurationExpression.CreateMissingTypeMaps was removed in AutoMapper 9; every mapping must be declared explicitly. diff --git a/demos/opam/DEMO.md b/demos/opam/DEMO.md index 03e4cee..b2ee598 100644 --- a/demos/opam/DEMO.md +++ b/demos/opam/DEMO.md @@ -6,11 +6,9 @@ The Codespace upgraded it to **5.7.0** and left the source code alone, so `lib/scheduler.ml` is now written against an API that no longer exists. That is the situation Drift is built to analyse. -3 breaking changes in this demo: +The breaking change in this demo: -1. Lwt_sequence was removed from Lwt's public API in Lwt 5.0. It is an internal module now; consumers were told to vendor it. -2. Lwt.wrap1 (and wrap2..wrap7) were removed in Lwt 5.0. -3. Lwt.add_task_l and Lwt.add_task_r were removed in Lwt 5.0 along with the public Lwt_sequence they operated on. +1. Lwt 5.0.0 narrowed [Lwt.async] from [(unit -> _ t) -> unit] to [(unit -> unit t) -> unit]: the callback must now evaluate to [unit Lwt.t] rather than any ['a Lwt.t]. The callback below returns [int Lwt.t], which compiled under Lwt 4 and is a type error under Lwt 5. ## Try it diff --git a/demos/packagist/DEMO.md b/demos/packagist/DEMO.md index 58fdb6d..2025913 100644 --- a/demos/packagist/DEMO.md +++ b/demos/packagist/DEMO.md @@ -6,12 +6,10 @@ The Codespace upgraded it to **3.5.0** and left the source code alone, so `src/Logging.php` is now written against an API that no longer exists. That is the situation Drift is built to analyse. -4 breaking changes in this demo: +The 2 breaking changes in this demo: -1. Monolog\Handler\SwiftMailerHandler was deleted in Monolog 3 — SwiftMailer itself is end-of-life, and the handler went with it. -2. Handlers took an int level in Monolog 2 (Logger::WARNING === 300). In Monolog 3 they take a Monolog\Level enum case, and passing an int is a TypeError. -3. Logger::getLevels() was removed in Monolog 3; the Level enum replaces the int/name lookup tables entirely. -4. Logger::getLevelName() was removed for the same reason — a Level enum case knows its own name. +1. Monolog\Handler\SwiftMailerHandler was deleted in Monolog 3 — SwiftMailer itself is end-of-life, and the handler went with it. This class does not exist in 3.x, so resolving the reference below is a fatal error. +2. Logger::getLevels() was removed in Monolog 3. The Level enum replaced the int/name lookup tables, so this static call no longer exists. ## Try it diff --git a/demos/pub/DEMO.md b/demos/pub/DEMO.md index f6bc5f0..b0f030a 100644 --- a/demos/pub/DEMO.md +++ b/demos/pub/DEMO.md @@ -6,12 +6,10 @@ The Codespace upgraded it to **5.0.0** and left the source code alone, so `lib/api_client.dart` is now written against an API that no longer exists. That is the situation Drift is built to analyse. -4 breaking changes in this demo: +The 2 breaking changes in this demo: -1. Dio.lock() / unlock() / clear() were removed in Dio 5. Queue control is done with QueuedInterceptor now. -2. connectTimeout / receiveTimeout took an int of milliseconds in Dio 4. In Dio 5 they take a Duration, so an int no longer type-checks. -3. DefaultHttpClientAdapter was removed in Dio 5, replaced by IOHttpClientAdapter. -4. DioError was renamed to DioException in Dio 5. +1. Dio.lock() / unlock() / clear() were removed in Dio 5. Request-queue control is done with QueuedInterceptor now, so these three calls no longer resolve. +2. connectTimeout and receiveTimeout took an int of milliseconds in Dio 4. In Dio 5 they are `Duration?`, so assigning an int no longer type-checks. ## Try it diff --git a/demos/pypi/DEMO.md b/demos/pypi/DEMO.md index ed9e56e..45c46a0 100644 --- a/demos/pypi/DEMO.md +++ b/demos/pypi/DEMO.md @@ -6,7 +6,7 @@ The Codespace upgraded it to **2.1.0** and left the source code alone, so `src/auth.py` is now written against an API that no longer exists. That is the situation Drift is built to analyse. -4 breaking changes in this demo: +The 4 breaking changes in this demo: 1. `safe_str_cmp` was removed in Werkzeug 2.1. It was deprecated in 2.0 in favour of `hmac.compare_digest`. This import raises ImportError outright. 2. `pbkdf2_hex` and `pbkdf2_bin` were removed in Werkzeug 2.1; hashlib has `pbkdf2_hmac` built in. diff --git a/demos/rubygems/DEMO.md b/demos/rubygems/DEMO.md index 94cb65b..78cf25e 100644 --- a/demos/rubygems/DEMO.md +++ b/demos/rubygems/DEMO.md @@ -6,7 +6,7 @@ The Codespace upgraded it to **3.1.0** and left the source code alone, so `lib/app.rb` is now written against an API that no longer exists. That is the situation Drift is built to analyse. -3 breaking changes in this demo: +The 3 breaking changes in this demo: 1. Rack::File was removed in Rack 3.1. It had been a deprecated alias of Rack::Files since 2.1. 2. Rack::Chunked was removed in Rack 3.1 — chunked encoding is handled by the server, not by middleware, under the Rack 3 spec. diff --git a/demos/swift/DEMO.md b/demos/swift/DEMO.md index 015e4b9..5754152 100644 --- a/demos/swift/DEMO.md +++ b/demos/swift/DEMO.md @@ -6,7 +6,7 @@ The Codespace upgraded it to **5.9.1** and left the source code alone, so `Sources/DriftDemo/ApiClient.swift` is now written against an API that no longer exists. That is the situation Drift is built to analyse. -4 breaking changes in this demo: +The 4 breaking changes in this demo: 1. SessionManager was removed in Alamofire 5 and replaced by Session, reached through the `AF` global. 2. The top-level Alamofire.request(..) function was removed in Alamofire 5; it is AF.request(..) now. diff --git a/demos/vcpkg/DEMO.md b/demos/vcpkg/DEMO.md index 88dc67d..b9b5576 100644 --- a/demos/vcpkg/DEMO.md +++ b/demos/vcpkg/DEMO.md @@ -1,22 +1,21 @@ # Try Drift — C / C++ (vcpkg) -This project depends on `spdlog` **1.11.0**. +This project depends on `catch2` **2.13.9**. -The Codespace upgraded it to **1.14.1** and left the source code alone, so -`src/main.cpp` is now written against an API that no longer exists. That is +The Codespace upgraded it to **3.5.2** and left the source code alone, so +`src/tests.cpp` is now written against an API that no longer exists. That is the situation Drift is built to analyse. -3 breaking changes in this demo: +The 2 breaking changes in this demo: -1. spdlog::set_pattern is fine, but from 1.12 spdlog vendors fmt 10, whose compile-time format checking rejects a runtime std::string as a format string. This call now needs fmt::runtime(..). -2. Same cause: a non-constexpr format string passed to a logging call is a compile error under the bundled fmt 10. -3. spdlog::rotating_logger_mt's max_file_size argument became strongly typed in later 1.x releases; passing a plain signed literal here relies on a conversion that no longer applies cleanly. +1. Catch2 v3 deleted the v2 single header. `catch2/catch.hpp` shipped for the whole 2.x line and does not exist in 3.x at all — the library was split into many headers, and a test file includes `catch2/catch_test_macros.hpp` instead. This include fails outright. +2. CATCH_CONFIG_MAIN is gone in Catch2 v3. Catch2's own migration guide says to "delete TU with CATCH_CONFIG_RUNNER or CATCH_CONFIG_MAIN defined" and link against Catch2::Catch2WithMain instead, so defining it above no longer generates a main(). ## Try it 1. Open the Drift icon in the Activity Bar. -2. Look at what Drift found for `spdlog`. -3. Open `src/main.cpp` and compare against the marked lines. +2. Look at what Drift found for `catch2`. +3. Open `src/tests.cpp` and compare against the marked lines. ```sh git status --short # only the manifest is modified; the source is untouched diff --git a/scripts/make-demo-docs.mjs b/scripts/make-demo-docs.mjs index b3ee09b..c05ce2f 100644 --- a/scripts/make-demo-docs.mjs +++ b/scripts/make-demo-docs.mjs @@ -20,18 +20,23 @@ for (const demo of allDemos()) { // explaining it. Pull those out so the guide lists the real ones. const breaks = []; const lines = source.split('\n'); + // `#` only counts as a comment marker when it is followed by whitespace or + // nothing — otherwise it matches C/C++ preprocessor directives (`#define`, + // `#include`) immediately following a `//`-comment BREAKING block, and those + // get swallowed into the explanation text instead of ending it. + const COMMENT_LINE = /^\s*(\/\/|#(?=\s|$)|--)/; for (let i = 0; i < lines.length; i += 1) { // The marker is a ruled comment line: `── BREAKING ──` or `── BREAKING 2 ──`. if (!/──\s*BREAKING(\s+\d+)?\s*──/.test(lines[i])) continue; // Consume the explanation that follows the marker. Line-comment languages // end it at the first non-comment or blank line; OCaml's block comments // have no per-line marker, so there the block ends at `*)`. - const blockComment = !/^\s*(\/\/|#|--)/.test(lines[i + 1] ?? ''); + const blockComment = !COMMENT_LINE.test(lines[i + 1] ?? ''); const text = []; for (let j = i + 1; j < lines.length; j += 1) { const raw = lines[j]; const closes = blockComment && /\*\)/.test(raw); - if (!blockComment && (!/^\s*(\/\/|#|--)/.test(raw) || raw.trim().replace(/^\s*(\/\/|#|--)\s?/, '') === '')) break; + if (!blockComment && (!COMMENT_LINE.test(raw) || raw.trim().replace(/^\s*(\/\/|#|--)\s?/, '') === '')) break; const stripped = raw .replace(/\*\)\s*$/, '') .replace(/^\s*(\/\/|#|--|\(\*)?\s?/, '') From d38650b3880ad15268dbb1cf959548b3d55fc3e6 Mon Sep 17 00:00:00 2001 From: Rodolphe Date: Sat, 29 Aug 2026 15:21:08 -0400 Subject: [PATCH 4/8] feat(demo): provision the Rust toolchain at Codespace creation Drift's Rust surface diff shells out to cargo public-api, which needs the nightly toolchain to read rustdoc's unstable JSON output. Drift auto-installs both itself on first analysis (tools.autoInstall defaults to true in the extension), but cargo-public-api compiles from source, leaving the panel apparently frozen for several minutes on a visitor's first open. Move that wait into onCreateCommand instead, where a Codespace build is expected to take a while. Co-Authored-By: Claude Sonnet 5 --- .devcontainer/cargo/devcontainer.json | 2 +- .devcontainer/cargo/setup.sh | 26 ++++++++++++++++++++++++++ scripts/lib/devcontainer-spec.mjs | 8 +++++++- 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100755 .devcontainer/cargo/setup.sh diff --git a/.devcontainer/cargo/devcontainer.json b/.devcontainer/cargo/devcontainer.json index 752e33c..9747933 100644 --- a/.devcontainer/cargo/devcontainer.json +++ b/.devcontainer/cargo/devcontainer.json @@ -10,7 +10,7 @@ "version": "lts" } }, - "onCreateCommand": "node scripts/prepare-demo.mjs cargo", + "onCreateCommand": ".devcontainer/cargo/setup.sh", "waitFor": "onCreateCommand", "customizations": { "vscode": { diff --git a/.devcontainer/cargo/setup.sh b/.devcontainer/cargo/setup.sh new file mode 100755 index 0000000..79e1765 --- /dev/null +++ b/.devcontainer/cargo/setup.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +# Creation-time setup for the Rust demo Codespace. +# +# Drift's Rust surface diff shells out to `cargo public-api`, which reads +# rustdoc's unstable JSON output and so needs the nightly toolchain. Drift will +# install both itself on first analysis (`tools.autoInstall` defaults to true), +# but `cargo install cargo-public-api` compiles from source — several minutes +# with the Drift panel apparently frozen. Doing it here moves that wait into +# the Codespace build, where it belongs. +# +# cargo-public-api is pinned; the nightly channel is not, matching what Drift's +# own auto-install does (`rustup toolchain install nightly --profile minimal`). +set -euo pipefail + +CARGO_PUBLIC_API_VERSION="0.52.0" + +echo "==> Installing nightly toolchain (required by cargo public-api)" +rustup toolchain install nightly --profile minimal + +echo "==> Installing cargo-public-api $CARGO_PUBLIC_API_VERSION" +cargo install cargo-public-api --locked --version "$CARGO_PUBLIC_API_VERSION" + +echo "==> Preparing the Rust demo" +node scripts/prepare-demo.mjs cargo + +echo "==> Rust demo ready" diff --git a/scripts/lib/devcontainer-spec.mjs b/scripts/lib/devcontainer-spec.mjs index fdb73d7..1582ecb 100644 --- a/scripts/lib/devcontainer-spec.mjs +++ b/scripts/lib/devcontainer-spec.mjs @@ -28,7 +28,13 @@ export const ECOSYSTEM_CONTAINERS = { // x/exp only ships pseudo-versions, which Drift reads as a patch move. settings: { 'drift.analysis.includePatch': true }, }, - cargo: { image: 'mcr.microsoft.com/devcontainers/rust:1-1-bookworm' }, + cargo: { + image: 'mcr.microsoft.com/devcontainers/rust:1-1-bookworm', + // Drift's Rust surface diff needs `cargo public-api` + nightly, which it + // would otherwise compile from source on first analysis. Provisioned up + // front so the panel is not blank for minutes. See setup.sh. + setup: '.devcontainer/cargo/setup.sh', + }, maven: { image: 'mcr.microsoft.com/devcontainers/java:1-21-bookworm', features: { 'ghcr.io/devcontainers/features/java:1': { version: 'none', installMaven: true } }, From fef6ccaba2b2a52d24671d7c343d2f9ebfa8f242 Mon Sep 17 00:00:00 2001 From: Rodolphe Date: Sat, 29 Aug 2026 15:21:33 -0400 Subject: [PATCH 5/8] docs(demo): add direct Codespaces launch links MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace the README's -parameterized URL with a generated table where each demo has its own working https://codespaces.new link, built by a new scripts/make-readme.mjs from the devcontainers that actually exist so it can't drift. Also trims the README back to what a visitor needs: what the repo is, how the demo state works, the table, and the maintenance scripts — and states plainly that no demo has been smoke-tested in a real Codespace yet. Co-Authored-By: Claude Sonnet 5 --- README.md | 88 +++++++++++++++++++++-------------------- scripts/make-readme.mjs | 50 +++++++++++++++++++++++ 2 files changed, 95 insertions(+), 43 deletions(-) create mode 100644 scripts/make-readme.mjs diff --git a/README.md b/README.md index 2865c57..6407107 100644 --- a/README.md +++ b/README.md @@ -1,55 +1,60 @@ # Drift demos -Example projects for Drift's **Try Drift in your browser** experience. Each one -is a tiny real project pinned to an old version of a real dependency, with -source code that uses APIs the newer version breaks. +Small example projects for trying [Drift](https://github.com/trydrift/drift) in +the browser. Each one is pinned to an old version of a real dependency and uses +an API the newer version breaks. -Open one in a Codespace and Drift is already installed, the upgrade is already -applied, and there is something real for it to find. +Open one in a Codespace: Drift is installed, the upgrade is already applied, and +there is something real for it to find. -## How it works +## How the demo state works -Each demo is committed at the **old** dependency version, with source code that -was correct for it. Codespace creation edits the manifest to the **new** version -and leaves the source alone: +Each demo is committed at the **old** dependency version, with source that was +correct for it. Codespace creation edits the manifest to the **new** version and +leaves the source alone: ``` committed: dependency@OLD + source written for OLD after setup: dependency@NEW + source written for OLD ← Drift analyses this ``` -`git status` in a fresh Codespace shows only the manifest as modified. Every -breaking usage in the source is marked with a `BREAKING` comment explaining what -changed and why it no longer works. +`git status` in a fresh Codespace shows only the manifest as modified. Each +breaking usage carries a `BREAKING` comment naming the change. -## The demos - -| Ecosystem | Language | Dependency | Upgrade | -| --- | --- | --- | --- | -| `npm` | JavaScript / TypeScript | `axios` | 0.21.4 → 1.7.7 | -| `pypi` | Python | `werkzeug` | 2.0.3 → 2.1.0 | -| `go` | Go | `golang.org/x/exp` | 2023-05 → 2023-10 | -| `cargo` | Rust | `clap` | 2.34.0 → 4.5.4 | -| `maven` | Java / Kotlin / Scala | `com.google.guava:guava` | 20.0 → 21.0 | -| `rubygems` | Ruby | `rack` | 3.0.0 → 3.1.0 | -| `nuget` | .NET | `AutoMapper` | 8.1.1 → 9.0.0 | -| `packagist` | PHP | `monolog/monolog` | 2.9.3 → 3.5.0 | -| `hex` | Elixir / Erlang | `plug` | 1.13.6 → 1.15.0 | -| `pub` | Dart / Flutter | `dio` | 4.0.6 → 5.0.0 | -| `swift` | Swift | `Alamofire` | 4.9.1 → 5.9.1 | -| `cocoapods` | CocoaPods | `Alamofire` | 4.9.1 → 5.9.1 | -| `opam` | OCaml | `lwt` | 4.5.0 → 5.7.0 | -| `conan` | C / C++ (Conan) | `fmt` | 9.1.0 → 10.2.1 | -| `vcpkg` | C / C++ (vcpkg) | `spdlog` | 1.11.0 → 1.14.1 | -| `arduino` | Arduino / PlatformIO | `ArduinoJson` | 5.13.5 → 6.21.3 | - -## Launching one +Demos aim for **1–3 clear, documented breaks** — one indisputable example beats +several arguable ones. -``` -https://codespaces.new/trydrift/demo?quickstart=1&devcontainer_path=.devcontainer%2F%2Fdevcontainer.json -``` +## The demos -Requires a GitHub account, and runs on your own GitHub Codespaces allowance. + + +| Ecosystem | Language | Dependency | Upgrade | Try | +| --- | --- | --- | --- | --- | +| `npm` | JavaScript / TypeScript | `axios` | 0.21.4 → 1.7.7 | [Open](https://codespaces.new/trydrift/demo?quickstart=1&devcontainer_path=.devcontainer%2Fnpm%2Fdevcontainer.json) | +| `pypi` | Python | `werkzeug` | 2.0.3 → 2.1.0 | [Open](https://codespaces.new/trydrift/demo?quickstart=1&devcontainer_path=.devcontainer%2Fpypi%2Fdevcontainer.json) | +| `go` | Go | `golang.org/x/exp` | 2023-05-22 → 2023-10-06 | [Open](https://codespaces.new/trydrift/demo?quickstart=1&devcontainer_path=.devcontainer%2Fgo%2Fdevcontainer.json) | +| `cargo` | Rust | `clap` | 2.34.0 → 4.5.4 | [Open](https://codespaces.new/trydrift/demo?quickstart=1&devcontainer_path=.devcontainer%2Fcargo%2Fdevcontainer.json) | +| `maven` | Java / Kotlin / Scala | `com.google.guava:guava` | 20.0 → 21.0 | [Open](https://codespaces.new/trydrift/demo?quickstart=1&devcontainer_path=.devcontainer%2Fmaven%2Fdevcontainer.json) | +| `rubygems` | Ruby | `rack` | 3.0.0 → 3.1.0 | [Open](https://codespaces.new/trydrift/demo?quickstart=1&devcontainer_path=.devcontainer%2Frubygems%2Fdevcontainer.json) | +| `nuget` | .NET | `AutoMapper` | 8.1.1 → 9.0.0 | [Open](https://codespaces.new/trydrift/demo?quickstart=1&devcontainer_path=.devcontainer%2Fnuget%2Fdevcontainer.json) | +| `packagist` | PHP | `monolog/monolog` | 2.9.3 → 3.5.0 | [Open](https://codespaces.new/trydrift/demo?quickstart=1&devcontainer_path=.devcontainer%2Fpackagist%2Fdevcontainer.json) | +| `hex` | Elixir / Erlang | `plug` | 1.13.6 → 1.15.0 | [Open](https://codespaces.new/trydrift/demo?quickstart=1&devcontainer_path=.devcontainer%2Fhex%2Fdevcontainer.json) | +| `pub` | Dart / Flutter | `dio` | 4.0.6 → 5.0.0 | [Open](https://codespaces.new/trydrift/demo?quickstart=1&devcontainer_path=.devcontainer%2Fpub%2Fdevcontainer.json) | +| `swift` | Swift | `https://github.com/Alamofire/Alamofire` | 4.9.1 → 5.9.1 | [Open](https://codespaces.new/trydrift/demo?quickstart=1&devcontainer_path=.devcontainer%2Fswift%2Fdevcontainer.json) | +| `cocoapods` | CocoaPods | `Alamofire` | 4.9.1 → 5.9.1 | [Open](https://codespaces.new/trydrift/demo?quickstart=1&devcontainer_path=.devcontainer%2Fcocoapods%2Fdevcontainer.json) | +| `opam` | OCaml | `lwt` | 4.5.0 → 5.7.0 | [Open](https://codespaces.new/trydrift/demo?quickstart=1&devcontainer_path=.devcontainer%2Fopam%2Fdevcontainer.json) | +| `conan` | C / C++ (Conan) | `fmt` | 9.1.0 → 10.2.1 | [Open](https://codespaces.new/trydrift/demo?quickstart=1&devcontainer_path=.devcontainer%2Fconan%2Fdevcontainer.json) | +| `vcpkg` | C / C++ (vcpkg) | `catch2` | 2.13.9 → 3.5.2 | [Open](https://codespaces.new/trydrift/demo?quickstart=1&devcontainer_path=.devcontainer%2Fvcpkg%2Fdevcontainer.json) | +| `arduino` | Arduino / PlatformIO | `bblanchon/ArduinoJson` | 5.13.5 → 6.21.3 | [Open](https://codespaces.new/trydrift/demo?quickstart=1&devcontainer_path=.devcontainer%2Farduino%2Fdevcontainer.json) | + + + +Launching one requires a GitHub account and uses your own GitHub Codespaces +allowance. + +> These are prepared fixtures. No demo has been smoke-tested in a real Codespace +> yet, and the `drift.drift` Marketplace install cannot be verified until the +> extension is published. ## Layout @@ -58,7 +63,7 @@ demos// ├── DEMO.md generated from the BREAKING comments in the source ├── demo.json dependency, versions, and the manifest edit ├── pinned to the old version -└── uses APIs the new version breaks +└── uses an API the new version breaks ``` ## Scripts @@ -68,9 +73,6 @@ node scripts/prepare-demo.mjs # apply the upgrade (what the Codesp node scripts/reset-demo.mjs # put the manifest back node scripts/sync-devcontainers.mjs # regenerate .devcontainer/* node scripts/make-demo-docs.mjs # regenerate DEMO.md files +node scripts/make-readme.mjs # regenerate the table above node scripts/check-demos.mjs # sanity check, no toolchains needed ``` - -## Drift - -https://github.com/trydrift/drift diff --git a/scripts/make-readme.mjs b/scripts/make-readme.mjs new file mode 100644 index 0000000..4a4003e --- /dev/null +++ b/scripts/make-readme.mjs @@ -0,0 +1,50 @@ +#!/usr/bin/env node +// Regenerate the demo table in README.md from the demos themselves, so the +// versions and the launch links cannot drift from what is committed. +// +// node scripts/make-readme.mjs [--check] + +import { readFileSync, writeFileSync } from 'node:fs'; +import { join } from 'node:path'; + +import { REPO_ROOT, allDemos } from './lib/demo-config.mjs'; + +const START = ''; +const END = ''; + +/** Go pseudo-versions are unreadable in a table; show the date they encode. */ +function short(version) { + const pseudo = version.match(/^v0\.0\.0-(\d{4})(\d{2})(\d{2})\d{6}-[0-9a-f]+$/); + return pseudo ? `${pseudo[1]}-${pseudo[2]}-${pseudo[3]}` : version; +} + +const rows = allDemos().map((demo) => { + const path = encodeURIComponent(`.devcontainer/${demo.ecosystem}/devcontainer.json`); + const url = `https://codespaces.new/trydrift/demo?quickstart=1&devcontainer_path=${path}`; + return `| \`${demo.ecosystem}\` | ${demo.label} | \`${demo.dependency}\` | ${short(demo.from)} → ${short(demo.to)} | [Open](${url}) |`; +}); + +const table = [ + START, + '', + '| Ecosystem | Language | Dependency | Upgrade | Try |', + '| --- | --- | --- | --- | --- |', + ...rows, + '', + END, +].join('\n'); + +const path = join(REPO_ROOT, 'README.md'); +const current = readFileSync(path, 'utf8'); +const updated = current.replace(new RegExp(`${START}[\\s\\S]*?${END}`), table); + +if (updated === current) { + process.stdout.write('README table is up to date.\n'); + process.exit(0); +} +if (process.argv.includes('--check')) { + process.stderr.write('README demo table is out of date — run: node scripts/make-readme.mjs\n'); + process.exit(1); +} +writeFileSync(path, updated); +process.stdout.write(`✓ README demo table (${rows.length} demos)\n`); From f952c69c167e3168a99252d5ef28a78418a5db91 Mon Sep 17 00:00:00 2001 From: Rodolphe Date: Sat, 29 Aug 2026 15:21:42 -0400 Subject: [PATCH 6/8] docs(demo): fix stale maintainer notes browser-demo.md still described the pre-#19 upgrade.patch mechanism and carried a hand-maintained, five-row Deep-links table left over from before all 16 demos existed. Point both at what's actually there: demo.json's find/replace edits, and the generated README table. Co-Authored-By: Claude Sonnet 5 --- docs/browser-demo.md | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/docs/browser-demo.md b/docs/browser-demo.md index b3dfb95..f4840e7 100644 --- a/docs/browser-demo.md +++ b/docs/browser-demo.md @@ -5,17 +5,25 @@ How the "Try Drift in your browser" demos are built and launched. ## The model Each demo lives at `demos//` and is committed at the **old** -dependency version, with source code valid against it. A per-ecosystem -devcontainer applies `demos//.drift-demo/upgrade.patch` **once, at -creation time**, which moves only dependency metadata to the **new** version. -The application source is never touched. +dependency version, with source code valid against it. `demos//demo.json` +declares the upgrade as a literal find/replace on the manifest — deliberately not +a patch file, since a demo upgrade is one version string and a plain replacement +can't go stale the way a diff can. A per-ecosystem devcontainer applies that edit +**once, at creation time**, via `node scripts/prepare-demo.mjs `. The +application source is never touched. Drift then analyses an ordinary uncommitted manifest change — the exact situation a developer is in mid-upgrade. Nothing in Drift knows this is a demo. ## Devcontainer lifecycle -`onCreateCommand` runs the prepare step: +`onCreateCommand` runs the prepare step — `node scripts/prepare-demo.mjs +` for most demos, or a longer `setup` command from +`scripts/lib/devcontainer-spec.mjs` for the few that need something installed +first (a package manager, or — for Cargo — the nightly toolchain and +`cargo-public-api` that Drift's Rust surface diff needs, provisioned up front so +the panel isn't blank for minutes on first analysis; see +`.devcontainer/cargo/setup.sh`): ``` node scripts/prepare-demo.mjs @@ -52,20 +60,19 @@ and the manifest. ## Deep links -GitHub's standard Codespaces deep link, one per devcontainer: +Every demo's launch link is GitHub's standard Codespaces deep link for its +devcontainer: -| Ecosystem | Link | -| --- | --- | -| npm | `https://codespaces.new/trydrift/demo?quickstart=1&devcontainer_path=.devcontainer%2Fnpm%2Fdevcontainer.json` | -| pypi | `https://codespaces.new/trydrift/demo?quickstart=1&devcontainer_path=.devcontainer%2Fpypi%2Fdevcontainer.json` | -| go | `https://codespaces.new/trydrift/demo?quickstart=1&devcontainer_path=.devcontainer%2Fgo%2Fdevcontainer.json` | -| cargo | `https://codespaces.new/trydrift/demo?quickstart=1&devcontainer_path=.devcontainer%2Fcargo%2Fdevcontainer.json` | -| maven | `https://codespaces.new/trydrift/demo?quickstart=1&devcontainer_path=.devcontainer%2Fmaven%2Fdevcontainer.json` | +``` +https://codespaces.new/trydrift/demo?quickstart=1&devcontainer_path=.devcontainer%2F%2Fdevcontainer.json +``` -These must be confirmed against the link GitHub generates from its own -Codespaces create flow before they are wired into the website (#7). They have -not been exercised end to end yet — that waits on the extension being published -to the Marketplace. +The README's demo table carries the full set, generated by +`node scripts/make-readme.mjs` so it can't drift from the devcontainers that +actually exist. They have not been exercised end to end yet — that waits on the +extension being published to the Marketplace, at which point a manual smoke +test through the real Codespaces create flow should confirm the link shape +still matches. ## Cost From c26ef8133a474ec5610543331c704ce28f001214 Mon Sep 17 00:00:00 2001 From: Rodolphe Date: Sat, 29 Aug 2026 15:21:50 -0400 Subject: [PATCH 7/8] test(demo): strengthen check-demos.mjs structural checks Add cheap, no-toolchain assertions: exactly 16 known ecosystems have a demo, exactly 16 devcontainers exist, each demo.json declares at least one edit, each demo's source carries at least one BREAKING marker, and the README launch table is checked alongside the other generated files. Co-Authored-By: Claude Sonnet 5 --- scripts/check-demos.mjs | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/scripts/check-demos.mjs b/scripts/check-demos.mjs index d0bd59a..63bcd76 100644 --- a/scripts/check-demos.mjs +++ b/scripts/check-demos.mjs @@ -5,11 +5,15 @@ // node scripts/check-demos.mjs import { spawnSync } from 'node:child_process'; -import { existsSync } from 'node:fs'; +import { existsSync, readFileSync } from 'node:fs'; import { join } from 'node:path'; import { REPO_ROOT, allDemos, KNOWN_ECOSYSTEMS } from './lib/demo-config.mjs'; +// Same marker `make-demo-docs.mjs` looks for: a ruled comment line reading +// `── BREAKING ──` or `── BREAKING 2 ──`. +const BREAKING_MARKER = /──\s*BREAKING(\s+\d+)?\s*──/; + const demos = allDemos(); let failures = 0; @@ -18,7 +22,14 @@ const check = (ok, label) => { if (!ok) failures += 1; }; -process.stdout.write(`${demos.length} of ${KNOWN_ECOSYSTEMS.length} ecosystems have a demo\n\n`); +process.stdout.write(`${demos.length} of ${KNOWN_ECOSYSTEMS.length} ecosystems have a demo\n`); +check(demos.length === KNOWN_ECOSYSTEMS.length, `exactly ${KNOWN_ECOSYSTEMS.length} known ecosystems have a demo`); + +const devcontainerCount = KNOWN_ECOSYSTEMS.filter((eco) => + existsSync(join(REPO_ROOT, '.devcontainer', eco, 'devcontainer.json')), +).length; +check(devcontainerCount === KNOWN_ECOSYSTEMS.length, `exactly ${KNOWN_ECOSYSTEMS.length} devcontainers exist`); +process.stdout.write('\n'); for (const demo of demos) { process.stdout.write(`${demo.ecosystem}\n`); @@ -30,6 +41,14 @@ for (const demo of demos) { existsSync(join(REPO_ROOT, '.devcontainer', demo.ecosystem, 'devcontainer.json')), 'devcontainer exists', ); + check(demo.edits.length >= 1, 'demo.json declares at least one edit'); + + const sourceFile = demo.open[0]; + const sourcePath = join(REPO_ROOT, demo.dir, sourceFile); + check( + existsSync(sourcePath) && BREAKING_MARKER.test(readFileSync(sourcePath, 'utf8')), + `${sourceFile} has at least one BREAKING marker`, + ); const prepared = spawnSync('node', ['scripts/prepare-demo.mjs', demo.ecosystem], { cwd: REPO_ROOT, @@ -55,7 +74,7 @@ for (const demo of demos) { check(afterReset === '', 'reset restores the baseline'); } -for (const script of ['sync-devcontainers.mjs', 'make-demo-docs.mjs']) { +for (const script of ['sync-devcontainers.mjs', 'make-demo-docs.mjs', 'make-readme.mjs']) { const r = spawnSync('node', [`scripts/${script}`, '--check'], { cwd: REPO_ROOT, encoding: 'utf8' }); process.stdout.write(r.stdout ?? ''); check(r.status === 0, `${script} output is up to date`); From 40725992907efd85feb63ee34be964e28a5d0642 Mon Sep 17 00:00:00 2001 From: Rodolphe Date: Wed, 9 Sep 2026 17:10:04 -0400 Subject: [PATCH 8/8] feat(demo): start both halves of Drift without a click MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A Codespace opened from the landing page has to show Drift working, not a repository with a README about it. Three things were missing. The CLI was absent entirely: nothing installed `@usedrift/cli`, so `drift` was not on the PATH in any demo. Each container now installs it at creation, which is free — every image already has Node for the prepare script. The panel needed a click. The extension showed a startup notification and opened only if the visitor found and pressed it. `drift.ui.openOnStartup` reveals it as the window opens, before the analysis runs, so the visitor watches the work rather than arriving at a finished verdict. The CLI needed a terminal. `postAttachCommand` runs `drift analyze` on the one demo directory, in a real terminal in the editor, on attach and on resume. DEMO.md no longer tells the visitor to open the Activity Bar, since both halves are already running, and says how to re-run the CLI themselves. Co-Authored-By: Claude Opus 5 --- .devcontainer/arduino/devcontainer.json | 4 ++- .devcontainer/cargo/devcontainer.json | 4 ++- .devcontainer/cocoapods/devcontainer.json | 4 ++- .devcontainer/conan/devcontainer.json | 4 ++- .devcontainer/go/devcontainer.json | 4 ++- .devcontainer/hex/devcontainer.json | 4 ++- .devcontainer/maven/devcontainer.json | 4 ++- .devcontainer/npm/devcontainer.json | 4 ++- .devcontainer/nuget/devcontainer.json | 4 ++- .devcontainer/opam/devcontainer.json | 4 ++- .devcontainer/packagist/devcontainer.json | 4 ++- .devcontainer/pub/devcontainer.json | 4 ++- .devcontainer/pypi/devcontainer.json | 4 ++- .devcontainer/rubygems/devcontainer.json | 4 ++- .devcontainer/swift/devcontainer.json | 4 ++- .devcontainer/vcpkg/devcontainer.json | 4 ++- README.md | 12 ++++++-- demos/arduino/DEMO.md | 23 ++++++++++++-- demos/cargo/DEMO.md | 23 ++++++++++++-- demos/cocoapods/DEMO.md | 23 ++++++++++++-- demos/conan/DEMO.md | 23 ++++++++++++-- demos/go/DEMO.md | 23 ++++++++++++-- demos/hex/DEMO.md | 23 ++++++++++++-- demos/maven/DEMO.md | 23 ++++++++++++-- demos/npm/DEMO.md | 23 ++++++++++++-- demos/nuget/DEMO.md | 23 ++++++++++++-- demos/opam/DEMO.md | 23 ++++++++++++-- demos/packagist/DEMO.md | 23 ++++++++++++-- demos/pub/DEMO.md | 23 ++++++++++++-- demos/pypi/DEMO.md | 23 ++++++++++++-- demos/rubygems/DEMO.md | 23 ++++++++++++-- demos/swift/DEMO.md | 23 ++++++++++++-- demos/vcpkg/DEMO.md | 23 ++++++++++++-- docs/browser-demo.md | 37 ++++++++++++++++++++--- scripts/lib/devcontainer-spec.mjs | 15 ++++++++- scripts/make-demo-docs.mjs | 23 ++++++++++++-- 36 files changed, 444 insertions(+), 75 deletions(-) diff --git a/.devcontainer/arduino/devcontainer.json b/.devcontainer/arduino/devcontainer.json index c836f58..9870bbc 100644 --- a/.devcontainer/arduino/devcontainer.json +++ b/.devcontainer/arduino/devcontainer.json @@ -10,8 +10,9 @@ "version": "lts" } }, - "onCreateCommand": "pipx install platformio && node scripts/prepare-demo.mjs arduino", + "onCreateCommand": "pipx install platformio && node scripts/prepare-demo.mjs arduino && npm install -g @usedrift/cli", "waitFor": "onCreateCommand", + "postAttachCommand": "drift analyze --dir demos/arduino", "customizations": { "vscode": { "extensions": [ @@ -20,6 +21,7 @@ "settings": { "drift.session.mode": "ask", "drift.analysis.runOnStartup": true, + "drift.ui.openOnStartup": true, "files.exclude": { "demos/npm": true, "demos/pypi": true, diff --git a/.devcontainer/cargo/devcontainer.json b/.devcontainer/cargo/devcontainer.json index 9747933..348e0a2 100644 --- a/.devcontainer/cargo/devcontainer.json +++ b/.devcontainer/cargo/devcontainer.json @@ -10,8 +10,9 @@ "version": "lts" } }, - "onCreateCommand": ".devcontainer/cargo/setup.sh", + "onCreateCommand": ".devcontainer/cargo/setup.sh && npm install -g @usedrift/cli", "waitFor": "onCreateCommand", + "postAttachCommand": "drift analyze --dir demos/cargo", "customizations": { "vscode": { "extensions": [ @@ -20,6 +21,7 @@ "settings": { "drift.session.mode": "ask", "drift.analysis.runOnStartup": true, + "drift.ui.openOnStartup": true, "files.exclude": { "demos/npm": true, "demos/pypi": true, diff --git a/.devcontainer/cocoapods/devcontainer.json b/.devcontainer/cocoapods/devcontainer.json index f543fdb..e70479c 100644 --- a/.devcontainer/cocoapods/devcontainer.json +++ b/.devcontainer/cocoapods/devcontainer.json @@ -10,8 +10,9 @@ "version": "lts" } }, - "onCreateCommand": "gem install cocoapods --no-document && node scripts/prepare-demo.mjs cocoapods", + "onCreateCommand": "gem install cocoapods --no-document && node scripts/prepare-demo.mjs cocoapods && npm install -g @usedrift/cli", "waitFor": "onCreateCommand", + "postAttachCommand": "drift analyze --dir demos/cocoapods", "customizations": { "vscode": { "extensions": [ @@ -20,6 +21,7 @@ "settings": { "drift.session.mode": "ask", "drift.analysis.runOnStartup": true, + "drift.ui.openOnStartup": true, "files.exclude": { "demos/npm": true, "demos/pypi": true, diff --git a/.devcontainer/conan/devcontainer.json b/.devcontainer/conan/devcontainer.json index 62c6c16..6b99934 100644 --- a/.devcontainer/conan/devcontainer.json +++ b/.devcontainer/conan/devcontainer.json @@ -10,8 +10,9 @@ "version": "lts" } }, - "onCreateCommand": "pipx install conan && node scripts/prepare-demo.mjs conan", + "onCreateCommand": "pipx install conan && node scripts/prepare-demo.mjs conan && npm install -g @usedrift/cli", "waitFor": "onCreateCommand", + "postAttachCommand": "drift analyze --dir demos/conan", "customizations": { "vscode": { "extensions": [ @@ -20,6 +21,7 @@ "settings": { "drift.session.mode": "ask", "drift.analysis.runOnStartup": true, + "drift.ui.openOnStartup": true, "files.exclude": { "demos/npm": true, "demos/pypi": true, diff --git a/.devcontainer/go/devcontainer.json b/.devcontainer/go/devcontainer.json index dddd174..2f18e0a 100644 --- a/.devcontainer/go/devcontainer.json +++ b/.devcontainer/go/devcontainer.json @@ -10,8 +10,9 @@ "version": "lts" } }, - "onCreateCommand": "node scripts/prepare-demo.mjs go", + "onCreateCommand": "node scripts/prepare-demo.mjs go && npm install -g @usedrift/cli", "waitFor": "onCreateCommand", + "postAttachCommand": "drift analyze --dir demos/go", "customizations": { "vscode": { "extensions": [ @@ -20,6 +21,7 @@ "settings": { "drift.session.mode": "ask", "drift.analysis.runOnStartup": true, + "drift.ui.openOnStartup": true, "drift.analysis.includePatch": true, "files.exclude": { "demos/npm": true, diff --git a/.devcontainer/hex/devcontainer.json b/.devcontainer/hex/devcontainer.json index 58ad7d5..819469c 100644 --- a/.devcontainer/hex/devcontainer.json +++ b/.devcontainer/hex/devcontainer.json @@ -11,8 +11,9 @@ }, "ghcr.io/devcontainers/features/git:1": {} }, - "onCreateCommand": "node scripts/prepare-demo.mjs hex", + "onCreateCommand": "node scripts/prepare-demo.mjs hex && npm install -g @usedrift/cli", "waitFor": "onCreateCommand", + "postAttachCommand": "drift analyze --dir demos/hex", "customizations": { "vscode": { "extensions": [ @@ -21,6 +22,7 @@ "settings": { "drift.session.mode": "ask", "drift.analysis.runOnStartup": true, + "drift.ui.openOnStartup": true, "files.exclude": { "demos/npm": true, "demos/pypi": true, diff --git a/.devcontainer/maven/devcontainer.json b/.devcontainer/maven/devcontainer.json index 63c1263..0d61c7e 100644 --- a/.devcontainer/maven/devcontainer.json +++ b/.devcontainer/maven/devcontainer.json @@ -14,8 +14,9 @@ "installMaven": true } }, - "onCreateCommand": "node scripts/prepare-demo.mjs maven", + "onCreateCommand": "node scripts/prepare-demo.mjs maven && npm install -g @usedrift/cli", "waitFor": "onCreateCommand", + "postAttachCommand": "drift analyze --dir demos/maven", "customizations": { "vscode": { "extensions": [ @@ -24,6 +25,7 @@ "settings": { "drift.session.mode": "ask", "drift.analysis.runOnStartup": true, + "drift.ui.openOnStartup": true, "files.exclude": { "demos/npm": true, "demos/pypi": true, diff --git a/.devcontainer/npm/devcontainer.json b/.devcontainer/npm/devcontainer.json index a8def40..c7ffefc 100644 --- a/.devcontainer/npm/devcontainer.json +++ b/.devcontainer/npm/devcontainer.json @@ -5,8 +5,9 @@ { "name": "Drift demo — JavaScript / TypeScript", "image": "mcr.microsoft.com/devcontainers/javascript-node:1-22-bookworm", - "onCreateCommand": "node scripts/prepare-demo.mjs npm && npm --prefix demos/npm install --no-audit --no-fund", + "onCreateCommand": "node scripts/prepare-demo.mjs npm && npm --prefix demos/npm install --no-audit --no-fund && npm install -g @usedrift/cli", "waitFor": "onCreateCommand", + "postAttachCommand": "drift analyze --dir demos/npm", "customizations": { "vscode": { "extensions": [ @@ -15,6 +16,7 @@ "settings": { "drift.session.mode": "ask", "drift.analysis.runOnStartup": true, + "drift.ui.openOnStartup": true, "files.exclude": { "demos/pypi": true, "demos/go": true, diff --git a/.devcontainer/nuget/devcontainer.json b/.devcontainer/nuget/devcontainer.json index 221f7bc..8e33b85 100644 --- a/.devcontainer/nuget/devcontainer.json +++ b/.devcontainer/nuget/devcontainer.json @@ -10,8 +10,9 @@ "version": "lts" } }, - "onCreateCommand": "node scripts/prepare-demo.mjs nuget", + "onCreateCommand": "node scripts/prepare-demo.mjs nuget && npm install -g @usedrift/cli", "waitFor": "onCreateCommand", + "postAttachCommand": "drift analyze --dir demos/nuget", "customizations": { "vscode": { "extensions": [ @@ -20,6 +21,7 @@ "settings": { "drift.session.mode": "ask", "drift.analysis.runOnStartup": true, + "drift.ui.openOnStartup": true, "files.exclude": { "demos/npm": true, "demos/pypi": true, diff --git a/.devcontainer/opam/devcontainer.json b/.devcontainer/opam/devcontainer.json index 473b47a..22a74b3 100644 --- a/.devcontainer/opam/devcontainer.json +++ b/.devcontainer/opam/devcontainer.json @@ -10,8 +10,9 @@ "version": "lts" } }, - "onCreateCommand": "node scripts/prepare-demo.mjs opam", + "onCreateCommand": "node scripts/prepare-demo.mjs opam && npm install -g @usedrift/cli", "waitFor": "onCreateCommand", + "postAttachCommand": "drift analyze --dir demos/opam", "customizations": { "vscode": { "extensions": [ @@ -20,6 +21,7 @@ "settings": { "drift.session.mode": "ask", "drift.analysis.runOnStartup": true, + "drift.ui.openOnStartup": true, "files.exclude": { "demos/npm": true, "demos/pypi": true, diff --git a/.devcontainer/packagist/devcontainer.json b/.devcontainer/packagist/devcontainer.json index a73f919..1da7af9 100644 --- a/.devcontainer/packagist/devcontainer.json +++ b/.devcontainer/packagist/devcontainer.json @@ -10,8 +10,9 @@ "version": "lts" } }, - "onCreateCommand": "node scripts/prepare-demo.mjs packagist", + "onCreateCommand": "node scripts/prepare-demo.mjs packagist && npm install -g @usedrift/cli", "waitFor": "onCreateCommand", + "postAttachCommand": "drift analyze --dir demos/packagist", "customizations": { "vscode": { "extensions": [ @@ -20,6 +21,7 @@ "settings": { "drift.session.mode": "ask", "drift.analysis.runOnStartup": true, + "drift.ui.openOnStartup": true, "files.exclude": { "demos/npm": true, "demos/pypi": true, diff --git a/.devcontainer/pub/devcontainer.json b/.devcontainer/pub/devcontainer.json index 2ad0a79..d0a863b 100644 --- a/.devcontainer/pub/devcontainer.json +++ b/.devcontainer/pub/devcontainer.json @@ -11,8 +11,9 @@ }, "ghcr.io/devcontainers/features/git:1": {} }, - "onCreateCommand": "node scripts/prepare-demo.mjs pub", + "onCreateCommand": "node scripts/prepare-demo.mjs pub && npm install -g @usedrift/cli", "waitFor": "onCreateCommand", + "postAttachCommand": "drift analyze --dir demos/pub", "customizations": { "vscode": { "extensions": [ @@ -21,6 +22,7 @@ "settings": { "drift.session.mode": "ask", "drift.analysis.runOnStartup": true, + "drift.ui.openOnStartup": true, "files.exclude": { "demos/npm": true, "demos/pypi": true, diff --git a/.devcontainer/pypi/devcontainer.json b/.devcontainer/pypi/devcontainer.json index 1bd569c..83e7ae5 100644 --- a/.devcontainer/pypi/devcontainer.json +++ b/.devcontainer/pypi/devcontainer.json @@ -10,8 +10,9 @@ "version": "lts" } }, - "onCreateCommand": "node scripts/prepare-demo.mjs pypi", + "onCreateCommand": "node scripts/prepare-demo.mjs pypi && npm install -g @usedrift/cli", "waitFor": "onCreateCommand", + "postAttachCommand": "drift analyze --dir demos/pypi", "customizations": { "vscode": { "extensions": [ @@ -20,6 +21,7 @@ "settings": { "drift.session.mode": "ask", "drift.analysis.runOnStartup": true, + "drift.ui.openOnStartup": true, "files.exclude": { "demos/npm": true, "demos/go": true, diff --git a/.devcontainer/rubygems/devcontainer.json b/.devcontainer/rubygems/devcontainer.json index 9d53912..6f9718f 100644 --- a/.devcontainer/rubygems/devcontainer.json +++ b/.devcontainer/rubygems/devcontainer.json @@ -10,8 +10,9 @@ "version": "lts" } }, - "onCreateCommand": "node scripts/prepare-demo.mjs rubygems", + "onCreateCommand": "node scripts/prepare-demo.mjs rubygems && npm install -g @usedrift/cli", "waitFor": "onCreateCommand", + "postAttachCommand": "drift analyze --dir demos/rubygems", "customizations": { "vscode": { "extensions": [ @@ -20,6 +21,7 @@ "settings": { "drift.session.mode": "ask", "drift.analysis.runOnStartup": true, + "drift.ui.openOnStartup": true, "files.exclude": { "demos/npm": true, "demos/pypi": true, diff --git a/.devcontainer/swift/devcontainer.json b/.devcontainer/swift/devcontainer.json index c320690..ca2d2d9 100644 --- a/.devcontainer/swift/devcontainer.json +++ b/.devcontainer/swift/devcontainer.json @@ -11,8 +11,9 @@ }, "ghcr.io/devcontainers/features/git:1": {} }, - "onCreateCommand": "node scripts/prepare-demo.mjs swift", + "onCreateCommand": "node scripts/prepare-demo.mjs swift && npm install -g @usedrift/cli", "waitFor": "onCreateCommand", + "postAttachCommand": "drift analyze --dir demos/swift", "customizations": { "vscode": { "extensions": [ @@ -21,6 +22,7 @@ "settings": { "drift.session.mode": "ask", "drift.analysis.runOnStartup": true, + "drift.ui.openOnStartup": true, "files.exclude": { "demos/npm": true, "demos/pypi": true, diff --git a/.devcontainer/vcpkg/devcontainer.json b/.devcontainer/vcpkg/devcontainer.json index fc65ccb..0246832 100644 --- a/.devcontainer/vcpkg/devcontainer.json +++ b/.devcontainer/vcpkg/devcontainer.json @@ -10,8 +10,9 @@ "version": "lts" } }, - "onCreateCommand": "node scripts/prepare-demo.mjs vcpkg", + "onCreateCommand": "node scripts/prepare-demo.mjs vcpkg && npm install -g @usedrift/cli", "waitFor": "onCreateCommand", + "postAttachCommand": "drift analyze --dir demos/vcpkg", "customizations": { "vscode": { "extensions": [ @@ -20,6 +21,7 @@ "settings": { "drift.session.mode": "ask", "drift.analysis.runOnStartup": true, + "drift.ui.openOnStartup": true, "files.exclude": { "demos/npm": true, "demos/pypi": true, diff --git a/README.md b/README.md index 6407107..28341d8 100644 --- a/README.md +++ b/README.md @@ -52,9 +52,15 @@ several arguable ones. Launching one requires a GitHub account and uses your own GitHub Codespaces allowance. -> These are prepared fixtures. No demo has been smoke-tested in a real Codespace -> yet, and the `drift.drift` Marketplace install cannot be verified until the -> extension is published. +Each Codespace installs the `drift.drift` extension and the `@usedrift/cli` +command line, applies the upgrade, opens the Drift panel, and runs +`drift analyze` in a terminal — so both halves of Drift are already working when +the editor appears. + +> These are prepared fixtures. They depend on `drift.drift` being published to +> the VS Code Marketplace and `@usedrift/cli` to npm; before that release lands, +> a Codespace comes up with the fixture correct and nothing to analyse it. No +> demo has been smoke-tested through a real Codespace yet. ## Layout diff --git a/demos/arduino/DEMO.md b/demos/arduino/DEMO.md index fe1716d..b5708b9 100644 --- a/demos/arduino/DEMO.md +++ b/demos/arduino/DEMO.md @@ -16,12 +16,29 @@ The 5 breaking changes in this demo: ## Try it -1. Open the Drift icon in the Activity Bar. -2. Look at what Drift found for `bblanchon/ArduinoJson`. -3. Open `src/main.cpp` and compare against the marked lines. +Both halves of Drift started on their own when this Codespace opened: + +- the **panel** on the left, which analysed the change and lists what it found; +- the **terminal**, which ran `drift analyze --dir demos/arduino`. + +From there: + +1. Read what Drift found for `bblanchon/ArduinoJson` in the panel. +2. Open `src/main.cpp` and compare against the marked lines. +3. Click a finding to jump to the code it affects. + +Nothing here is staged output — Drift is analysing an ordinary uncommitted +dependency change, and it has no idea this is a demo: ```sh git status --short # only the manifest is modified; the source is untouched ``` +Run it again yourself, or ask a different question: + +```sh +drift analyze --dir demos/arduino +drift explain bblanchon/ArduinoJson --dir demos/arduino +``` + Reset it with `node scripts/reset-demo.mjs arduino`. diff --git a/demos/cargo/DEMO.md b/demos/cargo/DEMO.md index 0f6be5d..88146d2 100644 --- a/demos/cargo/DEMO.md +++ b/demos/cargo/DEMO.md @@ -16,12 +16,29 @@ The 5 breaking changes in this demo: ## Try it -1. Open the Drift icon in the Activity Bar. -2. Look at what Drift found for `clap`. -3. Open `src/main.rs` and compare against the marked lines. +Both halves of Drift started on their own when this Codespace opened: + +- the **panel** on the left, which analysed the change and lists what it found; +- the **terminal**, which ran `drift analyze --dir demos/cargo`. + +From there: + +1. Read what Drift found for `clap` in the panel. +2. Open `src/main.rs` and compare against the marked lines. +3. Click a finding to jump to the code it affects. + +Nothing here is staged output — Drift is analysing an ordinary uncommitted +dependency change, and it has no idea this is a demo: ```sh git status --short # only the manifest is modified; the source is untouched ``` +Run it again yourself, or ask a different question: + +```sh +drift analyze --dir demos/cargo +drift explain clap --dir demos/cargo +``` + Reset it with `node scripts/reset-demo.mjs cargo`. diff --git a/demos/cocoapods/DEMO.md b/demos/cocoapods/DEMO.md index 404972b..d0d8599 100644 --- a/demos/cocoapods/DEMO.md +++ b/demos/cocoapods/DEMO.md @@ -16,12 +16,29 @@ The 5 breaking changes in this demo: ## Try it -1. Open the Drift icon in the Activity Bar. -2. Look at what Drift found for `Alamofire`. -3. Open `DriftDemo/NetworkService.swift` and compare against the marked lines. +Both halves of Drift started on their own when this Codespace opened: + +- the **panel** on the left, which analysed the change and lists what it found; +- the **terminal**, which ran `drift analyze --dir demos/cocoapods`. + +From there: + +1. Read what Drift found for `Alamofire` in the panel. +2. Open `DriftDemo/NetworkService.swift` and compare against the marked lines. +3. Click a finding to jump to the code it affects. + +Nothing here is staged output — Drift is analysing an ordinary uncommitted +dependency change, and it has no idea this is a demo: ```sh git status --short # only the manifest is modified; the source is untouched ``` +Run it again yourself, or ask a different question: + +```sh +drift analyze --dir demos/cocoapods +drift explain Alamofire --dir demos/cocoapods +``` + Reset it with `node scripts/reset-demo.mjs cocoapods`. diff --git a/demos/conan/DEMO.md b/demos/conan/DEMO.md index 22f07a8..3349149 100644 --- a/demos/conan/DEMO.md +++ b/demos/conan/DEMO.md @@ -12,12 +12,29 @@ The breaking change in this demo: ## Try it -1. Open the Drift icon in the Activity Bar. -2. Look at what Drift found for `fmt`. -3. Open `src/main.cpp` and compare against the marked lines. +Both halves of Drift started on their own when this Codespace opened: + +- the **panel** on the left, which analysed the change and lists what it found; +- the **terminal**, which ran `drift analyze --dir demos/conan`. + +From there: + +1. Read what Drift found for `fmt` in the panel. +2. Open `src/main.cpp` and compare against the marked lines. +3. Click a finding to jump to the code it affects. + +Nothing here is staged output — Drift is analysing an ordinary uncommitted +dependency change, and it has no idea this is a demo: ```sh git status --short # only the manifest is modified; the source is untouched ``` +Run it again yourself, or ask a different question: + +```sh +drift analyze --dir demos/conan +drift explain fmt --dir demos/conan +``` + Reset it with `node scripts/reset-demo.mjs conan`. diff --git a/demos/go/DEMO.md b/demos/go/DEMO.md index c8770cc..35fae3f 100644 --- a/demos/go/DEMO.md +++ b/demos/go/DEMO.md @@ -15,12 +15,29 @@ The 4 breaking changes in this demo: ## Try it -1. Open the Drift icon in the Activity Bar. -2. Look at what Drift found for `golang.org/x/exp`. -3. Open `main.go` and compare against the marked lines. +Both halves of Drift started on their own when this Codespace opened: + +- the **panel** on the left, which analysed the change and lists what it found; +- the **terminal**, which ran `drift analyze --dir demos/go`. + +From there: + +1. Read what Drift found for `golang.org/x/exp` in the panel. +2. Open `main.go` and compare against the marked lines. +3. Click a finding to jump to the code it affects. + +Nothing here is staged output — Drift is analysing an ordinary uncommitted +dependency change, and it has no idea this is a demo: ```sh git status --short # only the manifest is modified; the source is untouched ``` +Run it again yourself, or ask a different question: + +```sh +drift analyze --dir demos/go +drift explain golang.org/x/exp --dir demos/go +``` + Reset it with `node scripts/reset-demo.mjs go`. diff --git a/demos/hex/DEMO.md b/demos/hex/DEMO.md index de8bf5e..075cc3d 100644 --- a/demos/hex/DEMO.md +++ b/demos/hex/DEMO.md @@ -12,12 +12,29 @@ The breaking change in this demo: ## Try it -1. Open the Drift icon in the Activity Bar. -2. Look at what Drift found for `plug`. -3. Open `lib/server.ex` and compare against the marked lines. +Both halves of Drift started on their own when this Codespace opened: + +- the **panel** on the left, which analysed the change and lists what it found; +- the **terminal**, which ran `drift analyze --dir demos/hex`. + +From there: + +1. Read what Drift found for `plug` in the panel. +2. Open `lib/server.ex` and compare against the marked lines. +3. Click a finding to jump to the code it affects. + +Nothing here is staged output — Drift is analysing an ordinary uncommitted +dependency change, and it has no idea this is a demo: ```sh git status --short # only the manifest is modified; the source is untouched ``` +Run it again yourself, or ask a different question: + +```sh +drift analyze --dir demos/hex +drift explain plug --dir demos/hex +``` + Reset it with `node scripts/reset-demo.mjs hex`. diff --git a/demos/maven/DEMO.md b/demos/maven/DEMO.md index 38bf084..ec011f2 100644 --- a/demos/maven/DEMO.md +++ b/demos/maven/DEMO.md @@ -15,12 +15,29 @@ The 4 breaking changes in this demo: ## Try it -1. Open the Drift icon in the Activity Bar. -2. Look at what Drift found for `com.google.guava:guava`. -3. Open `src/main/java/com/example/demo/Config.java` and compare against the marked lines. +Both halves of Drift started on their own when this Codespace opened: + +- the **panel** on the left, which analysed the change and lists what it found; +- the **terminal**, which ran `drift analyze --dir demos/maven`. + +From there: + +1. Read what Drift found for `com.google.guava:guava` in the panel. +2. Open `src/main/java/com/example/demo/Config.java` and compare against the marked lines. +3. Click a finding to jump to the code it affects. + +Nothing here is staged output — Drift is analysing an ordinary uncommitted +dependency change, and it has no idea this is a demo: ```sh git status --short # only the manifest is modified; the source is untouched ``` +Run it again yourself, or ask a different question: + +```sh +drift analyze --dir demos/maven +drift explain com.google.guava:guava --dir demos/maven +``` + Reset it with `node scripts/reset-demo.mjs maven`. diff --git a/demos/npm/DEMO.md b/demos/npm/DEMO.md index 9547671..79c33a1 100644 --- a/demos/npm/DEMO.md +++ b/demos/npm/DEMO.md @@ -14,12 +14,29 @@ The 3 breaking changes in this demo: ## Try it -1. Open the Drift icon in the Activity Bar. -2. Look at what Drift found for `axios`. -3. Open `src/api-client.ts` and compare against the marked lines. +Both halves of Drift started on their own when this Codespace opened: + +- the **panel** on the left, which analysed the change and lists what it found; +- the **terminal**, which ran `drift analyze --dir demos/npm`. + +From there: + +1. Read what Drift found for `axios` in the panel. +2. Open `src/api-client.ts` and compare against the marked lines. +3. Click a finding to jump to the code it affects. + +Nothing here is staged output — Drift is analysing an ordinary uncommitted +dependency change, and it has no idea this is a demo: ```sh git status --short # only the manifest is modified; the source is untouched ``` +Run it again yourself, or ask a different question: + +```sh +drift analyze --dir demos/npm +drift explain axios --dir demos/npm +``` + Reset it with `node scripts/reset-demo.mjs npm`. diff --git a/demos/nuget/DEMO.md b/demos/nuget/DEMO.md index 4758bf5..092d2fc 100644 --- a/demos/nuget/DEMO.md +++ b/demos/nuget/DEMO.md @@ -16,12 +16,29 @@ The 5 breaking changes in this demo: ## Try it -1. Open the Drift icon in the Activity Bar. -2. Look at what Drift found for `AutoMapper`. -3. Open `Mapping.cs` and compare against the marked lines. +Both halves of Drift started on their own when this Codespace opened: + +- the **panel** on the left, which analysed the change and lists what it found; +- the **terminal**, which ran `drift analyze --dir demos/nuget`. + +From there: + +1. Read what Drift found for `AutoMapper` in the panel. +2. Open `Mapping.cs` and compare against the marked lines. +3. Click a finding to jump to the code it affects. + +Nothing here is staged output — Drift is analysing an ordinary uncommitted +dependency change, and it has no idea this is a demo: ```sh git status --short # only the manifest is modified; the source is untouched ``` +Run it again yourself, or ask a different question: + +```sh +drift analyze --dir demos/nuget +drift explain AutoMapper --dir demos/nuget +``` + Reset it with `node scripts/reset-demo.mjs nuget`. diff --git a/demos/opam/DEMO.md b/demos/opam/DEMO.md index b2ee598..b4a9a37 100644 --- a/demos/opam/DEMO.md +++ b/demos/opam/DEMO.md @@ -12,12 +12,29 @@ The breaking change in this demo: ## Try it -1. Open the Drift icon in the Activity Bar. -2. Look at what Drift found for `lwt`. -3. Open `lib/scheduler.ml` and compare against the marked lines. +Both halves of Drift started on their own when this Codespace opened: + +- the **panel** on the left, which analysed the change and lists what it found; +- the **terminal**, which ran `drift analyze --dir demos/opam`. + +From there: + +1. Read what Drift found for `lwt` in the panel. +2. Open `lib/scheduler.ml` and compare against the marked lines. +3. Click a finding to jump to the code it affects. + +Nothing here is staged output — Drift is analysing an ordinary uncommitted +dependency change, and it has no idea this is a demo: ```sh git status --short # only the manifest is modified; the source is untouched ``` +Run it again yourself, or ask a different question: + +```sh +drift analyze --dir demos/opam +drift explain lwt --dir demos/opam +``` + Reset it with `node scripts/reset-demo.mjs opam`. diff --git a/demos/packagist/DEMO.md b/demos/packagist/DEMO.md index 2025913..06f4025 100644 --- a/demos/packagist/DEMO.md +++ b/demos/packagist/DEMO.md @@ -13,12 +13,29 @@ The 2 breaking changes in this demo: ## Try it -1. Open the Drift icon in the Activity Bar. -2. Look at what Drift found for `monolog/monolog`. -3. Open `src/Logging.php` and compare against the marked lines. +Both halves of Drift started on their own when this Codespace opened: + +- the **panel** on the left, which analysed the change and lists what it found; +- the **terminal**, which ran `drift analyze --dir demos/packagist`. + +From there: + +1. Read what Drift found for `monolog/monolog` in the panel. +2. Open `src/Logging.php` and compare against the marked lines. +3. Click a finding to jump to the code it affects. + +Nothing here is staged output — Drift is analysing an ordinary uncommitted +dependency change, and it has no idea this is a demo: ```sh git status --short # only the manifest is modified; the source is untouched ``` +Run it again yourself, or ask a different question: + +```sh +drift analyze --dir demos/packagist +drift explain monolog/monolog --dir demos/packagist +``` + Reset it with `node scripts/reset-demo.mjs packagist`. diff --git a/demos/pub/DEMO.md b/demos/pub/DEMO.md index b0f030a..1a5f34b 100644 --- a/demos/pub/DEMO.md +++ b/demos/pub/DEMO.md @@ -13,12 +13,29 @@ The 2 breaking changes in this demo: ## Try it -1. Open the Drift icon in the Activity Bar. -2. Look at what Drift found for `dio`. -3. Open `lib/api_client.dart` and compare against the marked lines. +Both halves of Drift started on their own when this Codespace opened: + +- the **panel** on the left, which analysed the change and lists what it found; +- the **terminal**, which ran `drift analyze --dir demos/pub`. + +From there: + +1. Read what Drift found for `dio` in the panel. +2. Open `lib/api_client.dart` and compare against the marked lines. +3. Click a finding to jump to the code it affects. + +Nothing here is staged output — Drift is analysing an ordinary uncommitted +dependency change, and it has no idea this is a demo: ```sh git status --short # only the manifest is modified; the source is untouched ``` +Run it again yourself, or ask a different question: + +```sh +drift analyze --dir demos/pub +drift explain dio --dir demos/pub +``` + Reset it with `node scripts/reset-demo.mjs pub`. diff --git a/demos/pypi/DEMO.md b/demos/pypi/DEMO.md index 45c46a0..da48fd3 100644 --- a/demos/pypi/DEMO.md +++ b/demos/pypi/DEMO.md @@ -15,12 +15,29 @@ The 4 breaking changes in this demo: ## Try it -1. Open the Drift icon in the Activity Bar. -2. Look at what Drift found for `werkzeug`. -3. Open `src/auth.py` and compare against the marked lines. +Both halves of Drift started on their own when this Codespace opened: + +- the **panel** on the left, which analysed the change and lists what it found; +- the **terminal**, which ran `drift analyze --dir demos/pypi`. + +From there: + +1. Read what Drift found for `werkzeug` in the panel. +2. Open `src/auth.py` and compare against the marked lines. +3. Click a finding to jump to the code it affects. + +Nothing here is staged output — Drift is analysing an ordinary uncommitted +dependency change, and it has no idea this is a demo: ```sh git status --short # only the manifest is modified; the source is untouched ``` +Run it again yourself, or ask a different question: + +```sh +drift analyze --dir demos/pypi +drift explain werkzeug --dir demos/pypi +``` + Reset it with `node scripts/reset-demo.mjs pypi`. diff --git a/demos/rubygems/DEMO.md b/demos/rubygems/DEMO.md index 78cf25e..2f73042 100644 --- a/demos/rubygems/DEMO.md +++ b/demos/rubygems/DEMO.md @@ -14,12 +14,29 @@ The 3 breaking changes in this demo: ## Try it -1. Open the Drift icon in the Activity Bar. -2. Look at what Drift found for `rack`. -3. Open `lib/app.rb` and compare against the marked lines. +Both halves of Drift started on their own when this Codespace opened: + +- the **panel** on the left, which analysed the change and lists what it found; +- the **terminal**, which ran `drift analyze --dir demos/rubygems`. + +From there: + +1. Read what Drift found for `rack` in the panel. +2. Open `lib/app.rb` and compare against the marked lines. +3. Click a finding to jump to the code it affects. + +Nothing here is staged output — Drift is analysing an ordinary uncommitted +dependency change, and it has no idea this is a demo: ```sh git status --short # only the manifest is modified; the source is untouched ``` +Run it again yourself, or ask a different question: + +```sh +drift analyze --dir demos/rubygems +drift explain rack --dir demos/rubygems +``` + Reset it with `node scripts/reset-demo.mjs rubygems`. diff --git a/demos/swift/DEMO.md b/demos/swift/DEMO.md index 5754152..47ff34c 100644 --- a/demos/swift/DEMO.md +++ b/demos/swift/DEMO.md @@ -15,12 +15,29 @@ The 4 breaking changes in this demo: ## Try it -1. Open the Drift icon in the Activity Bar. -2. Look at what Drift found for `https://github.com/Alamofire/Alamofire`. -3. Open `Sources/DriftDemo/ApiClient.swift` and compare against the marked lines. +Both halves of Drift started on their own when this Codespace opened: + +- the **panel** on the left, which analysed the change and lists what it found; +- the **terminal**, which ran `drift analyze --dir demos/swift`. + +From there: + +1. Read what Drift found for `https://github.com/Alamofire/Alamofire` in the panel. +2. Open `Sources/DriftDemo/ApiClient.swift` and compare against the marked lines. +3. Click a finding to jump to the code it affects. + +Nothing here is staged output — Drift is analysing an ordinary uncommitted +dependency change, and it has no idea this is a demo: ```sh git status --short # only the manifest is modified; the source is untouched ``` +Run it again yourself, or ask a different question: + +```sh +drift analyze --dir demos/swift +drift explain https://github.com/Alamofire/Alamofire --dir demos/swift +``` + Reset it with `node scripts/reset-demo.mjs swift`. diff --git a/demos/vcpkg/DEMO.md b/demos/vcpkg/DEMO.md index b9b5576..e59259a 100644 --- a/demos/vcpkg/DEMO.md +++ b/demos/vcpkg/DEMO.md @@ -13,12 +13,29 @@ The 2 breaking changes in this demo: ## Try it -1. Open the Drift icon in the Activity Bar. -2. Look at what Drift found for `catch2`. -3. Open `src/tests.cpp` and compare against the marked lines. +Both halves of Drift started on their own when this Codespace opened: + +- the **panel** on the left, which analysed the change and lists what it found; +- the **terminal**, which ran `drift analyze --dir demos/vcpkg`. + +From there: + +1. Read what Drift found for `catch2` in the panel. +2. Open `src/tests.cpp` and compare against the marked lines. +3. Click a finding to jump to the code it affects. + +Nothing here is staged output — Drift is analysing an ordinary uncommitted +dependency change, and it has no idea this is a demo: ```sh git status --short # only the manifest is modified; the source is untouched ``` +Run it again yourself, or ask a different question: + +```sh +drift analyze --dir demos/vcpkg +drift explain catch2 --dir demos/vcpkg +``` + Reset it with `node scripts/reset-demo.mjs vcpkg`. diff --git a/docs/browser-demo.md b/docs/browser-demo.md index f4840e7..6e67f8b 100644 --- a/docs/browser-demo.md +++ b/docs/browser-demo.md @@ -29,6 +29,12 @@ the panel isn't blank for minutes on first analysis; see node scripts/prepare-demo.mjs ``` +Each `onCreateCommand` ends by installing the CLI globally +(`npm install -g @usedrift/cli`), because the demo is both halves of Drift and a +visitor who has to install something first has not had the demo. Every container +has Node already — the shared prepare script is Node — so this costs one npm +install and no extra image. + `onCreateCommand` is used deliberately: - it runs **after** the repository is checked out; @@ -41,6 +47,21 @@ node scripts/prepare-demo.mjs Resume-time behaviour is intentionally left as the devcontainer default: nothing runs. +## Starting both halves without a click + +Two things have to be running before the visitor does anything, or the demo is a +repository with a README about a tool they cannot see: + +- **the panel** — `drift.ui.openOnStartup: true` reveals the Drift view as the + window opens. The extension reveals it *before* the startup analysis rather + than after, so the visitor watches the analysis happen instead of arriving at + a finished verdict with no idea what produced it. The setting is off by + default in the extension; prepared environments are what it exists for. +- **the CLI** — `postAttachCommand` runs `drift analyze --dir demos/` + and its output lands in a real terminal in the editor. `postAttach` rather + than `postCreate` because it runs on resume too, and scoped with `--dir` so it + analyses the one demo rather than all sixteen. + ## Workspace focus The Git root stays at the repository root, because that is what Drift's @@ -55,6 +76,7 @@ and the manifest. - `drift.session.mode: "ask"` — Drift analyses and explains; it never edits. No agent, API key, or GitHub auth is involved. - `drift.analysis.runOnStartup: true` — the default, set explicitly. +- `drift.ui.openOnStartup: true` — open the panel without a click. See above. - `drift.analysis.includePatch: true` — **go only**. `golang.org/x/exp` ships only pseudo-versions, which Drift classifies as patch moves. @@ -69,10 +91,17 @@ https://codespaces.new/trydrift/demo?quickstart=1&devcontainer_path=.devcontaine The README's demo table carries the full set, generated by `node scripts/make-readme.mjs` so it can't drift from the devcontainers that -actually exist. They have not been exercised end to end yet — that waits on the -extension being published to the Marketplace, at which point a manual smoke -test through the real Codespaces create flow should confirm the link shape -still matches. +actually exist. + +The links depend on two published artifacts: `drift.drift` on the VS Code +Marketplace and `@usedrift/cli` on npm. Until a release has published both, a +Codespace will come up with no extension and no `drift` on the PATH — the +fixture will be correct and nothing will analyse it. Neither has been exercised +through the real Codespaces create flow yet; the first launch after publishing +is a genuine smoke test, and the things most likely to be wrong are the global +npm install on the images that get Node from a feature rather than the base +image (opam, pub, swift, hex) and whether `postAttachCommand` output lands where +these notes claim it does. ## Cost diff --git a/scripts/lib/devcontainer-spec.mjs b/scripts/lib/devcontainer-spec.mjs index 1582ecb..ec253ea 100644 --- a/scripts/lib/devcontainer-spec.mjs +++ b/scripts/lib/devcontainer-spec.mjs @@ -79,6 +79,9 @@ export const ECOSYSTEM_CONTAINERS = { const NODE_FEATURE = { 'ghcr.io/devcontainers/features/node:1': { version: 'lts' } }; +/** The published CLI. Every container installs it globally at creation. */ +const CLI_PACKAGE = '@usedrift/cli'; + /** Build the devcontainer object for one demo. */ export function buildDevcontainer(demo, allDemos) { const spec = ECOSYSTEM_CONTAINERS[demo.ecosystem]; @@ -99,8 +102,15 @@ export function buildDevcontainer(demo, allDemos) { // the dependency change is already in place when Drift's startup analysis // runs. It does not run on resume, so reopening a Codespace never // overwrites what you were experimenting with. - onCreateCommand: spec.setup ?? `node scripts/prepare-demo.mjs ${demo.ecosystem}`, + // Two things, in this order: apply the upgrade, then install the CLI. The + // demo is both halves of Drift — the panel and the command line — so the + // visitor has to be able to type `drift` without installing anything. + onCreateCommand: `${spec.setup ?? `node scripts/prepare-demo.mjs ${demo.ecosystem}`} && npm install -g ${CLI_PACKAGE}`, waitFor: 'onCreateCommand', + // Runs on every attach, including resume, and its output lands in a real + // terminal in the editor. This is the CLI half of the demo showing itself + // without being asked, on the one demo directory rather than all sixteen. + postAttachCommand: `drift analyze --dir ${demo.dir}`, customizations: { vscode: { extensions: ['drift.drift'], @@ -109,6 +119,9 @@ export function buildDevcontainer(demo, allDemos) { // key or GitHub auth involved. 'drift.session.mode': 'ask', 'drift.analysis.runOnStartup': true, + // A visitor who opened this to see what Drift does should not have to + // find the Activity Bar icon first. + 'drift.ui.openOnStartup': true, ...(spec.settings ?? {}), 'files.exclude': filesExclude, }, diff --git a/scripts/make-demo-docs.mjs b/scripts/make-demo-docs.mjs index c05ce2f..1087fa1 100644 --- a/scripts/make-demo-docs.mjs +++ b/scripts/make-demo-docs.mjs @@ -62,14 +62,31 @@ ${breaks.map((b, i) => `${i + 1}. ${b}`).join('\n')} ## Try it -1. Open the Drift icon in the Activity Bar. -2. Look at what Drift found for \`${demo.dependency}\`. -3. Open \`${sourceFile}\` and compare against the marked lines. +Both halves of Drift started on their own when this Codespace opened: + +- the **panel** on the left, which analysed the change and lists what it found; +- the **terminal**, which ran \`drift analyze --dir ${demo.dir}\`. + +From there: + +1. Read what Drift found for \`${demo.dependency}\` in the panel. +2. Open \`${sourceFile}\` and compare against the marked lines. +3. Click a finding to jump to the code it affects. + +Nothing here is staged output — Drift is analysing an ordinary uncommitted +dependency change, and it has no idea this is a demo: \`\`\`sh git status --short # only the manifest is modified; the source is untouched \`\`\` +Run it again yourself, or ask a different question: + +\`\`\`sh +drift analyze --dir ${demo.dir} +drift explain ${demo.dependency} --dir ${demo.dir} +\`\`\` + Reset it with \`node scripts/reset-demo.mjs ${demo.ecosystem}\`. `;