stim 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/README.md +3 -3
  2. package/dist/{android-BkM4qTaN.mjs → android-DJWiTBkz.mjs} +5 -5
  3. package/dist/{android-cas-BjLRZyks.mjs → android-cas-CSS8gjR7.mjs} +5 -5
  4. package/dist/{android-BTR1KTMP.mjs → android-sobvO9ia.mjs} +22 -22
  5. package/dist/{build-slots-D6sDzOe-.mjs → build-slots-CuPszJDu.mjs} +1 -1
  6. package/dist/{cache-manifest-D02TpYjA.mjs → cache-manifest-uoOKhgUD.mjs} +1 -1
  7. package/dist/cache-manifest.mjs +1 -1
  8. package/dist/cli.mjs +14 -14
  9. package/dist/collector-run.mjs +3 -3
  10. package/dist/{config-6vdGngKa.mjs → config-DMP7L7H6.mjs} +1 -1
  11. package/dist/{dependency-state-BMirHEPD.mjs → dependency-state-CTL8A9p3.mjs} +1 -1
  12. package/dist/{deps-Ck4wuTwa.mjs → deps-BAGOnrc7.mjs} +1 -1
  13. package/dist/{dev-client-Cd0v7iZk.mjs → dev-client-BoifdqkU.mjs} +9 -9
  14. package/dist/{device-CKXLnRRb.mjs → device-BUw4JBuH.mjs} +5 -5
  15. package/dist/{device-CMDFzx7C.mjs → device-DvKJ454A.mjs} +8 -8
  16. package/dist/{device-lease-DDJr85OK.mjs → device-lease-r7yEQ1R8.mjs} +3 -3
  17. package/dist/{device-pool-DJvbIBGW.mjs → device-pool-DU4FQKp5.mjs} +2 -2
  18. package/dist/{device-remote-CMfHhoc8.mjs → device-remote-BTUqbl0i.mjs} +6 -6
  19. package/dist/{doctor-B_mfURdt.mjs → doctor-Di_B26uh.mjs} +25 -168
  20. package/dist/{error-diagnostics-_VmkqRZo.mjs → error-diagnostics-CTePWAzW.mjs} +6 -6
  21. package/dist/{gc-0AyxmECv.mjs → gc-C20dWw_8.mjs} +12 -12
  22. package/dist/{guide-CGxdmQ0K.mjs → guide-sAnoty2y.mjs} +26 -14
  23. package/dist/guide-status-BF6RsJJp.mjs +271 -0
  24. package/dist/{ios-CtmGLx3X.mjs → ios-BdpkncL6.mjs} +21 -21
  25. package/dist/{logs-BF3qPA7w.mjs → logs-BfQdIhiF.mjs} +4 -4
  26. package/dist/{metro-DFLmaVz8.mjs → metro-ato6ef3J.mjs} +3 -3
  27. package/dist/{named-ports-BO7Zpjp0.mjs → named-ports-DH9SXd0f.mjs} +3 -3
  28. package/dist/{ownership-BvSpZVBk.mjs → ownership-CD_XnpDu.mjs} +3 -3
  29. package/dist/{ownership-C08Yzrp7.mjs → ownership-CVY9cqCr.mjs} +3 -3
  30. package/dist/{ports-BiKqP92J.mjs → ports-A6uTJSPj.mjs} +3 -3
  31. package/dist/{ports-ClqG8GPt.mjs → ports-BZprTJRa.mjs} +1 -1
  32. package/dist/{project-CBFCwnN5.mjs → project-B_SDt4ip.mjs} +2 -2
  33. package/dist/{reclaim-DpDVo-AP.mjs → reclaim-C_rB25f4.mjs} +10 -10
  34. package/dist/{reload-ByTqg6ZI.mjs → reload-CYBJbJfI.mjs} +6 -6
  35. package/dist/{server-bare-Buk-k8tI.mjs → server-bare-H3pAhbMs.mjs} +11 -32
  36. package/dist/server-expo-CSwUVYOa.mjs +2 -0
  37. package/dist/{server-expo-D4P7iTvf.mjs → server-expo-Ds8_mfng.mjs} +6 -14
  38. package/dist/{settings-DwfltIXQ.mjs → settings-kO2ZqIKy.mjs} +2 -2
  39. package/dist/{slot-launch-DeKen9e5.mjs → slot-launch-BpHiHH6A.mjs} +3 -3
  40. package/dist/{start-BpKUHcU_.mjs → start-DiEfqEWk.mjs} +16 -20
  41. package/dist/{state-CDbvmZdt.mjs → state-CnWzvCWP.mjs} +2 -2
  42. package/dist/{stats-k5qMjyxo.mjs → stats-DHrO0frH.mjs} +3 -3
  43. package/dist/{stats-C59QLKm2.mjs → stats-Fo9ACIv7.mjs} +1 -1
  44. package/dist/{status-Y2ij3dm6.mjs → status-J5LAXpag.mjs} +14 -12
  45. package/dist/{stop-_P2OQwmZ.mjs → stop-0jJNahwN.mjs} +11 -11
  46. package/dist/{stop-vKmmxhea.mjs → stop-CM1fejKW.mjs} +2 -2
  47. package/dist/supervisor-run.d.mts +4 -1
  48. package/dist/supervisor-run.mjs +18 -10
  49. package/dist/{teardown-KsPpvldq.mjs → teardown-CAVcWeRD.mjs} +5 -5
  50. package/dist/{workspace-process-lock-UEIrvZMJ.mjs → workspace-process-lock-Bz19_R9R.mjs} +1 -1
  51. package/dist/{workspace-state-Do1e2mOH.mjs → workspace-state-WVwWw_hB.mjs} +1 -1
  52. package/dist/{worktree-BvcAIMdJ.mjs → worktree-CeUKDAQw.mjs} +25 -20
  53. package/dist/{worktree-DWNx4tUg.mjs → worktree-DJnBbQZ9.mjs} +49 -22
  54. package/dist/{xcode-D9tVItl-.mjs → xcode-BqDeRkpT.mjs} +4 -4
  55. package/package.json +5 -5
  56. package/shim/expo-metro-config.cjs +11 -17
  57. package/dist/server-expo-Dho5Raiw.mjs +0 -2
  58. package/shim/metro-cache-generation.cjs +0 -20
  59. package/shim/metro-cache-generation.d.cts +0 -5
@@ -1,5 +1,5 @@
1
1
  import { t as getExecutor } from "./exec-CyylIdq9.mjs";
2
- import { g as loadConfig, u as getConfigDir } from "./config-6vdGngKa.mjs";
2
+ import { g as loadConfig, u as getConfigDir } from "./config-DMP7L7H6.mjs";
3
3
  import { accessSync, chmodSync, constants, lstatSync, mkdirSync, mkdtempSync, readdirSync, realpathSync, rmSync, statSync } from "node:fs";
4
4
  import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
5
5
  import { chmodSync as chmodSync$1, existsSync as existsSync$1, lstatSync as lstatSync$1, mkdirSync as mkdirSync$1, readFileSync as readFileSync$1, readdirSync as readdirSync$1, realpathSync as realpathSync$1, utimesSync } from "fs";
@@ -103,19 +103,6 @@ function gitCommonDir(cwd) {
103
103
  ]);
104
104
  return out ? out.trim() : null;
105
105
  }
106
- function isMainWorkingTree(path) {
107
- const out = getExecutor().runFileQuiet("git", [
108
- "-C",
109
- path,
110
- "rev-parse",
111
- "--path-format=absolute",
112
- "--git-dir",
113
- "--git-common-dir"
114
- ]);
115
- if (!out) return false;
116
- const [gitDir, commonDir] = out.trim().split("\n").map((line) => line.trim());
117
- return Boolean(gitDir) && gitDir === commonDir;
118
- }
119
106
  function repoRoot(cwd) {
120
107
  const out = getExecutor().runFileQuiet("git", [
121
108
  "-C",
@@ -159,16 +146,15 @@ function warmWorktreePaths(cwd) {
159
146
  const currentRoot = repoRoot(cwd);
160
147
  if (!currentRoot) throw new Error("Not a git repository.");
161
148
  const target = realpathSync$1(currentRoot);
162
- if (isMainWorkingTree(target)) throw new Error("Run stim worktree warm from a linked worktree, not the source checkout.");
163
- const entries = listWorktrees(target);
164
- const current = entries.find((entry) => canonicalPath(entry.path) === target);
165
- const main = entries.find((entry) => isMainWorkingTree(entry.path));
166
- if (!current || !main) throw new Error("Could not identify the linked worktree and its source checkout.");
167
- const root = realpathSync$1(main.path);
149
+ const source = resolveSourceCheckout(target);
150
+ if ("refusal" in source) throw new Error(source.refusal);
151
+ if (!source.entries.find((entry) => canonicalPath(entry.path) === target)) throw new Error("Could not identify the linked worktree and its source checkout.");
152
+ const root = realpathSync$1(source.path);
153
+ if (root === target) throw new Error("Run stim worktree warm from a linked worktree, not the source checkout.");
168
154
  const sourceRoot = repoRoot(root);
169
155
  const sourceCommon = gitCommonDir(root);
170
156
  const targetCommon = gitCommonDir(target);
171
- if (root === target || !sourceRoot || realpathSync$1(sourceRoot) !== root || !sourceCommon || !targetCommon || realpathSync$1(sourceCommon) !== realpathSync$1(targetCommon)) throw new Error("Could not verify that the source checkout belongs to this linked worktree.");
157
+ if (!sourceRoot || realpathSync$1(sourceRoot) !== root || !sourceCommon || !targetCommon || realpathSync$1(sourceCommon) !== realpathSync$1(targetCommon)) throw new Error("Could not verify that the source checkout belongs to this linked worktree.");
172
158
  return {
173
159
  root,
174
160
  target,
@@ -556,6 +542,7 @@ function parseWorktrees(out) {
556
542
  current = { path: line.slice(9) };
557
543
  } else if (line.startsWith("branch ")) current.branch = line.slice(7).replace("refs/heads/", "");
558
544
  else if (line === "prunable" || line.startsWith("prunable ")) current.prunable = true;
545
+ else if (line === "bare") current.bare = true;
559
546
  if (current.path) entries.push(current);
560
547
  return entries;
561
548
  }
@@ -569,5 +556,45 @@ function listWorktrees(cwd) {
569
556
  ]);
570
557
  return out ? parseWorktrees(out) : [];
571
558
  }
559
+ function selectSourceCheckout(entries, bareHead) {
560
+ const first = entries[0];
561
+ if (!first) return { refusal: "Git lists no worktrees for this repository." };
562
+ if (!first.bare) return { path: first.path };
563
+ const bare = first.path;
564
+ const checkouts = entries.filter((entry) => !entry.bare && !entry.prunable);
565
+ const listed = checkouts.map((entry) => `${entry.branch ?? "detached"} (${entry.path})`).join(", ") || "none";
566
+ const pointHead = ` git -C ${bare} symbolic-ref HEAD refs/heads/<branch>`;
567
+ if (!bareHead) return { refusal: `The bare repository at ${bare} has a detached HEAD, so Stim cannot tell which worktree is the source checkout. Point HEAD at the source branch, then retry:\n${pointHead}\nChecked-out branches: ${listed}` };
568
+ const matches = checkouts.filter((entry) => entry.branch === bareHead);
569
+ const [only] = matches;
570
+ if (only && matches.length === 1) return { path: only.path };
571
+ if (!only) {
572
+ const stale = entries.find((entry) => entry.prunable && entry.branch === bareHead);
573
+ const beside = checkouts[0] ? dirname$1(checkouts[0].path) : bare;
574
+ return { refusal: `The bare repository at ${bare} points HEAD at ${bareHead}, but no worktree has ${bareHead} checked out, so Stim has no source checkout to copy from. ${stale ? `Its worktree at ${stale.path} is missing. Recreate it, then retry:\n git -C ${bare} worktree prune\n git -C ${bare} worktree add ${stale.path} ${bareHead}\n` : `Create one, then retry:\n git -C ${bare} worktree add ${join$1(beside, bareHead)} ${bareHead}\n`}Or point HEAD at a branch that is checked out (${listed}):\n${pointHead}` };
575
+ }
576
+ return { refusal: `The bare repository at ${bare} points HEAD at ${bareHead}, which is checked out in more than one worktree: ${matches.map((entry) => entry.path).join(", ")}. Remove the extra worktrees, or point HEAD at a branch checked out once, then retry:\n${pointHead}` };
577
+ }
578
+ function bareHeadBranch(bare) {
579
+ const out = getExecutor().runFileQuiet("git", [
580
+ "-C",
581
+ bare,
582
+ "symbolic-ref",
583
+ "--quiet",
584
+ "HEAD"
585
+ ])?.trim();
586
+ return out?.startsWith("refs/heads/") ? out.slice(11) : null;
587
+ }
588
+ function sourceCheckoutOf(entries) {
589
+ const first = entries[0];
590
+ return selectSourceCheckout(entries, first?.bare ? bareHeadBranch(first.path) : null);
591
+ }
592
+ function resolveSourceCheckout(cwd) {
593
+ const entries = listWorktrees(cwd);
594
+ return {
595
+ entries,
596
+ ...sourceCheckoutOf(entries)
597
+ };
598
+ }
572
599
  //#endregion
573
- export { makeTemporaryDirectory as C, filesystemDevice as S, temporaryRoot as T, repoRoot as _, dirtyFingerprintFiles as a, unpushedCommits as b, hasRemote as c, isPodInstallChurn as d, listWorktrees as f, removeWorktree as g, readWorktreeExclude as h, depsOutOfSync as i, hasUncommittedWork as l, podsOutOfSync as m, cloneIgnoredEntries as n, dirtyPaths as o, locallyKnownUpstream as p, deleteBranch as r, gitCommonDir as s, branchExists as t, isMainWorkingTree as u, resolveFullRef as v, removeTemporaryEntry as w, warmWorktreePaths as x, restoreFile as y };
600
+ export { filesystemDevice as C, temporaryRoot as E, warmWorktreePaths as S, removeTemporaryEntry as T, resolveFullRef as _, dirtyFingerprintFiles as a, sourceCheckoutOf as b, hasRemote as c, listWorktrees as d, locallyKnownUpstream as f, repoRoot as g, removeWorktree as h, depsOutOfSync as i, hasUncommittedWork as l, readWorktreeExclude as m, cloneIgnoredEntries as n, dirtyPaths as o, podsOutOfSync as p, deleteBranch as r, gitCommonDir as s, branchExists as t, isPodInstallChurn as u, resolveSourceCheckout as v, makeTemporaryDirectory as w, unpushedCommits as x, restoreFile as y };
@@ -1,10 +1,10 @@
1
1
  import { t as getExecutor } from "./exec-CyylIdq9.mjs";
2
- import { r as register } from "./cache-manifest-D02TpYjA.mjs";
3
- import { d as sharedCompilationCache, m as workspaceDerivedData } from "./workspace-state-Do1e2mOH.mjs";
2
+ import { r as register } from "./cache-manifest-uoOKhgUD.mjs";
3
+ import { d as sharedCompilationCache, m as workspaceDerivedData } from "./workspace-state-WVwWw_hB.mjs";
4
4
  import { t as createLineReader } from "./process-output-C7IlIzd7.mjs";
5
5
  import { a as formatElapsed, l as phaseLine } from "./command-output-BuIb_ZOI.mjs";
6
- import { U as resolveOptimizations } from "./settings-DwfltIXQ.mjs";
7
- import { t as cleanLine } from "./server-expo-D4P7iTvf.mjs";
6
+ import { U as resolveOptimizations } from "./settings-kO2ZqIKy.mjs";
7
+ import { t as cleanLine } from "./server-expo-Ds8_mfng.mjs";
8
8
  import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
9
9
  import { createHash } from "node:crypto";
10
10
  import { basename, isAbsolute, join, relative, resolve, sep } from "node:path";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stim",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "Stim: fast, isolated React Native environments for coding agents",
5
5
  "keywords": [
6
6
  "agent",
@@ -42,15 +42,15 @@
42
42
  },
43
43
  "dependencies": {
44
44
  "@expo/fingerprint": "^0.20.10",
45
- "@stim-cli/cache": "^1.4.0",
46
- "@stim-cli/core": "^1.4.0",
47
- "@stim-cli/metro": "^1.4.0",
45
+ "@stim-cli/cache": "^1.5.0",
46
+ "@stim-cli/core": "^1.5.0",
47
+ "@stim-cli/metro": "^1.5.0",
48
48
  "chalk": "^5.4.1",
49
49
  "commander": "^13.1.0",
50
50
  "ws": "^8.21.3"
51
51
  },
52
52
  "devDependencies": {
53
- "@stim-cli/expo-build-cache": "1.4.0",
53
+ "@stim-cli/expo-build-cache": "1.5.0",
54
54
  "@types/ws": "^8.18.1",
55
55
  "unique-pid": "0.1.1"
56
56
  },
@@ -6,7 +6,6 @@ const path = require('node:path');
6
6
  const { createRequire } = require('node:module');
7
7
  const { pathToFileURL } = require('node:url');
8
8
  const { bundleResponseMiddleware } = require('./bundle-response.cjs');
9
- const { applyMetroCacheGeneration } = require('./metro-cache-generation.cjs');
10
9
 
11
10
  const projectRoot = process.env.STIM_PROJECT_ROOT;
12
11
  const storeRoot = process.env.STIM_METRO_STORE;
@@ -125,24 +124,19 @@ function appendStore(config, defaultConfig) {
125
124
  const server = { ...defaultConfig.server, ...output.server };
126
125
  const enhanceMiddleware = server.enhanceMiddleware;
127
126
 
128
- const observed = applyMetroCacheGeneration(
129
- {
130
- ...output,
131
- cacheVersion: output.cacheVersion ?? defaultConfig.cacheVersion,
132
- server: {
133
- ...server,
134
- enhanceMiddleware(middleware, metroServer) {
135
- const enhanced = enhanceMiddleware ? enhanceMiddleware(middleware, metroServer) : middleware;
136
- const observe = bundleResponseMiddleware((record) =>
137
- process.stderr.write(`stim-bundle-response: ${JSON.stringify(record)}\n`),
138
- );
139
- return (req, res, next) => observe(req, res, () => enhanced(req, res, next));
140
- },
127
+ const observed = {
128
+ ...output,
129
+ server: {
130
+ ...server,
131
+ enhanceMiddleware(middleware, metroServer) {
132
+ const enhanced = enhanceMiddleware ? enhanceMiddleware(middleware, metroServer) : middleware;
133
+ const observe = bundleResponseMiddleware((record) =>
134
+ process.stderr.write(`stim-bundle-response: ${JSON.stringify(record)}\n`),
135
+ );
136
+ return (req, res, next) => observe(req, res, () => enhanced(req, res, next));
141
137
  },
142
138
  },
143
- process.env.STIM_METRO_CACHE_GENERATION,
144
- process.env.STIM_METRO_FILE_MAP,
145
- );
139
+ };
146
140
  if (!storeRoot) return observed;
147
141
  return {
148
142
  ...observed,
@@ -1,2 +0,0 @@
1
- import { p as startExpoServer } from "./server-expo-D4P7iTvf.mjs";
2
- export { startExpoServer };
@@ -1,20 +0,0 @@
1
- 'use strict';
2
-
3
- const { createHash } = require('node:crypto');
4
- const { mkdirSync } = require('node:fs');
5
- const { join } = require('node:path');
6
-
7
- function applyMetroCacheGeneration(config, generation, directory) {
8
- if (!generation) return config;
9
- const fileMapCacheDirectory = join(directory, generation);
10
- mkdirSync(fileMapCacheDirectory, { recursive: true });
11
- return {
12
- ...config,
13
- cacheVersion: createHash('sha256')
14
- .update(JSON.stringify([config.cacheVersion ?? '1.0', generation]))
15
- .digest('hex'),
16
- fileMapCacheDirectory,
17
- };
18
- }
19
-
20
- module.exports = { applyMetroCacheGeneration };
@@ -1,5 +0,0 @@
1
- export function applyMetroCacheGeneration<T extends { cacheVersion?: string }>(
2
- config: T,
3
- generation: string | undefined,
4
- directory: string,
5
- ): T;