@smoothbricks/nx-plugin 0.6.2 → 0.7.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 (177) hide show
  1. package/README.md +417 -171
  2. package/dist/.build-inputs.json +39 -28
  3. package/dist/bin/smoo-nx-go-test-build.d.ts +3 -0
  4. package/dist/bin/smoo-nx-go-test-build.d.ts.map +1 -0
  5. package/dist/bin/smoo-nx-go-test-build.js +79 -0
  6. package/dist/bin/smoo-nx-go-test-run.d.ts +3 -0
  7. package/dist/bin/smoo-nx-go-test-run.d.ts.map +1 -0
  8. package/dist/bin/smoo-nx-go-test-run.js +129 -0
  9. package/dist/bin/smoo-nx-publish.d.ts +3 -0
  10. package/dist/bin/smoo-nx-publish.d.ts.map +1 -0
  11. package/dist/bin/smoo-nx-publish.js +3 -0
  12. package/dist/bounded-test-policy.d.ts +1 -1
  13. package/dist/bounded-test-policy.d.ts.map +1 -1
  14. package/dist/bounded-test-policy.js +9 -8
  15. package/dist/cargo-retention-hook.d.ts +6 -2
  16. package/dist/cargo-retention-hook.d.ts.map +1 -1
  17. package/dist/cargo-retention-hook.js +13 -7
  18. package/dist/cargo-workspace.d.ts +10 -20
  19. package/dist/cargo-workspace.d.ts.map +1 -1
  20. package/dist/cargo-workspace.js +12 -22
  21. package/dist/cross-check-policy.d.ts +2 -2
  22. package/dist/cross-check-policy.js +2 -2
  23. package/dist/deploy-policy.d.ts +6 -0
  24. package/dist/deploy-policy.d.ts.map +1 -1
  25. package/dist/deploy-policy.js +11 -0
  26. package/dist/eslint-file-set.d.ts +4 -1
  27. package/dist/eslint-file-set.d.ts.map +1 -1
  28. package/dist/eslint-sources.d.ts +25 -0
  29. package/dist/eslint-sources.d.ts.map +1 -0
  30. package/dist/eslint-sources.js +99 -0
  31. package/dist/executors/all-verdicts/executor.d.ts +2 -1
  32. package/dist/executors/all-verdicts/executor.d.ts.map +1 -1
  33. package/dist/executors/all-verdicts/executor.js +48 -2
  34. package/dist/executors/all-verdicts/schema.d.ts +13 -0
  35. package/dist/executors/all-verdicts/schema.d.ts.map +1 -1
  36. package/dist/executors/all-verdicts/schema.js +7 -0
  37. package/dist/executors/bounded-exec/bounds.d.ts +57 -8
  38. package/dist/executors/bounded-exec/bounds.d.ts.map +1 -1
  39. package/dist/executors/bounded-exec/bounds.js +100 -11
  40. package/dist/executors/bounded-exec/executor.d.ts +2 -1
  41. package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
  42. package/dist/executors/bounded-exec/executor.js +289 -34
  43. package/dist/executors/bounded-exec/hang-diagnostics.d.ts +2 -0
  44. package/dist/executors/bounded-exec/hang-diagnostics.d.ts.map +1 -1
  45. package/dist/executors/bounded-exec/hang-diagnostics.js +2 -2
  46. package/dist/executors/bounded-exec/mbx-pool.d.ts +56 -10
  47. package/dist/executors/bounded-exec/mbx-pool.d.ts.map +1 -1
  48. package/dist/executors/bounded-exec/mbx-pool.js +145 -11
  49. package/dist/executors/bounded-exec/mbx-queue.d.ts +30 -0
  50. package/dist/executors/bounded-exec/mbx-queue.d.ts.map +1 -0
  51. package/dist/executors/bounded-exec/mbx-queue.js +229 -0
  52. package/dist/executors/bounded-exec/progress.d.ts +9 -2
  53. package/dist/executors/bounded-exec/progress.d.ts.map +1 -1
  54. package/dist/executors/bounded-exec/progress.js +151 -25
  55. package/dist/executors/bounded-exec/runner-sizing.d.ts +40 -2
  56. package/dist/executors/bounded-exec/runner-sizing.d.ts.map +1 -1
  57. package/dist/executors/bounded-exec/runner-sizing.js +55 -4
  58. package/dist/executors/bounded-exec/runtime-pin.js +1 -1
  59. package/dist/executors/bounded-exec/test-result-writer.d.ts +30 -0
  60. package/dist/executors/bounded-exec/test-result-writer.d.ts.map +1 -0
  61. package/dist/executors/bounded-exec/test-result-writer.js +126 -0
  62. package/dist/executors/bounded-exec/test-results.d.ts +33 -0
  63. package/dist/executors/bounded-exec/test-results.d.ts.map +1 -0
  64. package/dist/executors/bounded-exec/test-results.js +33 -0
  65. package/dist/executors/bounded-exec/verdict.d.ts +26 -2
  66. package/dist/executors/bounded-exec/verdict.d.ts.map +1 -1
  67. package/dist/executors/bounded-exec/verdict.js +108 -4
  68. package/dist/executors/wrangler-deploy/deploy-hash.d.ts +10 -0
  69. package/dist/executors/wrangler-deploy/deploy-hash.d.ts.map +1 -0
  70. package/dist/executors/wrangler-deploy/deploy-hash.js +14 -0
  71. package/dist/executors/wrangler-deploy/executor.d.ts +24 -0
  72. package/dist/executors/wrangler-deploy/executor.d.ts.map +1 -0
  73. package/dist/executors/wrangler-deploy/executor.js +43 -0
  74. package/dist/executors/wrangler-deploy/hasher.d.ts +27 -0
  75. package/dist/executors/wrangler-deploy/hasher.d.ts.map +1 -0
  76. package/dist/executors/wrangler-deploy/hasher.js +90 -0
  77. package/dist/executors/wrangler-deploy/schema.d.ts +5 -0
  78. package/dist/executors/wrangler-deploy/schema.d.ts.map +1 -0
  79. package/dist/go-tests.d.ts +30 -0
  80. package/dist/go-tests.d.ts.map +1 -0
  81. package/dist/go-tests.js +43 -0
  82. package/dist/index.d.ts +12 -4
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/index.js +338 -295
  85. package/dist/managed-files/files.d.ts.map +1 -1
  86. package/dist/managed-files/files.js +5 -0
  87. package/dist/nx-publish.d.ts +24 -0
  88. package/dist/nx-publish.d.ts.map +1 -0
  89. package/dist/nx-publish.js +150 -0
  90. package/dist/process-group.js +2 -2
  91. package/dist/runtime-input-policy.d.ts +17 -3
  92. package/dist/runtime-input-policy.d.ts.map +1 -1
  93. package/dist/runtime-input-policy.js +4 -4
  94. package/dist/test-timings.d.ts +23 -4
  95. package/dist/test-timings.d.ts.map +1 -1
  96. package/dist/test-timings.js +72 -12
  97. package/dist/tool-bins.d.ts +6 -8
  98. package/dist/tool-bins.d.ts.map +1 -1
  99. package/dist/tool-bins.js +7 -5
  100. package/dist/version-actions.cjs +10 -11
  101. package/dist/version-actions.d.cts.map +1 -1
  102. package/dist/workspace-config-policy.d.ts.map +1 -1
  103. package/dist/workspace-config-policy.js +17 -22
  104. package/dist/workspace-index.d.ts +7 -0
  105. package/dist/workspace-index.d.ts.map +1 -1
  106. package/dist/workspace-index.js +11 -0
  107. package/dist/workspace-manifest.js +3 -3
  108. package/executors.json +7 -6
  109. package/managed/raw/patches/nx@23.2.1.patch +118 -24
  110. package/managed/raw/patches/ttsc@0.34.1.patch +139 -0
  111. package/managed/raw/tooling/devenv +1 -2
  112. package/managed/raw/tooling/direnv/developer-links.ts +124 -51
  113. package/managed/raw/tooling/direnv/devenv.smoo.nix +34 -15
  114. package/managed/raw/tooling/direnv/github-actions-bootstrap.sh +20 -10
  115. package/managed/raw/tooling/direnv/installed-bun-links.ts +7 -6
  116. package/managed/raw/tooling/direnv/setup-environment.ts +49 -24
  117. package/managed/raw/tooling/direnv/ttsc-env.sh +8 -6
  118. package/managed/raw/tooling/git-hooks/pinned-revisions-served.ts +252 -0
  119. package/managed/raw/tooling/git-hooks/pre-push.sh +34 -32
  120. package/managed/templates/github/actions/cache-node-modules/action.yml +1 -1
  121. package/managed/templates/github/actions/cache-ttsc-plugins/action.yml +12 -11
  122. package/package.json +277 -11
  123. package/runtime/nx-publish/.build-inputs.json +11 -0
  124. package/runtime/nx-publish/cache_adapter.js +45 -0
  125. package/runtime/nx-publish/nx_publish.js +60 -0
  126. package/runtime-input.sh +62 -26
  127. package/src/bin/smoo-nx-go-test-build.ts +83 -0
  128. package/src/bin/smoo-nx-go-test-run.ts +140 -0
  129. package/src/bin/smoo-nx-publish.ts +4 -0
  130. package/src/bounded-test-policy.ts +9 -8
  131. package/src/cargo-retention-hook.ts +16 -10
  132. package/src/cargo-workspace.ts +12 -24
  133. package/src/cross-check-policy.ts +2 -2
  134. package/src/deploy-policy.ts +11 -0
  135. package/src/eslint-file-set.ts +4 -1
  136. package/src/eslint-sources.ts +134 -0
  137. package/src/executors/all-verdicts/executor.ts +58 -3
  138. package/src/executors/all-verdicts/schema.json +4 -0
  139. package/src/executors/all-verdicts/schema.ts +14 -0
  140. package/src/executors/bounded-exec/bounds.ts +132 -15
  141. package/src/executors/bounded-exec/executor.ts +329 -34
  142. package/src/executors/bounded-exec/hang-diagnostics.ts +3 -2
  143. package/src/executors/bounded-exec/mbx-pool.ts +158 -17
  144. package/src/executors/bounded-exec/mbx-queue.ts +170 -0
  145. package/src/executors/bounded-exec/progress.ts +171 -18
  146. package/src/executors/bounded-exec/runner-sizing.ts +73 -7
  147. package/src/executors/bounded-exec/runtime-pin.ts +1 -1
  148. package/src/executors/bounded-exec/test-result-writer.ts +152 -0
  149. package/src/executors/bounded-exec/test-results.ts +39 -0
  150. package/src/executors/bounded-exec/verdict.ts +115 -5
  151. package/src/executors/wrangler-deploy/deploy-hash.ts +15 -0
  152. package/src/executors/wrangler-deploy/executor.ts +63 -0
  153. package/src/executors/wrangler-deploy/hasher.ts +111 -0
  154. package/src/executors/wrangler-deploy/schema.json +16 -0
  155. package/src/executors/wrangler-deploy/schema.ts +4 -0
  156. package/src/go-tests.ts +67 -0
  157. package/src/index.ts +368 -323
  158. package/src/managed-files/files.ts +5 -0
  159. package/src/nx-publish.ts +157 -0
  160. package/src/process-group.ts +2 -2
  161. package/src/runtime-input-policy.ts +4 -4
  162. package/src/test-timings.ts +72 -14
  163. package/src/tool-bins.ts +13 -9
  164. package/src/version-actions.cts +10 -11
  165. package/src/workspace-config-policy.ts +20 -29
  166. package/src/workspace-index.ts +12 -0
  167. package/src/workspace-manifest.ts +3 -3
  168. package/test-timings.json +131 -125
  169. package/dist/executors/clean-outputs/executor.d.ts +0 -26
  170. package/dist/executors/clean-outputs/executor.d.ts.map +0 -1
  171. package/dist/executors/clean-outputs/executor.js +0 -83
  172. package/dist/executors/clean-outputs/schema.d.ts +0 -4
  173. package/dist/executors/clean-outputs/schema.d.ts.map +0 -1
  174. package/src/executors/clean-outputs/executor.ts +0 -131
  175. package/src/executors/clean-outputs/schema.json +0 -15
  176. package/src/executors/clean-outputs/schema.ts +0 -3
  177. /package/dist/executors/{clean-outputs → wrangler-deploy}/schema.js +0 -0
@@ -24,6 +24,14 @@
24
24
  * `globalStore`, each .bun entry is itself a link into the shared install
25
25
  * cache, outside every checkout.
26
26
  *
27
+ * A link brings its package's bins. Bun links each installed package's
28
+ * declared bins into its tree's node_modules/.bin through the alias, and a
29
+ * link leaves the .bin the install made: the installed version's bin set.
30
+ * After links apply and after every install, each live link's declared bins
31
+ * point through its alias as an install of the linked version would, and the
32
+ * entries into that alias for bins it no longer declares are removed
33
+ * (refreshDeveloperBins).
34
+ *
27
35
  * Unlinking a package means removing its link, and the next install puts the
28
36
  * lockfile's version there. A dangling link is removed before the install,
29
37
  * with a warning. A link whose target this process may not read (EPERM in a
@@ -231,6 +239,7 @@ export async function keepDeveloperLinks<T>(
231
239
  if (succeeded && recorded.size > 0 && process.env.GITHUB_ACTIONS !== 'true') {
232
240
  applyDeclaredLinks(root, await planDeclaredLinks(root));
233
241
  }
242
+ refreshDeveloperBins(root);
234
243
  if (options !== undefined || (succeeded && undeclared.size > 0)) {
235
244
  reportDeveloperLinks(root);
236
245
  } else {
@@ -274,6 +283,81 @@ function packageName(link: { readonly path: string }): string {
274
283
  return link.path.slice(link.path.lastIndexOf('node_modules/') + 'node_modules/'.length);
275
284
  }
276
285
 
286
+ /** The node_modules tree a link sits directly in, relative to the root: its path up to its last node_modules. */
287
+ function linkTree(link: { readonly path: string }): string {
288
+ return link.path.slice(0, link.path.lastIndexOf('node_modules/') + 'node_modules'.length);
289
+ }
290
+
291
+ /**
292
+ * The bins a manifest declares, by name to the package-relative file: `bin` as an object, or as one string named
293
+ * for the package without its scope, as an install reads it. A name that would leave .bin is not a bin.
294
+ */
295
+ function declaredBins(manifest: unknown, name: string): Map<string, string> {
296
+ const bin = typeof manifest === 'object' && manifest !== null ? Reflect.get(manifest, 'bin') : undefined;
297
+ const entries: [string, unknown][] =
298
+ typeof bin === 'string'
299
+ ? [[name.slice(name.lastIndexOf('/') + 1), bin]]
300
+ : typeof bin === 'object' && bin !== null
301
+ ? Object.entries(bin)
302
+ : [];
303
+ const bins = new Map<string, string>();
304
+ for (const [binName, file] of entries) {
305
+ if (typeof file !== 'string' || binName === '' || binName.includes('/') || binName.startsWith('.')) continue;
306
+ bins.set(binName, path.posix.normalize(file));
307
+ }
308
+ return bins;
309
+ }
310
+
311
+ /**
312
+ * Puts each readable live developer link's bins in its tree's .bin. bun links every installed package's declared
313
+ * bins there, through the package's own alias, and a link that replaces the package leaves the .bin that install
314
+ * made: the installed version's bin set, missing what the linked version added and dangling what it dropped. Each
315
+ * link's declared bins are linked as an install of the linked version would link them, and the entries that point into
316
+ * its alias for bins it no longer declares are removed; another package's entries are never touched. A link this
317
+ * process may not read keeps the bins it has.
318
+ */
319
+ function refreshDeveloperBins(root: string): void {
320
+ const { live, unreadable } = findDeveloperLinks(root);
321
+ const blocked = new Set(unreadable.map((link) => link.path));
322
+ const changed: string[] = [];
323
+ for (const link of live) {
324
+ if (blocked.has(link.path)) continue;
325
+ let manifest: unknown;
326
+ try {
327
+ manifest = JSON.parse(readFileSync(path.join(root, link.path, 'package.json'), 'utf8'));
328
+ } catch (error) {
329
+ if (error instanceof Error && 'code' in error && error.code === 'ENOENT') continue;
330
+ throw error;
331
+ }
332
+ const binDirectory = path.join(root, linkTree(link), '.bin');
333
+ const alias = path.relative(binDirectory, path.join(root, link.path)).split(path.sep).join('/');
334
+ const wanted = new Map(
335
+ [...declaredBins(manifest, packageName(link))].map(([name, file]) => [name, path.posix.join(alias, file)]),
336
+ );
337
+ for (const entry of directoryEntries(binDirectory)) {
338
+ if (!entry.isSymbolicLink()) continue;
339
+ const at = path.join(binDirectory, entry.name);
340
+ const target = readlinkSync(at);
341
+ if (target.startsWith(`${alias}/`) && wanted.get(entry.name) !== target) {
342
+ rmSync(at, { force: true });
343
+ if (!wanted.has(entry.name)) changed.push(`-${entry.name}`);
344
+ }
345
+ }
346
+ for (const [name, target] of wanted) {
347
+ const at = path.join(binDirectory, name);
348
+ if (lstatSync(at, { throwIfNoEntry: false })?.isSymbolicLink() && readlinkSync(at) === target) continue;
349
+ mkdirSync(binDirectory, { recursive: true });
350
+ // Rename replaces whatever the install left at the name in one step.
351
+ const staged = path.join(binDirectory, `.${name}.developer-link-${process.pid}`);
352
+ rmSync(staged, { force: true });
353
+ symlinkSync(target, staged);
354
+ renameSync(staged, at);
355
+ changed.push(name);
356
+ }
357
+ }
358
+ if (changed.length > 0) console.error(`linked developer-link bins: ${[...new Set(changed)].join(', ')}`);
359
+ }
360
+
277
361
  /** A package linked from many members is named once, with its count; each unreadable link is named on its own. */
278
362
  function describeDeveloperLinks(root: string, { live, unreadable }: Omit<DeveloperLinks, 'dangling'>): void {
279
363
  for (const link of unreadable) {
@@ -446,6 +530,9 @@ export interface DeclaredLinksPlan {
446
530
  * binding it inherited from the main checkout, or reach through a redirected or
447
531
  * escaping path. Resolving a snapshot may capture one (linked-snapshots.ts),
448
532
  * which writes only the snapshot store.
533
+ * A throw is a refusal. Shell entry fails on it: once the tasks have run, the
534
+ * enterShell prologue plans again (setup-environment.ts, `--links --refusal`),
535
+ * so a refusal is read from the providers at that entry and none is kept.
449
536
  */
450
537
  export async function planDeclaredLinks(root: string): Promise<DeclaredLinksPlan> {
451
538
  const declared = readDeclaredLinks(root);
@@ -659,7 +746,10 @@ export function applyDeclaredLinks(root: string, plan: DeclaredLinksPlan): void
659
746
  break;
660
747
  }
661
748
  }
662
- if (plan.changes.length === 0) return;
749
+ if (plan.changes.length === 0) {
750
+ refreshDeveloperBins(root);
751
+ return;
752
+ }
663
753
  const declared = new Map(readDeclaredLinks(root).map((link) => [link.name, link.directory]));
664
754
  const recorded = readDeclaredRecord(root);
665
755
  const counts = new Map<string, number>();
@@ -681,6 +771,7 @@ export function applyDeclaredLinks(root: string, plan: DeclaredLinksPlan): void
681
771
  const entries = [...counts].map(([named, count]) => (count === 1 ? named : `${named} (${count} links)`));
682
772
  console.error(`linked declared packages to local checkouts: ${entries.join(', ')}`);
683
773
  }
774
+ refreshDeveloperBins(root);
684
775
  }
685
776
 
686
777
  /**
@@ -768,10 +859,11 @@ function unavailableReason(target: string): string | null {
768
859
  }
769
860
 
770
861
  /**
771
- * A build unit of a linked package that does not describe its current sources: what an alias to the live checkout
772
- * would actually run. A unit with an input record is judged by content: one of its inputs has other bytes than the
773
- * build read, was removed, or was added since. A unit without one is judged by modification time (`builtAt` is null
774
- * for a published unit that was never built), which also refuses a file rewritten with its own bytes.
862
+ * A build unit of a linked package that does not describe its current sources, or cannot be shown to: what an alias
863
+ * to the live checkout would actually run. A unit with an input record is judged by content: one of its inputs has
864
+ * other bytes than the build read, was removed, or was added since. A unit with outputs but no record is
865
+ * `unrecorded`: nothing says which bytes built it, and modification times cannot tell a rewrite with the same bytes (a
866
+ * rebase, a branch switch, a stash) from a change. A published unit with no outputs was never built.
775
867
  */
776
868
  export type StaleBuild = {
777
869
  readonly packageName: string;
@@ -782,11 +874,8 @@ export type StaleBuild = {
782
874
  readonly workspaceRoot: string;
783
875
  } & (
784
876
  | { readonly basis: 'recorded'; readonly input: string; readonly change: 'changed' | 'removed' | 'added' }
785
- | {
786
- readonly basis: 'modification-time';
787
- readonly builtAt: { readonly path: string; readonly time: Date } | null;
788
- readonly newestInput: { readonly path: string; readonly time: Date };
789
- }
877
+ | { readonly basis: 'unrecorded'; readonly output: string }
878
+ | { readonly basis: 'unbuilt' }
790
879
  );
791
880
 
792
881
  /**
@@ -940,25 +1029,24 @@ function cachedBuildInputRecords(directory: string): string[] {
940
1029
  * TypeScript emit's `outDir` is an independent boundary and accepts a standalone bootstrap's record without a producer,
941
1030
  * so an enclosing old layout cannot hide it. Shell entry starts no Nx graph and normalizes no output declarations.
942
1031
  *
943
- * Outputs no record covers fall back to modification time, per unit, so a `.md` edit or a Rust change cannot make a
944
- * TypeScript build stale:
1032
+ * Outputs no record covers are grouped into units, so the refusal names what builds them:
945
1033
  *
946
1034
  * - the TypeScript project `tsconfig.lib.json` builds: the published, untracked files under its `outDir` less build
947
- * info, read from the tracked files its `include` matches less its `exclude`, and the config itself;
948
- * - each target the package manifest's `nx.targets` declares with outputs among those files: its declared file
949
- * inputs (`{projectRoot}` and `{workspaceRoot}` globs, `!` negations; named and runtime inputs are not files);
950
- * - every other published, untracked file, read from the package's tracked files less documentation and tests.
1035
+ * info;
1036
+ * - each target the package manifest's `nx.targets` declares with outputs among those files;
1037
+ * - every other published, untracked file.
951
1038
  *
952
- * A fallback unit was built when its newest output was written. Not its oldest: an emit that leaves unchanged outputs
953
- * in place keeps their old times. Not a `.tsbuildinfo`: the build emits with `incremental: false`, so one under
954
- * `outDir` is a leftover no build rewrites. The fallback cannot tell a rewrite with the same bytes from a change, and
955
- * its refusal says so.
1039
+ * Such a unit is refused as unrecorded, whatever the times of its files: it cannot be judged by content, and a
1040
+ * modification time cannot tell a rewrite with the same bytes from a change, while a cached rebuild that finds its
1041
+ * outputs current leaves their times as they were. Its producer has to write a record. A unit with no tracked input
1042
+ * is not judged, and the TypeScript emit's unit, which the package publishes, is refused as never built when it has no
1043
+ * outputs. A `.tsbuildinfo` belongs to no unit: the build emits with `incremental: false`, so one under `outDir` is a
1044
+ * leftover no build rewrites.
956
1045
  *
957
1046
  * Output directories built for another host (`darwin-x64` on an arm64 Mac) are skipped: nothing here runs them.
958
1047
  * The remedy names the receipt's exact producer target and configuration; `build` need not reach a native producer.
959
- * Missing-record published units retain their timestamp fallback and package `build` remedy. A cached build that
960
- * leaves a recorded unit stale is a cache-key defect (its inputs miss something its outputs depend on), never a reason
961
- * to skip the cache.
1048
+ * A cached build that leaves a recorded unit stale is a cache-key defect (its inputs miss something its outputs
1049
+ * depend on), never a reason to skip the cache.
962
1050
  */
963
1051
  export function staleBuilds(packageName: string, directory: string): StaleBuild[] {
964
1052
  const manifest: unknown = JSON.parse(readFileSync(path.join(directory, 'package.json'), 'utf8'));
@@ -1112,7 +1200,10 @@ export function staleBuilds(packageName: string, directory: string): StaleBuild[
1112
1200
  const value = Reflect.get(definition, key);
1113
1201
  return Array.isArray(value) ? value.filter((entry): entry is string => typeof entry === 'string') : [];
1114
1202
  };
1115
- const outputs = claim(strings('outputs').flatMap((output) => under(path.normalize(resolve(output)))));
1203
+ // A declared output names a directory with or without its trailing slash; the files under it are the same.
1204
+ const outputs = claim(
1205
+ strings('outputs').flatMap((output) => under(path.normalize(resolve(output)).replace(/\/+$/, ''))),
1206
+ );
1116
1207
  if (outputs.length === 0) continue;
1117
1208
  const fileInputs = strings('inputs').filter(
1118
1209
  (input) => input.includes('{projectRoot}') || input.includes('{workspaceRoot}'),
@@ -1143,32 +1234,15 @@ export function staleBuilds(packageName: string, directory: string): StaleBuild[
1143
1234
  expected: false,
1144
1235
  });
1145
1236
 
1146
- // A tracked input deleted in the working tree has no time; the files that remain decide.
1147
- const modified = (file: string) => statSync(path.join(workspaceRoot, file), { throwIfNoEntry: false })?.mtime;
1148
1237
  for (const unit of units) {
1149
1238
  if (unit.inputs.length === 0) continue;
1150
- let newestInput = { path: unit.inputs[0] ?? '', time: new Date(0) };
1151
- for (const input of unit.inputs) {
1152
- const time = modified(input);
1153
- if (time !== undefined && time > newestInput.time) newestInput = { path: input, time };
1154
- }
1155
- let builtAt: { readonly path: string; readonly time: Date } | null = null;
1156
- for (const output of unit.outputs) {
1157
- const time = modified(output);
1158
- if (time !== undefined && (builtAt === null || time > builtAt.time)) builtAt = { path: output, time };
1239
+ const output = unit.outputs[0];
1240
+ if (output === undefined) {
1241
+ if (unit.expected)
1242
+ stale.push({ basis: 'unbuilt', packageName, directory, unit: unit.label, rebuild, workspaceRoot });
1243
+ continue;
1159
1244
  }
1160
- if (builtAt === null && !unit.expected) continue;
1161
- if (builtAt !== null && newestInput.time <= builtAt.time) continue;
1162
- stale.push({
1163
- basis: 'modification-time',
1164
- packageName,
1165
- directory,
1166
- unit: unit.label,
1167
- builtAt,
1168
- newestInput,
1169
- rebuild,
1170
- workspaceRoot,
1171
- });
1245
+ stale.push({ basis: 'unrecorded', packageName, directory, unit: unit.label, output, rebuild, workspaceRoot });
1172
1246
  }
1173
1247
  return stale;
1174
1248
  }
@@ -1185,10 +1259,9 @@ export function staleBuildsRefusal(stale: readonly StaleBuild[]): string {
1185
1259
  : 'was added since the build';
1186
1260
  return ` - ${build.packageName}: ${build.unit} is stale: input ${build.input} ${how} (its ${BUILD_INPUTS_FILE})`;
1187
1261
  }
1188
- const fallback = `no ${BUILD_INPUTS_FILE}, so judged by modification time, where a file rewritten with its own bytes also counts`;
1189
- return build.builtAt === null
1190
- ? ` - ${build.packageName}: ${build.unit} was never built (newest input ${build.newestInput.path} at ${build.newestInput.time.toISOString()}; ${fallback})`
1191
- : ` - ${build.packageName}: ${build.unit} was built at ${build.builtAt.time.toISOString()} (${build.builtAt.path}), but ${build.newestInput.path} changed at ${build.newestInput.time.toISOString()} (${fallback})`;
1262
+ return build.basis === 'unbuilt'
1263
+ ? ` - ${build.packageName}: ${build.unit} was never built`
1264
+ : ` - ${build.packageName}: ${build.unit} records no inputs (no ${BUILD_INPUTS_FILE} covers ${build.output}), so whether it describes its sources cannot be told: modification times would also count a file rewritten with its own bytes; its producer must write ${BUILD_INPUTS_FILE} beside its outputs`;
1192
1265
  });
1193
1266
  const commands = [...new Set(stale.map((build) => `cd ${JSON.stringify(build.workspaceRoot)} && ${build.rebuild}`))];
1194
1267
  return `refusing developer link(s) to a live checkout whose build does not describe its sources; the link would run the old build:\n${lines.join('\n')}\nRebuild: ${commands.join('; ')}`;
@@ -487,6 +487,11 @@ in {
487
487
  # digest under the install lock, so two shells entering at once install once.
488
488
  # The scripts themselves are inputs: a new setup-environment.ts reruns.
489
489
  #
490
+ # A uv project also has live installed state: a copied environment can hold
491
+ # an absolute editable mapping while every input digest is unchanged. Its
492
+ # status joins the installer's own input stamps and relocation witness;
493
+ # non-Python projects retain the input-only task cache below.
494
+ #
490
495
  # smoo:cargo-fetch establishes what the Nx plugin's offline `cargo metadata
491
496
  # --locked` needs: every Cargo workspace's locked packages in CARGO_HOME. Its
492
497
  # stamps live in smoo's user cache and count only while CARGO_HOME names the
@@ -515,17 +520,25 @@ in {
515
520
  # links its declaration does not describe runs another build than it says
516
521
  # (a live checkout whose build is stale, with no sealed snapshot to serve
517
522
  # instead), and the repair is in the provider checkout, not in this shell.
518
- # The refused exec leaves node_modules/.smoo-links-refused, which the
519
- # prologue below says and fails on; the next `--links` run that finds the
520
- # links current removes it. CI runs both with `devenv tasks run`, which
521
- # does fail; setup-environment.ts is strict there.
523
+ # So the prologue below asks `setup-environment.ts --links --refusal` once
524
+ # the tasks have run, and fails entry with the planner's reason: the answer
525
+ # is read from the providers at that entry, so the entry after the provider
526
+ # is rebuilt goes in with no step between, and nothing of a refusal outlives
527
+ # it. devenv also evaluates the whole enterShell script once before it runs
528
+ # any task, only to capture the environment (it sets DEVENV_SKIP_TASKS), and
529
+ # a script that fails in that pass stops the tasks that would repair: it
530
+ # asks nothing there, and a manifest that declares no links starts no
531
+ # process. CI runs both with `devenv tasks run`, which does fail;
532
+ # setup-environment.ts is strict there.
522
533
  tasks = let
523
534
  setup = ''bun "$DEVENV_ROOT/setup-environment.ts"'';
535
+ install = setup + lib.optionalString uvProject " --python ${python.package.interpreter}";
524
536
  in {
525
537
  "smoo:install" = {
526
538
  description = "bun install / uv sync when what they read changed";
527
- exec = setup + lib.optionalString uvProject " --python ${python.package.interpreter}";
528
- execIfModified = [
539
+ exec = install;
540
+ status = lib.mkIf uvProject (install + " --check");
541
+ execIfModified = lib.optionals (!uvProject) [
529
542
  "../../package.json"
530
543
  "../../bun.lock"
531
544
  "../../bun.lockb"
@@ -569,7 +582,9 @@ in {
569
582
  # Prologue, in order:
570
583
  #
571
584
  # 1. The devenv wrapper runs from tooling/direnv; every later step expects the
572
- # workspace root.
585
+ # workspace root. Once the tasks have run, the planner's refusal of the
586
+ # declared links (smoo:developer-links above) fails entry before any
587
+ # later step.
573
588
  # 2. PATH order is most-specific → least-specific, the same list the git hooks
574
589
  # use, so a hook and a shell resolve one binary the same way. The Rust
575
590
  # toolchain's store bin then goes ahead of all of it (rustToolchainBin
@@ -577,8 +592,10 @@ in {
577
592
  # owns.
578
593
  # 3. ttsc drives the native TypeScript 7 binary while Nx imports the TypeScript
579
594
  # 6 API, so the two must be named separately.
580
- # 4. ttsc caches in the checkout's .cache/ttsc (the path the CI ttsc-plugin
581
- # cache restores), its Go build cache in a directory of its own so
595
+ # 4. ttsc caches its plugin binaries in the checkout's .cache/ttsc-plugins (the
596
+ # path the CI ttsc-plugin cache restores, and the output a repository's
597
+ # plugin build target declares), its Go build cache in .cache/ttsc/go-build,
598
+ # a directory of its own outside that output, so
582
599
  # `ttsc clean` can reclaim it: ttsc never deletes a GOCACHE it did not
583
600
  # resolve itself, and sharing GOCACHE once left 35G nothing could empty.
584
601
  # GOFLAGS carries -trimpath, Go's stable way to keep absolute build paths
@@ -658,12 +675,11 @@ in {
658
675
  # they run.
659
676
  (lib.mkBefore ''
660
677
  cd "$DEVENV_ROOT/../.."
661
- # smoo:developer-links refused the declared links (tasks above): fail
662
- # shell entry with its reason rather than run on links it refused.
663
- if [ -f node_modules/.smoo-links-refused ]; then
664
- echo "smoo:developer-links refused this checkout's declared links; shell entry fails until they are current:" >&2
665
- cat node_modules/.smoo-links-refused >&2
666
- exit 1
678
+ # smoo:developer-links (tasks above) refusing the declared links fails
679
+ # shell entry with the planner's reason, asked of the providers now. Only
680
+ # the entry proper asks, and only a manifest that declares links.
681
+ if [ -z "''${DEVENV_SKIP_TASKS:-}" ] && grep -qF developerLinks package.json; then
682
+ bun "$DEVENV_ROOT/setup-environment.ts" --links --refusal || exit $?
667
683
  fi
668
684
  # A bare assignment: export's status would hide repo-path's refusal of a
669
685
  # cowshed workspace it could not serve, and the shell would enter with an
@@ -694,6 +710,9 @@ in {
694
710
  unset GOROOT
695
711
  ${lib.optionalString uvProject ''
696
712
  if [ -f pyproject.toml ]; then
713
+ # The installer above owns sync and rewrites editable mappings after it.
714
+ # A reader's uv run must not rewrite them to this checkout's absolute path.
715
+ export UV_NO_SYNC=1
697
716
  export VIRTUAL_ENV="$UV_PROJECT_ENVIRONMENT"
698
717
  export PATH="$VIRTUAL_ENV/bin:$PATH"
699
718
  fi
@@ -11,11 +11,7 @@ repo_root="$(cd "$script_dir/../.." && pwd)"
11
11
  # A separate name on purpose: assigning to TTSC_CACHE_DIR itself would mutate
12
12
  # the (possibly exported) environment that persist_devenv_environment later
13
13
  # fingerprints as the pre-shell baseline.
14
- ttsc_cache_dir_default="${TTSC_CACHE_DIR:-$repo_root/.cache/ttsc}"
15
-
16
- add_repo_paths() {
17
- "$repo_root/tooling/direnv/repo-path" --github-path
18
- }
14
+ ttsc_cache_dir_default="${TTSC_CACHE_DIR:-$repo_root/.cache/ttsc-plugins}"
19
15
 
20
16
  # The CLI that evaluates the shell must be the commit whose modules the shell is
21
17
  # locked to, so this installs the commit devenv.lock's `devenv` node names and
@@ -171,9 +167,6 @@ build_devenv_shell() {
171
167
  if [ "${SMOO_ROOT_BUILD_INPUTS:-false}" = true ]; then
172
168
  root_build_inputs "$since"
173
169
  fi
174
- # Add repo-local tools only after the shell exists; cleanup steps use an
175
- # explicit PATH because failures before this point must still refresh caches.
176
- add_repo_paths
177
170
  }
178
171
 
179
172
  # The store cache's post phase collects garbage down to the live roots before
@@ -218,6 +211,8 @@ root_build_inputs() {
218
211
  persist_devenv_environment() {
219
212
  [ -n "${GITHUB_ENV:-}" ] || return 0
220
213
  local name entry value captured bkey persisted=""
214
+ local i
215
+ local -a path_entries
221
216
  # Baseline: this step's own exported variables, before shell influence.
222
217
  # Stored as smoo_baseline_<name> pseudo-map entries (printf -v), not a
223
218
  # bash-4 associative array — macOS runners still ship bash 3.2. compgen -e
@@ -238,8 +233,23 @@ persist_devenv_environment() {
238
233
  name="${entry%%=*}"
239
234
  value="${entry#*=}"
240
235
  case "$name" in
241
- # The runner step owns these; PATH persistence is add_repo_paths' job.
242
- PATH | PWD | OLDPWD | SHLVL | SHELL | HOME | USER | LOGNAME | HOSTNAME | TERM | TMPDIR | TMP | TEMP | _ | PS1) continue ;;
236
+ PATH)
237
+ # The profile alone is not the shell: mbx removes its Cargo shim's
238
+ # directory, which also holds the profile's linker. Keep the individual
239
+ # package bins the shell already selected, not a second tool list.
240
+ path_entries=()
241
+ while [[ "$value" == *:* ]]; do
242
+ path_entries+=("${value%%:*}")
243
+ value="${value#*:}"
244
+ done
245
+ path_entries+=("$value")
246
+ # GITHUB_PATH prepends; reverse to retain the shell's search order.
247
+ for (( i=${#path_entries[@]}-1; i>=0; i-- )); do
248
+ printf '%s\n' "${path_entries[i]}"
249
+ done >> "$GITHUB_PATH"
250
+ continue ;;
251
+ # The runner step owns these.
252
+ PWD | OLDPWD | SHLVL | SHELL | HOME | USER | LOGNAME | HOSTNAME | TERM | TMPDIR | TMP | TEMP | _ | PS1) continue ;;
243
253
  GITHUB_* | RUNNER_* | ACTIONS_* | CI) continue ;;
244
254
  # Shell-session bookkeeping, meaningful only inside the shell itself.
245
255
  DIRENV_* | DEVENV_* | NIX_* | BASH* | XDG_* | IN_NIX_SHELL | SMOO_ENV_CAPTURE_OUT) continue ;;
@@ -281,12 +281,13 @@ function referencedStoreEntries(
281
281
 
282
282
  /**
283
283
  * The store links the installed tree reaches whose target in Bun's install cache is gone. Under
284
- * `globalStore` each node_modules/.bun/<entry> is a link into that cache, and one that dangles
285
- * names a cache entry that no longer exists: the install is out of date, as it is while a
286
- * developer link dangles, and `bun install` links the entry again (measured, Bun 1.4.3). A
287
- * dangling variant nothing live reaches is superseded garbage the install leaves in place (see
288
- * verifyInstalledBunLinks), so it never makes the install stale: no install would change it.
289
- * The closure is walked only when some store link dangles, so `members` is asked for only then.
284
+ * `globalStore` a node_modules/.bun/<entry> is a link into that cache or a directory of its own (Bun keeps
285
+ * some packages in the project, most of them peer variants `<name>@<version>+<hash>`), and only a link can
286
+ * dangle: one that does names a cache entry that no longer exists, the install is out of date, as it is
287
+ * while a developer link dangles, and `bun install` links the entry again (measured, Bun 1.4.3 and 1.4.4).
288
+ * A dangling variant nothing live reaches is superseded garbage the install leaves in place (see
289
+ * verifyInstalledBunLinks), so it never makes the install stale: no install would change it. The closure
290
+ * is walked only when some store link dangles, so `members` is asked for only then.
290
291
  */
291
292
  export function danglingStoreLinks(root: string, members: () => readonly string[]): string[] {
292
293
  const store = path.join(root, 'node_modules', '.bun');
@@ -212,6 +212,9 @@ const POST_COMMIT_BLOCK = [
212
212
  // points the packages `smoo.developerLinks` declares at their local checkouts.
213
213
  // devenv's smoo:developer-links task uses `--links --check` as its status:
214
214
  // links can change without any smoo:install input changing.
215
+ // `--links --refusal` is the question the managed enterShell prologue asks once the tasks have run (devenv.smoo.nix):
216
+ // silent and exit 0 unless the planner refuses the declared links now, then its reason and exit 1. It reads the
217
+ // providers' state at that entry, and nothing is kept for the next.
215
218
  // Declared above the bootstrap block for the same hoisting reason as above.
216
219
  const { values: flags } = parseArgs({
217
220
  options: {
@@ -219,15 +222,11 @@ const { values: flags } = parseArgs({
219
222
  cargo: { type: 'boolean' },
220
223
  links: { type: 'boolean' },
221
224
  check: { type: 'boolean' },
225
+ refusal: { type: 'boolean' },
222
226
  'repair-missing-payload': { type: 'string' },
223
227
  },
224
228
  });
225
229
  const cargoMode = flags.cargo === true;
226
- // What a `--links` exec that refused leaves for the enterShell prologue (devenv.smoo.nix), which then fails shell entry
227
- // with its reason: a shell must not run on links the declaration does not describe (a live checkout whose build is
228
- // stale with no sealed snapshot to serve, a declaration smoo refuses), and the repair is in the provider checkout, not
229
- // in this shell. Every `--links` run that finds the links current, or makes them so, removes it.
230
- const linksRefusal = path.join(projectRoot, 'node_modules', '.smoo-links-refused');
231
230
 
232
231
  // The Nx plugin's test for a Cargo workspace root manifest (CARGO_WORKSPACE_PATTERN), which
233
232
  // cargoWorkspaces applies during the bootstrap block; declared above it for the same reason.
@@ -237,6 +236,11 @@ const CARGO_WORKSPACE = /^\s*\[workspace\]/m;
237
236
  process.chdir(projectRoot);
238
237
 
239
238
  try {
239
+ if (flags.refusal === true && (flags.links !== true || flags.check === true)) {
240
+ reportSetupFailure(
241
+ new Error("--refusal is shell entry's question about the declared links: it takes --links and no --check"),
242
+ );
243
+ }
240
244
  const requestedPayload = flags['repair-missing-payload'];
241
245
  if (requestedPayload !== undefined) {
242
246
  if (flags.links === true || flags.check === true || cargoMode || flags.python !== undefined) {
@@ -251,6 +255,11 @@ try {
251
255
  if (process.env.GITHUB_ACTIONS === 'true') {
252
256
  process.exit(0);
253
257
  }
258
+ if (flags.refusal === true) {
259
+ // Asked once the tasks have run, so a refusal here is one they could not repair; it reaches the catch below.
260
+ await planDeclaredLinks(projectRoot);
261
+ process.exit(0);
262
+ }
254
263
  if (flags.check === true) {
255
264
  const plan = await planDeclaredLinks(projectRoot);
256
265
  // A refused or unclaimed snapshot is current only when said: the exec that follows names its cause.
@@ -258,12 +267,13 @@ try {
258
267
  plan.changes.length === 0 && plan.unavailable.every((unavailable) => unavailable.kind === 'absent');
259
268
  // A stale pin is informational, not a stale install: say it even when devenv skips the exec.
260
269
  if (current && plan.reports.length > 0) applyDeclaredLinks(projectRoot, plan);
261
- const linked =
270
+ process.exit(
262
271
  current &&
263
- !hasStaleDeveloperLinks(projectRoot, ['nx']) &&
264
- danglingStoreLinks(projectRoot, () => workspaceMemberModules(projectRoot)).length === 0;
265
- if (linked) rmSync(linksRefusal, { force: true });
266
- process.exit(linked ? 0 : 1);
272
+ !hasStaleDeveloperLinks(projectRoot, ['nx']) &&
273
+ danglingStoreLinks(projectRoot, () => workspaceMemberModules(projectRoot)).length === 0
274
+ ? 0
275
+ : 1,
276
+ );
267
277
  }
268
278
  // Planning reads, apart from a snapshot it may capture, which seals by an atomic rename (linked-snapshots.ts),
269
279
  // and applying a plan with no changes only says what this machine cannot honour. So an entry with nothing to
@@ -276,7 +286,6 @@ try {
276
286
  !hasStaleDeveloperLinks(projectRoot, ['nx'])
277
287
  ) {
278
288
  applyDeclaredLinks(projectRoot, plan);
279
- rmSync(linksRefusal, { force: true });
280
289
  process.exit(0);
281
290
  }
282
291
  await withInstallLock(async () => {
@@ -295,7 +304,6 @@ try {
295
304
  }
296
305
  applyDeclaredLinks(projectRoot, await planDeclaredLinks(projectRoot));
297
306
  });
298
- rmSync(linksRefusal, { force: true });
299
307
  process.exit(0);
300
308
  }
301
309
  // Bootstrap only: install deps + wire local git hooks/config.
@@ -303,10 +311,14 @@ try {
303
311
  // and package resolution/Typia transforms are not available yet.
304
312
  const bunInputs = bunInstallInputs();
305
313
  const cargoFetches = cargoMode ? cargoWorkspaces(bunInputs).map(cargoFetcher) : [];
306
- if (flags.check === true) {
314
+ if (flags.check === true && cargoMode) {
307
315
  process.exit(cargoFetches.every((fetch) => fetch.isCurrent()) ? 0 : 1);
308
316
  }
309
317
  const uvInputs = cargoMode ? [] : uvSyncInputs();
318
+ if (flags.check === true) {
319
+ const uv = uvInstaller(uvInputs, { locked: process.env.GITHUB_ACTIONS === 'true' });
320
+ process.exit(bunInstaller(bunInputs).isCurrent() && (uv === null || uv.isCurrent()) ? 0 : 1);
321
+ }
310
322
  // A CI runner is GitHub Actions or Forgejo Actions, which mirrors every FORGEJO_*
311
323
  // variable as GITHUB_*. Not `CI`: agent harnesses set CI=true on every command
312
324
  // they run, and this branch installs unconditionally.
@@ -416,10 +428,11 @@ try {
416
428
  }
417
429
  }
418
430
  } catch (error) {
419
- // Thrown out of a `--links` exec, an error is the links refused (an install failure reports itself and exits).
420
- if (flags.links === true && flags.check !== true) {
421
- mkdirSync(path.dirname(linksRefusal), { recursive: true });
422
- writeFileSync(linksRefusal, `${error instanceof Error ? error.message : String(error)}\n`);
431
+ // Thrown out of the refusal question, an error is the planner refusing the declared links.
432
+ if (flags.refusal === true) {
433
+ console.error(
434
+ "smoo:developer-links refuses this checkout's declared links; shell entry fails while the planner refuses them:",
435
+ );
423
436
  }
424
437
  reportSetupFailure(error);
425
438
  }
@@ -1007,9 +1020,11 @@ function bunInstaller(inputs: readonly string[]): Installer {
1007
1020
  * decides, because an outer shell's UV_PROJECT_ENVIRONMENT leaks into a
1008
1021
  * checkout that syncs nothing.
1009
1022
  *
1010
- * Every package of the workspace and every dependency group is installed,
1011
- * which is what `bun install` does for the JavaScript half: a development
1012
- * shell carries the whole workspace. CI adds `--locked`, the counterpart of
1023
+ * Every package of the workspace, every dependency group and every optional
1024
+ * extra is installed, which is what `bun install` does for the JavaScript
1025
+ * half: a development shell carries the whole workspace. Readers run under
1026
+ * UV_NO_SYNC, so a target's `uv run --extra <name>` finds the extra only
1027
+ * because this sync installed it. CI adds `--locked`, the counterpart of
1013
1028
  * `--frozen-lockfile`.
1014
1029
  *
1015
1030
  * Like node_modules, the environment is location-independent, so a copy of
@@ -1047,7 +1062,15 @@ function uvInstaller(inputs: readonly string[], options: { locked: boolean }): I
1047
1062
  );
1048
1063
  }
1049
1064
  const stampPath = path.join(environment, '.smoo-sync');
1050
- const argv = ['sync', '--python', python, '--all-packages', '--all-groups', ...(options.locked ? ['--locked'] : [])];
1065
+ const argv = [
1066
+ 'sync',
1067
+ '--python',
1068
+ python,
1069
+ '--all-packages',
1070
+ '--all-groups',
1071
+ '--all-extras',
1072
+ ...(options.locked ? ['--locked'] : []),
1073
+ ];
1051
1074
  const create = ['venv', '--relocatable', '--python', python, environment];
1052
1075
  const uv = Bun.which('uv');
1053
1076
  const identity = [
@@ -1063,9 +1086,11 @@ function uvInstaller(inputs: readonly string[], options: { locked: boolean }): I
1063
1086
  return stampOk && witnessOk;
1064
1087
  },
1065
1088
  install: async ({ quiet }) => {
1066
- // An inherited VIRTUAL_ENV names some other environment; uv would warn
1067
- // that it does not match the project environment and ignore it.
1068
- const env = Object.fromEntries(Object.entries(process.env).filter(([name]) => name !== 'VIRTUAL_ENV'));
1089
+ // The managed installer is the only environment writer. An inherited VIRTUAL_ENV names another checkout;
1090
+ // UV_NO_SYNC belongs to reader commands, not to this deliberate sync.
1091
+ const env = Object.fromEntries(
1092
+ Object.entries(process.env).filter(([name]) => name !== 'VIRTUAL_ENV' && name !== 'UV_NO_SYNC'),
1093
+ );
1069
1094
  // Replacement is gated on the same witness currentness uses, not only on the config
1070
1095
  // line: a valid config beside an absolute launcher or .pth would otherwise sync over
1071
1096
  // the escape and stamp it. uv venv refuses a directory that already holds an
@@ -6,15 +6,17 @@
6
6
  #
7
7
  # Exports ttsc's environment for this workspace: TTSC_TSGO_BINARY, the native
8
8
  # TypeScript compiler (ttsc resolves only the unscoped `typescript` package by
9
- # default, which here is the JavaScript compiler API), and TTSC_CACHE_DIR and
10
- # TTSC_GO_CACHE_DIR, where ttsc keeps the plugin binaries it compiles and the
11
- # Go build cache that compiles them.
9
+ # default, which here is the JavaScript compiler API), TTSC_CACHE_DIR, where ttsc
10
+ # keeps the plugin binaries it compiles (<checkout>/.cache/ttsc-plugins, the path
11
+ # a repository's ttsc plugin build target declares as its output), and
12
+ # TTSC_GO_CACHE_DIR, the Go build cache that compiles them
13
+ # (<checkout>/.cache/ttsc/go-build), a byproduct kept outside that output.
12
14
  #
13
15
  # This checkout is the directory the script is sourced from: devenv.smoo.nix's
14
16
  # enterShell enters the workspace root first, and each git hook enters
15
17
  # `git rev-parse --show-toplevel`. Sourced from any other directory, $PWD names
16
18
  # no checkout, and every cache below would land beside that directory instead:
17
- # a shell in HOME would create ~/.cache/ttsc. That directory is refused.
19
+ # a shell in HOME would create ~/.cache/ttsc-plugins. That directory is refused.
18
20
  if [ ! -f "$PWD/tooling/direnv/ttsc-env.sh" ]; then
19
21
  echo "ttsc-env.sh: not a workspace root (no tooling/direnv/ttsc-env.sh): $PWD; source it from the checkout root" >&2
20
22
  return 1
@@ -43,6 +45,6 @@ if [ -f "$PWD/tooling/direnv/typescript-go.nix" ]; then
43
45
  else
44
46
  export TTSC_TSGO_BINARY="$PWD/node_modules/@typescript/native/bin/tsc"
45
47
  fi
46
- export TTSC_CACHE_DIR="${TTSC_CACHE_DIR:-$PWD/.cache/ttsc}"
47
- export TTSC_GO_CACHE_DIR="${TTSC_GO_CACHE_DIR:-$TTSC_CACHE_DIR/go-build}"
48
+ export TTSC_CACHE_DIR="${TTSC_CACHE_DIR:-$PWD/.cache/ttsc-plugins}"
49
+ export TTSC_GO_CACHE_DIR="${TTSC_GO_CACHE_DIR:-$PWD/.cache/ttsc/go-build}"
48
50
  mkdir -p "$TTSC_GO_CACHE_DIR"