Spectre 0.4.0
Atomic capture, smarter JUnit defaults, hardened agent and recording packaging, and a large additive surface since 0.3.0.
Spectre is pre-1.0: stable APIs follow the project compatibility policy; experimental surfaces (agent attach, HTTP transport, inject, Hot Reload awareness) may still change.
Highlights
Atomic capture (schema v1)
Capture a window’s pixels and semantics tree in one shot as a versioned on-disk document.
- In-process:
ComposeAutomator.capture→ PNG +capture.json(schemaVersion1) - CLI / MCP session capture with directory lifecycle (sequencing, ledger, prune, detach leftovers)
- Same layout under
build/reports/spectre/for JUnit failure artifacts - Agent skill:
spectre-capture(schema v1 recipes)
Docs: Atomic capture
runSpectreTest
Preferred coroutine runner for Spectre UI tests: structured concurrency and leak detection with real wall-clock delays (so longClick, swipe, waits, and paste settle behave correctly). Prefer this over runBlocking; do not use virtual-time runTest for Spectre interactions.
Docs: Getting started, JUnit
Failure artifacts by default
On JUnit 4 / 5 failure, Spectre writes multi-window capture.json + PNG under:
build/reports/spectre/<class>/<method>/…
Default on. Opt out with FailureArtifactsConfig(enabled = false). CI upload snippets live in the CI guide.
Docs: JUnit · failure artifacts, CI
macOS Spectre Capture Helper
Screen capture ships as a signed, notarized SpectreCaptureHelper.app for stable TCC attribution.
- Fail-fast when Screen Recording is missing (no silent OS prompt from the library path)
spectre permissions check/spectre permissions request— guided grant (explain → Settings → drag icon → live re-check)- Settings row should read Spectre Capture Helper, not Terminal / java / the IDE
Docs: Recording, Troubleshooting
Agent attach hardening & richer remote surface
- Linux, macOS, and Windows 10 1803+ via native
AF_UNIX(no named pipes). On Windows the
socket lives under%TEMP%with an owner-only ACL. Same API:AgentAttach.attach(pid). - IPC frame I/O timeouts (idle vs mid-frame) so a wedged peer cannot hang the serial loop forever
- Deterministic runtime-jar discovery: multiple candidates fail closed (
AmbiguousAgentRuntimeJarException) - In-repo
agent-runtime/build/libsfallback only when the cwd is a Spectre checkout - Protocol version 2: handshake, error taxonomy, long-op cancel / deadlines, selector & input parity over agent (and HTTP)
- Window identity for daemon-owned window recording
- Inject (experimental inspect): nested
META-INF/spectre/inject-runtime.jarwhen the target has no preinstalledspectre-core— fine for attach → dump → detach; prefer instrumented apps for sustained use. Fixture inject is proven across OSes. Stock IntelliJ (no core in the IDE/plugin classpath) + Jewel tag dump via inject is not a 0.4.0 release gate — known incomplete, targeted for 0.4.1 verification (recipe: stock-intellij inject docs). Prefer installingspectre-corein IDE-hosted plugins for 0.4.0.
Docs: Agent attach, Capability matrix
Launch-and-attach
spectre launch, plus JUnit LaunchAndAttachExtension / LaunchAndAttachRule: start a process, wait for readiness, attach. Experimental agent API.
Compose Hot Reload awareness
When the target runs under Compose Hot Reload, Spectre can detect it and waitForReloadSettled, with reload-driven node-key invalidation. Optional CLI/MCP capability — not part of the :testing contract.
Docs: Hot Reload
Platform & packaging
- Release-gated runtime matrix (JBR 21 / JBR 25 / Temurin LTS × macOS · Linux · Windows)
- IntelliJ-hosted validation on IDEA 2026.2 / platform 262
- Windows Graphics Capture helper packaging: multi-file dual-arch verification (not exe-only)
- Pre-tag multi-OS release smoke (hosted CI is not enough for Windows UI attach / live WGC)
Library install
Maven Central — bump coordinates to 0.4.0:
dependencies {
implementation("dev.sebastiano.spectre:spectre-core:0.4.0")
// + spectre-testing, spectre-recording(-macos|-linux|-windows), spectre-agent, …
}See Installation for the full module table.
CLI install
macOS (Homebrew):
brew tap rock3r/spectre https://github.com/rock3r/spectre
brew install rock3r/spectre/spectre
# or: brew upgrade rock3r/spectre/spectreWindows (Scoop):
scoop bucket add spectre https://github.com/rock3r/spectre
scoop install spectre
# or: scoop update spectreLinux: download the matching archive from this release and put spectre on PATH.
The CLI is distributed via GitHub release archives / Homebrew / Scoop — not Maven Central. macOS archives are signed and notarised. Attach needs JDK 21+; same-OS-user local targets.
Upgrading from 0.3.0
- Failing Spectre JUnit tests now write failure artifacts by default — opt out if unwanted
- Prefer
fun mySpec(): Unit = runSpectreTest { … }for interaction timing correctness - macOS capture: grant Screen Recording to Spectre Capture Helper (re-run
spectre permissions requestafter helper updates) - Capture / agent skill consumers: treat
schemaVersion: 1as the on-disk contract - Agent/HTTP protocol and experimental APIs may require recompile against 0.4.0 (pre-1.0)
Experimental (unchanged tier)
These remain opt-in / experimental and may change:
- Full agent attach surface (
@ExperimentalSpectreAgentApi), including inject and launch-and-attach - HTTP transport (
@ExperimentalSpectreHttpApi) - Hot Reload settle / key invalidation (CLI/MCP only)