From 7240e5e834865d9a8ca047ad9e1725d284fe60bb Mon Sep 17 00:00:00 2001 From: Rodolphe Date: Wed, 9 Sep 2026 17:10:04 -0400 Subject: [PATCH] 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}\`. `;