# 2.1.0 This release covers `stim` and `@stim-cli/cache-s3`. It pins Stim Host 0.2.1, which stimd now brings an installed Stim Host up to on its own, adds project plugins that can recognise and build a project type Stim does not bundle, makes cleanup treat dependency folders and git-ignored worktree files as disposable, and lets `stim gc --dry-run` answer from a report stimd keeps fresh. Every commit since v2.0.0 has an entry below. The Desktop changes noted below ship with the next Stim Desktop release, and the phone app ships through its own workflow. ## New - **Stim Host keeps itself current.** stimd installs the Stim Host this version pins over an older one in `~/Applications` each time it starts, with the same download, SHA-256 and Developer ID checks as `stim service install`, and retries hourly after a failure (logged as `host_update_failed`). It never installs Stim Host on a Mac that has none and never downgrades. `engine.autoUpdate` set to `off` turns this off. From Stim Host 0.2.1 on, the helper exits when its bundle is replaced, so launchd starts the new binary. [9c2c3b5b6](https://github.com/appandflow/stim/commit/9c2c3b5b6ab490373cb55960e994fcb73b7b05b8) - **Stim Host's helper restarts a bloated fseventsd.** fseventsd joins the Apple services the opt-in helper restarts, and the helper now measures each service's memory as the larger of its RSS and its physical footprint, so a service whose memory is mostly compressed or swapped still counts. Restarting fseventsd makes file watchers such as Metro, Watchman and Spotlight rescan once. This ships in Stim Host 0.2.1. Fixes [#6600](https://github.com/appandflow/stim/issues/6600). [ad81368d4](https://github.com/appandflow/stim/commit/ad81368d48a2921ef3ec60257dc753b00a71e824) - **A `project` plugin kind recognises a project type Stim does not bundle,** such as a Godot game, from a plugin's `package.json` alone (`stimPlugin.kinds.project` and a `stimPlugin.project` block with `id`, `name` and `markers`). The new machine setting `plugins` lists plugin directories by absolute path. A folder that holds every marker is a project root: `stim worktree add` and `warm` register it, `stim status` names the type (`project: Godot (plugin stim-plugin-godot)`), and `stim ios`, `android`, `macos` and `start` refuse with `STIM_NO_PROJECT` naming it, except for the Android build below. Stim never imports the plugin's code. Bundled integrations keep a folder they also serve. `stim plugin list`, `stim plugin test`, `stim doctor` and `stim settings set plugins` report a manifest Stim does not accept. The kind is experimental: its contract and integer may change in a minor release. `stim/plugin` exports `PROJECT_API_VERSION`, `ProjectPluginManifest` and `runProjectContract`. Refs [#6599](https://github.com/appandflow/stim/issues/6599). [808fea14f](https://github.com/appandflow/stim/commit/808fea14f7e485a8c8df1590d4a7e12ebbeb8d39) - **A project plugin can declare an Android build.** `stimPlugin.project.targets.android.build` holds a `debug` argument list, an optional `release` one and `"output": "apk"`. In a folder the plugin recognises, `stim android` runs that list in the project root with no shell, with `{root}` and `{output}` as its only placeholders and an executable that is an absolute path or a name on `PATH` (on Windows a `.exe`), then installs the APK on the workspace's emulator and launches it as a native process. `stim ios`, `macos` and `start` still refuse there. The build is never cached and never offloaded, and only an emulator this machine owns is a target. A bundled integration that builds the same folder keeps the build. `stim/plugin` exports `ProjectPluginAndroidTarget` and `ProjectPluginCommand`. Refs [#6599](https://github.com/appandflow/stim/issues/6599). [eb2a797e7](https://github.com/appandflow/stim/commit/eb2a797e798114fe2283c0405bfa9cde4e841cf3) - **Dependency folders are deleted without a check for hand edits.** Maintenance and `stim gc` delete the `node_modules` and `Pods` of idle workspaces, and finished or discovered worktrees that hold them, without looking inside. Make a library fix a committed patch (pnpm patch, yarn patch, patch-package or a Podfile `post_install` hook). An unfinished `pnpm patch` edit folder is still copied to `$STIM_HOME/rescued` first. The new machine setting `maintenance.cleanAutoDiscoveredDependencies` (default `false`, env `STIM_MAINTENANCE_CLEAN_AUTO_DISCOVERED_DEPENDENCIES`) governs checkouts that only `maintenance.autoDiscover` found: while it is off, their `node_modules` and `Pods` stay as long as the checkout does. Their build outputs and finished worktrees are cleaned either way. This replaces the hand-edit rules that [#6608](https://github.com/appandflow/stim/pull/6608) and [#6620](https://github.com/appandflow/stim/pull/6620) refined earlier in this release (pnpm's `node_modules/.package-map.json`, iOS build outputs in `Pods` and `node_modules`). Fixes [#6638](https://github.com/appandflow/stim/issues/6638), [#6603](https://github.com/appandflow/stim/issues/6603) and [#6616](https://github.com/appandflow/stim/issues/6616). [7cab41806](https://github.com/appandflow/stim/commit/7cab41806c80ae92d0acf9a64a3072176b0c811d) [9a208c7c6](https://github.com/appandflow/stim/commit/9a208c7c6d6177cfbcab22c8475d68e34c556149) [b8109f969](https://github.com/appandflow/stim/commit/b8109f96997d804d66ed97cb5ba1345192153fc7) - **Git-ignored files in a linked worktree are disposable.** A finished linked worktree is no longer kept because a git-ignored file in it is missing from the main checkout or differs there. An ignored file that exists only in a worktree, such as a `.env` created there, is deleted with the finished worktree: keep what matters in the main checkout or outside the repository. A discovered worktree's recent write to an ignored file still counts as activity. A registered worktree has no file scan, so a finished one goes once `gc.worktreeGraceMinutes` has passed even if an ignored file changed minutes before. Writes inside `.docusaurus` and `.pnpm-store` no longer count as activity. Tracked changes, untracked files git does not ignore and unpushed commits still keep a worktree. Fixes [#6643](https://github.com/appandflow/stim/issues/6643) and [#6652](https://github.com/appandflow/stim/issues/6652). [19292c0d9](https://github.com/appandflow/stim/commit/19292c0d9417ff481ab7588bd5dc2903a32b16f0) [b7311874a](https://github.com/appandflow/stim/commit/b7311874a56b3d43933ee4c1e043eb82dbca9609) [a1f371a60](https://github.com/appandflow/stim/commit/a1f371a60cbde22d7e9b6af0dc66ba5593cf2bad) - **`maintenance.discoverRoots` is now `maintenance.managedFolders`.** The 2.0.0 name is still read while the new one is unset, and `stim settings get`, `set` and `unset` accept it. A `set` through either name stores `maintenance.managedFolders` and removes the old key. When both are set, the new one wins and `stim settings` and `stim doctor` report the old one as not read. An older Stim that shares the Stim home reads only the old key, so update every Stim that shares it before setting the new one. Fixes [#6644](https://github.com/appandflow/stim/issues/6644). [eabbe775e](https://github.com/appandflow/stim/commit/eabbe775e61a7538330e82c3df316a48958c8a1b) - **`stim gc --dry-run` answers from the gc report stimd keeps fresh.** stimd refreshes the shared report in `$STIM_HOME/gc/report-cache.json` while `daemon.mode` is on and pressure is normal: after 15 minutes when cleanup state changed, and at least hourly. A dry run first measures the pressure level, then prints the cached report with its age, and `--json` adds `measured` (`from`: `cache` or `scan`, `at`, `parts`). A report older than an hour still answers, and stderr names `--refresh`. `stim gc --dry-run --refresh` measures again in its own process, as does a dry run with no cached report or one read at another pressure level, and names each part on stderr as it lands. `--pressure` measures in process and leaves the cache alone. `--refresh` without `--dry-run` refuses with `STIM_BAD_ARG`. An acting `stim gc` and every deletion still read each candidate fresh. stim-server reads the same file and sweeps only when it is missing or Desktop asks for a fresh one; while its own sweep runs, a Desktop report read also carries the parts read so far. (Desktop: shows those parts over the last complete report; ships with the next Stim Desktop release.) Fixes [#6612](https://github.com/appandflow/stim/issues/6612) and [#6613](https://github.com/appandflow/stim/issues/6613). [1fb5443b2](https://github.com/appandflow/stim/commit/1fb5443b2b6bec68f770c6ec11ee6d695afd56dd) [1c03227fa](https://github.com/appandflow/stim/commit/1c03227fae9beccd3008b72556c05425eeb82f87) - **Long-running commands report progress on stderr.** An acting `stim gc` prints one line per phase of the stimd pass (`level`, `discover`, `measure`, `plan`, `dormant`, `ladder`) and a closing `gc` line (`finished: N actions taken, X freed in T`), in `--json` mode too. A request that joins a pass already under way prints a line saying so, then that pass's lines from that point; a pass stimd started on its own prints no phase lines, only its actions. `stim engine install`, `use` and `update` print their fetch and self-test steps, and `stim remote update` prints a line when it starts waiting on the remote machine. Fixes [#6669](https://github.com/appandflow/stim/issues/6669). [63e1eff59](https://github.com/appandflow/stim/commit/63e1eff592e47affd79ba0c65bae661e79071530) ## Removed (breaking) - **`status --json` no longer carries `dependencyEdits`, and `stim doctor` no longer reports edited dependency folders,** because cleanup no longer looks for hand edits (see New). The field was optional and is now never present. Install records under `$STIM_HOME/dependency-installs/` are no longer written or pruned; existing files stay. [7cab41806](https://github.com/appandflow/stim/commit/7cab41806c80ae92d0acf9a64a3072176b0c811d) - **`stim gc` no longer keeps the workspace it runs from.** A gc pass, acting or dry run, plans the same work from any directory, so the checkout you run it in can lose its `node_modules` and `Pods` or, as a finished worktree, be removed, like any other. Everything that keeps a workspace in use still does: running dev servers and devices, live claims, agent sessions, running Stim commands and any process working in it, idle and dormant periods, recent use and pins. An acting pass runs its child processes from stimd's directory. `stim start`, `ios` and `android` still keep the workspace they build. [1fb5443b2](https://github.com/appandflow/stim/commit/1fb5443b2b6bec68f770c6ec11ee6d695afd56dd) - **`stim gc` no longer lists or stops the current Expo project's orphaned EAS sessions.** `orphanedEasSessions` in `gc --json` is always empty. Listing every Expo project's sessions would take a network scan per project. gc still cleans the local EAS ledger entries it can prove are stale. [1fb5443b2](https://github.com/appandflow/stim/commit/1fb5443b2b6bec68f770c6ec11ee6d695afd56dd) - **Cleanup keeps less.** Hand edits inside `node_modules` and `Pods`, and git-ignored files that exist only in a finished linked worktree, are now deleted with them (see New). [7cab41806](https://github.com/appandflow/stim/commit/7cab41806c80ae92d0acf9a64a3072176b0c811d) [19292c0d9](https://github.com/appandflow/stim/commit/19292c0d9417ff481ab7588bd5dc2903a32b16f0) ## Fixes - **On Windows, a fresh install of Stim no longer picks up cross-spawn 7.1.0,** which runs `npm` and other batch shims by their bare name in a way that makes npm look for its own files in the current directory (`Cannot find module ...\node_modules\npm\bin\npm-prefix.js`). Stim pins cross-spawn 7.0.6 until upstream fixes it. Fixes [#6659](https://github.com/appandflow/stim/issues/6659). [ccc4078ee](https://github.com/appandflow/stim/commit/ccc4078ee97787bfcd86fc776a6b019713ad1666) - **On Windows, a native build in a worktree that `stim worktree add` or `warm` filled from a source checkout is stored in the build cache again.** The carried `node_modules` keeps the source checkout's file times, so the warm has to compare the worktree's install inputs with the source's, and Git for Windows checks `package.json`, the lockfile and patches out with CRLF line endings, so that comparison failed and every build printed `... changed after the last install; the build will be installed but not cached`. The warm now compares these files without regard to line endings. Fixes [#6633](https://github.com/appandflow/stim/issues/6633). [23a490683](https://github.com/appandflow/stim/commit/23a490683920363fe3c6709ba9a7e44a9d765cf5) - **Stim pins Stim Host 0.2.1,** and the fseventsd memory advice now names `stim service install --helper` instead of `sudo killall fseventsd`. A Mac with Stim Host installed moves to 0.2.1 the next time stimd starts, unless `engine.autoUpdate` is `off`; `stim service install` installs it either way. A helper registered before 0.2.1 keeps running its old binary until a reboot or `sudo launchctl kickstart -k system/dev.stim.host.helper`. The helper's restart line in `stim status` shows the larger of RSS and footprint as memory. (Desktop: the preferences copy names fseventsd and says "2 GB of memory"; ships with the next Stim Desktop release.) Fixes [#6601](https://github.com/appandflow/stim/issues/6601) and [#6604](https://github.com/appandflow/stim/issues/6604). [6b364af97](https://github.com/appandflow/stim/commit/6b364af97a8cc3f0ac4f2ca7b613d4570c31f7af) - **A lock left with an unrecorded child is recovered after a reboot.** A claim whose owner died before recording the child it started kept its workspace "in use" until removed by hand. It now reads as free when its owner is gone and the owner's process token records an earlier boot. Within one boot, when a boot id cannot be read, and on Windows nothing changes. Fixes [#6618](https://github.com/appandflow/stim/issues/6618). [79f2cc714](https://github.com/appandflow/stim/commit/79f2cc7142d53bffd8b0377cc037ff1d732b01ea) - **Stim Desktop's cleanup report answers from stimd's cached gc report.** On a Mac with many projects the report timed out at 60 s every time. stim-server now answers a gc report read at once with the last good report and when it was measured, or `pending` during a first sweep, runs at most one sweep with a 15 minute budget, and keeps the report in `$STIM_HOME/gc/report-cache.json` across stimd restarts. Phone machine details read the same report. (Desktop: polls without forcing a new sweep; ships with the next Stim Desktop release.) Fixes [#6606](https://github.com/appandflow/stim/issues/6606). [aaa3efabe](https://github.com/appandflow/stim/commit/aaa3efabeb102865a6447d737491a870553b05eb) - **gc reports ask git each question once.** A report no longer drops its shared git reads between sweeps, merge state is shared per run, a repository's worktrees share one `git worktree list`, and the source walk asks `git check-ignore` once per depth. On a Mac with 258 registered projects, `stim gc --dry-run --json` went from 6,617 git calls to 2,685. Fixes [#6615](https://github.com/appandflow/stim/issues/6615). [eb523efa9](https://github.com/appandflow/stim/commit/eb523efa9e7f385b88111d7424285cd09eed3afd) - **`stim gc` names macOS swap as one disk user** (`swap, 60 files in /System/Volumes/VM`) instead of one row per 1 GB swap file. Fixes [#6607](https://github.com/appandflow/stim/issues/6607). [54e0d07c7](https://github.com/appandflow/stim/commit/54e0d07c7af6e09f6d45a520596c7958a407b89b) - **A finished worktree with a detached HEAD is removed when a merged pull request holds that HEAD.** It was kept forever as `unpushed`, because the merged pull request lookup needed a branch. gc and maintenance now look the commit up on GitHub: a `MERGED` pull request of this repository whose head equals or contains HEAD waives the unpushed commits, and `stim worktree remove` waives them while HEAD still equals that head. A failed or missing `gh` waives nothing. Fixes [#6645](https://github.com/appandflow/stim/issues/6645). [2800e2ae4](https://github.com/appandflow/stim/commit/2800e2ae4b756493df82b490f87945bd4d493cd8) - **Native and plugin APKs are checked with `aapt2` instead of `aapt`,** which refused Godot's Android exports with the default renderer (`attribute is not an integer value`). The Android SDK build-tools need `aapt2`, which every release since 26.0.0 includes. Fixes [#6668](https://github.com/appandflow/stim/issues/6668). [a22670068](https://github.com/appandflow/stim/commit/a22670068e42f4078b7b6c48c2e5f4ba7c9cb16a) - **Internal only:** the built-in Exact iOS integration runs through an internal plugin interface, locally and for offloaded builds, with no behavior change ([e0e746f58](https://github.com/appandflow/stim/commit/e0e746f58218232f316b9a1272a98d2968efb84f), [aa0130939](https://github.com/appandflow/stim/commit/aa013093908f139346a31817bf439cebf97fce0f)). Fixes [#6642](https://github.com/appandflow/stim/issues/6642) and [#6649](https://github.com/appandflow/stim/issues/6649); refs [#6599](https://github.com/appandflow/stim/issues/6599). - **Test only:** [f804232b3](https://github.com/appandflow/stim/commit/f804232b343123c613a7ec81a7c5b15e85a094b5) covers Exact behaviors that had no test (Fixes [#6640](https://github.com/appandflow/stim/issues/6640)), [b5bf00f67](https://github.com/appandflow/stim/commit/b5bf00f67b62e298dc1fb6a7f85626f402b91204) covers the Exact behaviors of machine-wide cleanup (Fixes [#6664](https://github.com/appandflow/stim/issues/6664)), and [1c3c1fda6](https://github.com/appandflow/stim/commit/1c3c1fda641da6c7d161e4af5f5d9f1fcd03ce16) keeps git auto maintenance off across the worktree-add integration tests (Fixes [#6621](https://github.com/appandflow/stim/issues/6621)). No shipped behavior changes. ## Migration notes - **Rename `maintenance.discoverRoots`** when every Stim that shares the Stim home runs 2.1.0: `stim settings set maintenance.managedFolders '["/path/to/folder"]' --scope machine` with the same list moves the value and removes the old key. Leaving the old key alone keeps working. - **Commit library fixes as patches.** An edit inside `node_modules` or `Pods` is deleted once the workspace is idle. - **Move files you want to keep out of a worktree's git-ignored files,** such as a `.env` created only in a worktree, before the worktree is finished. - **To keep a checkout from cleanup, pin it** with `stim settings set maintenance.keep true` in it; `stim gc` no longer spares the checkout you run it from. Use `stim gc --dry-run --refresh` when you need numbers newer than the cached report. - **Scripts that read `orphanedEasSessions` from `gc --json`** get an empty list; stop remote EAS sessions with eas-cli. - **A Stim Host helper registered before 0.2.1** needs one reboot or `sudo launchctl kickstart -k system/dev.stim.host.helper` to run the new helper.