warm-worktrees 0.0.0-stage → 0.1.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.
- package/BENCHMARKS.md +179 -0
- package/GUIDE.md +343 -0
- package/LICENSE.md +21 -0
- package/README.md +79 -2
- package/bench/results/adobe.json +1739 -0
- package/bench/results/build-lifecycle.json +1618 -0
- package/bench/results/cache-selection.json +3155 -0
- package/bench/results/cache-tuning.json +1554 -0
- package/bench/results/cargo-cache-scans.json +522 -0
- package/bench/results/cargo-snapshot-storage.json +1068 -0
- package/bench/results/checkout-selection.json +157 -0
- package/bench/results/compiler-seeds.json +634 -0
- package/bench/results/concurrent-publication.json +7999 -0
- package/bench/results/directory-export.json +4501 -0
- package/bench/results/firefox-checkout-control.json +4160 -0
- package/bench/results/four-worktrees.json +594 -0
- package/bench/results/incremental-cache-directories.json +555 -0
- package/bench/results/ninja.json +2133 -0
- package/bench/results/output-delivery.json +719 -0
- package/bench/results/per-checkout-archives.json +7044 -0
- package/bench/results/pool-maintenance.json +447 -0
- package/bench/results/rebuild-latency.json +138 -0
- package/bench/results/seed-scenarios.json +295 -0
- package/bench/results/snapshot-reclamation.json +885 -0
- package/bench/results/snapshot-writers.json +46 -0
- package/bench/results/source-mirror.json +150 -0
- package/bench/results/startup.json +703 -0
- package/bench/results/swift-scenarios.json +173 -0
- package/bench/results/upstream/firefox-ios.json +2395 -0
- package/bench/results/upstream/ripgrep.json +3275 -0
- package/bench/results/upstream/swift-syntax.json +2305 -0
- package/bench/results/upstream/vscode-seeded.json +3181 -0
- package/bench/results/upstream/vscode.json +2121 -0
- package/dist/Commander-LICENSE +22 -0
- package/dist/JSON5-LICENSE +23 -0
- package/dist/Zod-LICENSE +21 -0
- package/dist/benchmark.js +289 -0
- package/dist/cli.js +18337 -0
- package/dist/warm-copy.node +0 -0
- package/docs/assets/worktrees-cargo.png +0 -0
- package/package.json +55 -4
- package/profiles.json5 +82 -0
package/BENCHMARKS.md
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# Warm benchmarks
|
|
2
|
+
|
|
3
|
+
Warm runs your build in a Git worktree of its own called a _build checkout_. We compared building directly in each worktree with letting Warm reuse a checkout as we [switched worktrees](#building-across-worktrees) or [built in several at once](#three-builds-at-once).
|
|
4
|
+
|
|
5
|
+
## Building across worktrees
|
|
6
|
+
|
|
7
|
+
We built from scratch in worktree A and rebuilt twice there, first without changes and then after editing one file. When we switched to B, Warm reused the build checkout from A while the direct build started from scratch. For C we locked the checkout from A so we could measure the cost of opening a new one.
|
|
8
|
+
|
|
9
|
+
All four projects built faster in B through Warm. Opening a checkout for C saved time for SwiftSyntax and ripgrep but took longer for Firefox and VS Code. Rebuilding in A was faster directly for all four projects.
|
|
10
|
+
|
|
11
|
+
| Project | Switch with a free checkout | Switch needing a new checkout | Time for all five vs direct | Final disk use vs direct |
|
|
12
|
+
| --------------- | --------------------------: | ----------------------------: | --------------------------: | -----------------------: |
|
|
13
|
+
| Firefox for iOS | 80.4% less | 3.6% more | 20.7% less | 29.4% less |
|
|
14
|
+
| SwiftSyntax | 76.1% less | 9.2% less | 20.3% less | 36.6% less |
|
|
15
|
+
| ripgrep | 62.4% less | 37.7% less | 20.1% less | 56.2% less |
|
|
16
|
+
| VS Code | 81.9% less | 71.0% more | 23.3% more | 30.9% less |
|
|
17
|
+
|
|
18
|
+
<details>
|
|
19
|
+
<summary>Firefox for iOS</summary>
|
|
20
|
+
|
|
21
|
+
We [built Firefox for the iOS simulator](bench/results/upstream/firefox-ios.json) and configured Warm to keep the Swift files Firefox generates outside DerivedData. Without those files Xcode reran a generator after an unrelated edit.
|
|
22
|
+
|
|
23
|
+
| Build | Direct | Warm | Time vs direct | Direct disk | Warm disk | Disk vs direct |
|
|
24
|
+
| ---------------------------------------- | ------: | ------: | -------------: | ----------: | ----------: | -------------: |
|
|
25
|
+
| Build A from scratch | 173.5 s | 177.4 s | 2.3% more | 2,933.6 MiB | 3,017.4 MiB | 2.9% more |
|
|
26
|
+
| Rebuild A without edits | 21.27 s | 26.57 s | 24.9% more | 3,014.0 MiB | 3,106.8 MiB | 3.1% more |
|
|
27
|
+
| Edit one file in A and rebuild | 32.22 s | 33.63 s | 4.4% more | 3,091.9 MiB | 3,193.2 MiB | 3.3% more |
|
|
28
|
+
| Build B (Warm reuses the build checkout) | 162.7 s | 31.82 s | 80.4% less | 5,943.1 MiB | 3,281.9 MiB | 44.8% less |
|
|
29
|
+
| Build C (Warm creates a build checkout) | 163.4 s | 169.2 s | 3.6% more | 8,790.0 MiB | 6,202.4 MiB | 29.4% less |
|
|
30
|
+
| All five builds | 553.0 s | 438.7 s | 20.7% less | 8,790.0 MiB | 6,202.4 MiB | 29.4% less |
|
|
31
|
+
|
|
32
|
+
</details>
|
|
33
|
+
|
|
34
|
+
<details>
|
|
35
|
+
<summary>SwiftSyntax</summary>
|
|
36
|
+
|
|
37
|
+
We [built SwiftParser](bench/results/upstream/swift-syntax.json) and checked the edited API from a small client linked against it.
|
|
38
|
+
|
|
39
|
+
| Build | Direct | Warm | Time vs direct | Direct disk | Warm disk | Disk vs direct |
|
|
40
|
+
| ---------------------------------------- | ------: | ------: | -------------: | ----------: | --------: | -------------: |
|
|
41
|
+
| Build A from scratch | 14.95 s | 15.24 s | 1.9% more | 208.1 MiB | 210.1 MiB | 1.0% more |
|
|
42
|
+
| Rebuild A without edits | 1.72 s | 2.51 s | 45.6% more | 208.1 MiB | 211.3 MiB | 1.5% more |
|
|
43
|
+
| Edit one file in A and rebuild | 2.82 s | 3.46 s | 22.6% more | 209.2 MiB | 211.6 MiB | 1.1% more |
|
|
44
|
+
| Build B (Warm reuses the build checkout) | 12.69 s | 3.03 s | 76.1% less | 387.2 MiB | 211.8 MiB | 45.3% less |
|
|
45
|
+
| Build C (Warm creates a build checkout) | 12.69 s | 11.52 s | 9.2% less | 565.5 MiB | 358.7 MiB | 36.6% less |
|
|
46
|
+
| All five builds | 44.87 s | 35.75 s | 20.3% less | 565.5 MiB | 358.7 MiB | 36.6% less |
|
|
47
|
+
|
|
48
|
+
</details>
|
|
49
|
+
|
|
50
|
+
<details>
|
|
51
|
+
<summary>ripgrep</summary>
|
|
52
|
+
|
|
53
|
+
We [built ripgrep offline with Cargo](bench/results/upstream/ripgrep.json) and checked each executable for the edit from its worktree.
|
|
54
|
+
|
|
55
|
+
| Build | Direct | Warm | Time vs direct | Direct disk | Warm disk | Disk vs direct |
|
|
56
|
+
| ---------------------------------------- | ------: | ------: | -------------: | ----------: | --------: | -------------: |
|
|
57
|
+
| Build A from scratch | 4.14 s | 4.36 s | 5.4% more | 187.6 MiB | 188.3 MiB | 0.4% more |
|
|
58
|
+
| Rebuild A without edits | 0.13 s | 0.52 s | 301.0% more | 187.6 MiB | 188.6 MiB | 0.5% more |
|
|
59
|
+
| Edit one file in A and rebuild | 1.16 s | 1.83 s | 57.3% more | 193.3 MiB | 188.5 MiB | 2.5% less |
|
|
60
|
+
| Build B (Warm reuses the build checkout) | 4.00 s | 1.50 s | 62.4% less | 381.0 MiB | 188.6 MiB | 50.5% less |
|
|
61
|
+
| Build C (Warm creates a build checkout) | 3.85 s | 2.40 s | 37.7% less | 568.8 MiB | 249.0 MiB | 56.2% less |
|
|
62
|
+
| All five builds | 13.28 s | 10.61 s | 20.1% less | 568.8 MiB | 249.0 MiB | 56.2% less |
|
|
63
|
+
|
|
64
|
+
</details>
|
|
65
|
+
|
|
66
|
+
<details>
|
|
67
|
+
<summary>VS Code</summary>
|
|
68
|
+
|
|
69
|
+
We [built the VS Code client](bench/results/upstream/vscode.json) with `pnpm run build-fast --client-only`. Switching to B recompiled one file in the build checkout from A. C needed a fresh dependency install and a full client build.
|
|
70
|
+
|
|
71
|
+
| Build | Direct | Warm | Time vs direct | Direct disk | Warm disk | Disk vs direct |
|
|
72
|
+
| ---------------------------------------- | ------: | ------: | -------------: | ----------: | --------: | -------------: |
|
|
73
|
+
| Build A from scratch | 14.36 s | 24.98 s | 74.0% more | 424.6 MiB | 439.3 MiB | 3.5% more |
|
|
74
|
+
| Rebuild A without edits | 0.88 s | 2.21 s | 151.1% more | 424.6 MiB | 439.0 MiB | 3.4% more |
|
|
75
|
+
| Edit one file in A and rebuild | 1.56 s | 2.25 s | 44.2% more | 424.6 MiB | 439.1 MiB | 3.4% more |
|
|
76
|
+
| Build B (Warm reuses the build checkout) | 15.34 s | 2.77 s | 81.9% less | 848.8 MiB | 440.3 MiB | 48.1% less |
|
|
77
|
+
| Build C (Warm creates a build checkout) | 15.58 s | 26.64 s | 71.0% more | 1,272.9 MiB | 879.0 MiB | 30.9% less |
|
|
78
|
+
| All five builds | 47.72 s | 58.86 s | 23.3% more | 1,272.9 MiB | 879.0 MiB | 30.9% less |
|
|
79
|
+
|
|
80
|
+
</details>
|
|
81
|
+
|
|
82
|
+
### Seeding a new checkout for VS Code
|
|
83
|
+
|
|
84
|
+
We also tried [copying VS Code's client output and build records](bench/results/upstream/vscode-seeded.json) into each new checkout. VS Code then recompiled just the file we'd edited. Both methods installed dependencies offline on first use of each build directory.
|
|
85
|
+
|
|
86
|
+
| Build | Direct | Warm | Time vs direct | Direct disk | Warm disk | Disk vs direct |
|
|
87
|
+
| ---------------------------------------------- | ------: | ------: | -------------: | ----------: | --------: | -------------: |
|
|
88
|
+
| Build A from scratch | 15.48 s | 29.46 s | 90.3% more | 424.0 MiB | 439.5 MiB | 3.6% more |
|
|
89
|
+
| Rebuild A without edits | 0.71 s | 3.04 s | 326.0% more | 424.1 MiB | 439.4 MiB | 3.6% more |
|
|
90
|
+
| Edit one file in A and rebuild | 1.19 s | 4.94 s | 315.5% more | 423.8 MiB | 445.6 MiB | 5.2% more |
|
|
91
|
+
| Build B in the checkout from A | 16.54 s | 4.35 s | 73.7% less | 836.5 MiB | 447.1 MiB | 46.6% less |
|
|
92
|
+
| Build C in a new seeded checkout | 16.80 s | 27.25 s | 62.2% more | 1,255.1 MiB | 500.2 MiB | 60.1% less |
|
|
93
|
+
| All five builds | 50.72 s | 69.04 s | 36.1% more | 1,255.1 MiB | 500.2 MiB | 60.1% less |
|
|
94
|
+
| Build three edits together (two new checkouts) | 26.30 s | 43.42 s | 65.1% more | 1,264.6 MiB | 554.0 MiB | 56.2% less |
|
|
95
|
+
| Build three more edits in the same checkouts | 1.45 s | 8.18 s | 463.8% more | 1,258.9 MiB | 566.1 MiB | 55.0% less |
|
|
96
|
+
|
|
97
|
+
Opening two checkouts together took about 17 s per checkout just to sync the sources and restore the previous build. Recompiling the edit took less than a fifth of a second. The copies saved disk space but most source maps still pointed back to the original checkout, so a debugger could open another branch's source.
|
|
98
|
+
|
|
99
|
+
## Three builds at once
|
|
100
|
+
|
|
101
|
+
Both methods ran three builds concurrently. Time is how long we waited for the last build to finish and disk use covers all three worktrees plus any Warm checkouts and snapshots.
|
|
102
|
+
|
|
103
|
+
### One worktree has built before
|
|
104
|
+
|
|
105
|
+
Each worktree had a different edit, but only one had a previous build. The other two built from scratch directly. Through Warm they opened new checkouts and could restore whatever their build profile saved. For VS Code the table uses fresh client builds. We also measured [starting those checkouts with a copy](#seeding-a-new-checkout-for-vs-code).
|
|
106
|
+
|
|
107
|
+
| Project | Direct batch | Warm batch | Time vs direct | Direct disk | Warm disk | Disk vs direct |
|
|
108
|
+
| --------------- | -----------: | ---------: | -------------: | ----------: | ----------: | -------------: |
|
|
109
|
+
| Firefox for iOS | 225.2 s | 232.8 s | 3.4% more | 8,725.7 MiB | 8,942.6 MiB | 2.5% more |
|
|
110
|
+
| SwiftSyntax | 15.71 s | 14.55 s | 7.4% less | 565.6 MiB | 505.8 MiB | 10.6% less |
|
|
111
|
+
| ripgrep | 4.97 s | 2.89 s | 41.9% less | 568.4 MiB | 309.5 MiB | 45.5% less |
|
|
112
|
+
| VS Code | 26.22 s | 39.97 s | 52.5% more | 1,271.5 MiB | 1,313.3 MiB | 3.3% more |
|
|
113
|
+
|
|
114
|
+
### All three worktrees have built before
|
|
115
|
+
|
|
116
|
+
With all three build directories populated, we made another edit in each worktree and ran the builds together again. For SwiftSyntax and ripgrep we did this three times per round with a different edit each time.
|
|
117
|
+
|
|
118
|
+
| Project | Direct batch | Warm batch | Time vs direct | Direct disk | Warm disk | Disk vs direct |
|
|
119
|
+
| --------------- | -----------: | ---------: | -------------: | ----------: | ----------: | -------------: |
|
|
120
|
+
| Firefox for iOS | 40.83 s | 52.29 s | 28.1% more | 8,959.4 MiB | 9,210.2 MiB | 2.8% more |
|
|
121
|
+
| SwiftSyntax | 2.60 s | 3.17 s | 21.8% more | 565.8 MiB | 507.7 MiB | 10.3% less |
|
|
122
|
+
| ripgrep | 1.40 s | 1.68 s | 20.0% more | 579.9 MiB | 310.2 MiB | 46.5% less |
|
|
123
|
+
| VS Code | 1.85 s | 2.89 s | 56.5% more | 1,271.4 MiB | 1,307.3 MiB | 2.8% more |
|
|
124
|
+
|
|
125
|
+
In a [follow-up Firefox run](bench/results/firefox-checkout-control.json) with faster checkout setup, we timed later edits that made Xcode copy fewer files. Three builds then took 41.77 s through Warm and 41.84 s directly (medians of two batches per method).
|
|
126
|
+
|
|
127
|
+
<details>
|
|
128
|
+
<summary>AEPServices and the Ninja sample</summary>
|
|
129
|
+
|
|
130
|
+
We repeated both batches with [AEPServices](bench/results/adobe.json) and a [33-file C project built with Ninja](bench/results/ninja.json). For AEPServices we also tried sharing one Xcode compilation cache across all three worktrees, starting with an empty cache for each method. The Ninja figures are medians from six rounds.
|
|
131
|
+
|
|
132
|
+
| Project and batch | Direct | Warm | Time vs direct | Direct disk | Warm disk | Disk vs direct |
|
|
133
|
+
| ------------------------------------------ | -----: | -----: | -------------: | ----------: | --------: | -------------: |
|
|
134
|
+
| AEPServices, first edits | 7.36 s | 7.71 s | 4.8% more | 225.4 MiB | 225.3 MiB | 0.1% less |
|
|
135
|
+
| AEPServices, next edits | 2.68 s | 2.95 s | 9.9% more | 225.9 MiB | 225.8 MiB | 0.0% less |
|
|
136
|
+
| AEPServices with shared cache, first edits | 5.18 s | 5.19 s | 0.1% more | 385.0 MiB | 286.8 MiB | 25.5% less |
|
|
137
|
+
| AEPServices with shared cache, next edits | 3.05 s | 3.61 s | 18.4% more | 396.0 MiB | 298.3 MiB | 24.7% less |
|
|
138
|
+
| Ninja, first edits | 1.40 s | 1.65 s | 17.8% more | 564 KiB | 890 KiB | 57.8% more |
|
|
139
|
+
| Ninja, next edits | 0.21 s | 0.52 s | 147.2% more | 548 KiB | 938 KiB | 71.2% more |
|
|
140
|
+
|
|
141
|
+
</details>
|
|
142
|
+
|
|
143
|
+
## Four builds together or one at a time
|
|
144
|
+
|
|
145
|
+
Warm can run [four builds together](bench/results/four-worktrees.json) if its [machine and repository limits](GUIDE.md#set-build-and-disk-limits) both allow four. With the default machine limit of three, the fourth build waits for a checkout.
|
|
146
|
+
|
|
147
|
+
We built AEPServices in four worktrees and changed one line in each. We timed all four rebuilds together and one at a time, reversing the order in the second round.
|
|
148
|
+
|
|
149
|
+
| How we built | One at a time | Four at once | Time saved by running together |
|
|
150
|
+
| ------------------- | ------------: | -----------: | -----------------------------: |
|
|
151
|
+
| Direct Xcode builds | 8.88 s | 2.79 s | 68.6% |
|
|
152
|
+
| Through Warm | 10.28 s | 3.15 s | 69.4% |
|
|
153
|
+
|
|
154
|
+
After the parallel builds the worktrees used 301.5 MiB directly and 304.8 MiB through Warm.
|
|
155
|
+
|
|
156
|
+
## Starting a build in a fresh checkout
|
|
157
|
+
|
|
158
|
+
For the [Xcode and Cargo samples](bench/results/seed-scenarios.json) and the [SwiftPM and TypeScript samples](bench/results/compiler-seeds.json) we built in one worktree, then built an edit in another. For the Warm runs we locked the first checkout so the second build had to open a new one. The table compares that build directly and through Warm using each tool's default profile. Times include cache restoration and are medians from three rounds. Disk use covers both builds.
|
|
159
|
+
|
|
160
|
+
| Build | Direct | Warm | Time vs direct | Direct disk | Warm disk | Disk vs direct |
|
|
161
|
+
| --------------------- | -----: | -----: | -------------: | ----------: | --------: | -------------: |
|
|
162
|
+
| Xcode | 5.24 s | 3.06 s | 41.7% less | 96.1 MiB | 81.8 MiB | 14.9% less |
|
|
163
|
+
| SwiftPM | 4.95 s | 2.65 s | 46.4% less | 35.8 MiB | 20.3 MiB | 43.3% less |
|
|
164
|
+
| Cargo | 0.37 s | 0.60 s | 61.6% more | 1.5 MiB | 1.7 MiB | 13.9% more |
|
|
165
|
+
| TypeScript type check | 0.35 s | 0.74 s | 112.7% more | 36 KiB | 248 KiB | 588.9% more |
|
|
166
|
+
| TypeScript emit | 0.36 s | 0.84 s | 131.8% more | 896 KiB | 1.1 MiB | 21.9% more |
|
|
167
|
+
|
|
168
|
+
## How we measured
|
|
169
|
+
|
|
170
|
+
We used an M3 Max Mac running macOS 27.2.1 with a dedicated APFS volume. Each method started with clean build directories and compiler module caches. We fetched dependencies before timing and kept the operating system's file cache between runs. The main Firefox comparison uses one run per method. The other three projects use the median of two rounds in opposite order.
|
|
171
|
+
|
|
172
|
+
We timed each command through exit, including the time Warm spent syncing files and saving caches. After each build we checked its output and measured the drop in free space since the start of the run. That counts shared APFS blocks once. The [raw results](bench/results) include the individual runs and separate measurements of Warm's overhead.
|
|
173
|
+
|
|
174
|
+
You can repeat the [small Swift package benchmark](bench/results/swift-scenarios.json) from the Warm checkout. Replace `/Volumes/WarmBenchmark` with the mount path of an idle APFS volume.
|
|
175
|
+
|
|
176
|
+
```sh
|
|
177
|
+
npm ci
|
|
178
|
+
npm run benchmark -- --disk-volume /Volumes/WarmBenchmark
|
|
179
|
+
```
|
package/GUIDE.md
ADDED
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
# Warm user guide
|
|
2
|
+
|
|
3
|
+
- [Build across related worktrees](#build-across-related-worktrees)
|
|
4
|
+
- [Return files from a build](#return-files-from-a-build)
|
|
5
|
+
- [Run in your own worktree](#run-in-your-own-worktree)
|
|
6
|
+
- [Use Warm in a project script](#use-warm-in-a-project-script)
|
|
7
|
+
- [Prepare a build checkout](#prepare-a-build-checkout)
|
|
8
|
+
- [Apply settings to a particular command](#apply-settings-to-a-particular-command)
|
|
9
|
+
- [Start a new checkout with an existing cache](#start-a-new-checkout-with-an-existing-cache)
|
|
10
|
+
- [Share a compiler cache across worktrees](#share-a-compiler-cache-across-worktrees)
|
|
11
|
+
- [Set build and disk limits](#set-build-and-disk-limits)
|
|
12
|
+
- [Keep a worktree open in your editor](#keep-a-worktree-open-in-your-editor)
|
|
13
|
+
- [Review changes to build and test commands](#review-changes-to-build-and-test-commands)
|
|
14
|
+
- [Inspect builds and reclaim space](#inspect-builds-and-reclaim-space)
|
|
15
|
+
- [Configuration reference](#configuration-reference)
|
|
16
|
+
- [Development](#development)
|
|
17
|
+
|
|
18
|
+
## Build across related worktrees
|
|
19
|
+
|
|
20
|
+
Run `warm run -- <command>` from whichever worktree you want to build. Warm takes the saved files from that worktree and runs the command in an available build checkout. All worktrees in the repository use the same pool, so a checkout you used for a feature branch can also serve a branch based on that feature, even if `main` is several commits behind.
|
|
21
|
+
|
|
22
|
+
You can have several worktrees open while a single build checkout handles their builds in turn. For example, agents working on independent changes can each run the [project's usual test command](#use-warm-in-a-project-script) as their edits are ready. If their test runs overlap, each needs its own checkout so it sees only its worktree's changes. A fresh checkout can [start with a saved cache](#start-a-new-checkout-with-an-existing-cache). Once you reach the [build limit](#set-build-and-disk-limits), further runs wait for a checkout to become free.
|
|
23
|
+
|
|
24
|
+
If you built directly in your editor or terminal, the products stay where your build tool wrote them. You can start your first `warm run` from any worktree, but building the same commit can take as long as a clean build if the build checkout has nothing to reuse. To share a cache that works at a different path, declare its worktree-relative path under [`seed`](#start-a-new-checkout-with-an-existing-cache) and run `warm seed` in the worktree where you built it.
|
|
25
|
+
|
|
26
|
+
## Return files from a build
|
|
27
|
+
|
|
28
|
+
Build products stay in the build checkout unless you ask Warm to copy them back. If your Makefile writes a package to `dist`, pass its path relative to the worktree root to bring it back after a successful build.
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
warm run --output dist -- make build
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Repeat `--output` for each product you need. Warm refuses to overwrite tracked files or anything you edited at the destination during the build. If you switch to a different commit while Warm is delivering products, it stops and rolls back any replacements it can safely undo.
|
|
35
|
+
|
|
36
|
+
For a native executable, `warm run --symbols out/tool -- ./build-debug.sh` uses the Xcode command line tools to return the binary with its dSYM.
|
|
37
|
+
|
|
38
|
+
To bring back edits to source files, use `--write-back`. For example, `warm run --write-back -- ./update-snapshots` copies snapshot changes back to your worktree after the command succeeds. Warm can add, edit or delete regular files without changing your Git index. If you edited the same file during the build, Warm keeps your edit and reports the conflict. If you switch commits while Warm is applying source edits, it can ask you to return to the original commit and run `warm status` to recover them.
|
|
39
|
+
|
|
40
|
+
## Run in your own worktree
|
|
41
|
+
|
|
42
|
+
A watcher needs to see files as you save them. Use `--in-place` to run it in your own worktree, where it can stay open without holding a build checkout.
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
warm run --in-place -- npm run watch
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
A script that reads your branch name or staged changes needs your checkout's Git state. Running in place gives it that state and your terminal, while a build checkout has a detached HEAD and its own index. To run from a different checkout or subdirectory, select it with `--from <directory>`.
|
|
49
|
+
|
|
50
|
+
Warm applies the selected checkout's `env` settings, so an in-place command can use the same [compiler cache](#share-a-compiler-cache-across-worktrees) as a build in the pool. The command writes to its usual output paths. Preparation steps, build profiles and build history apply only to builds in the pool.
|
|
51
|
+
|
|
52
|
+
## Use Warm in a project script
|
|
53
|
+
|
|
54
|
+
If your team uses `make test`, you can keep that command and put `warm run -- cargo test` in the recipe. You can wrap `xcodebuild` the same way in a shell script. Builds started from the Xcode toolbar still follow the IDE's usual process.
|
|
55
|
+
|
|
56
|
+
In an npm project you can keep `npm run build` by changing the `build` script in `package.json`. This example runs TypeScript in a checkout and returns the compiled files to `dist` in your worktree.
|
|
57
|
+
|
|
58
|
+
```json
|
|
59
|
+
{
|
|
60
|
+
"scripts": {
|
|
61
|
+
"build": "warm run --output dist -- tsc -p ."
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
If the project installs TypeScript locally, a [preparation step](#prepare-a-build-checkout) can install it in the checkout before `tsc` runs.
|
|
67
|
+
|
|
68
|
+
## Prepare a build checkout
|
|
69
|
+
|
|
70
|
+
If a build needs installed dependencies or generated files, declare a `prepare` step in `warm.json5`. For the npm project above, the step installs the packages listed in the lockfile.
|
|
71
|
+
|
|
72
|
+
```json5
|
|
73
|
+
{
|
|
74
|
+
prepare: [
|
|
75
|
+
{
|
|
76
|
+
run: ["npm", "ci"],
|
|
77
|
+
inputs: ["package.json", "package-lock.json"],
|
|
78
|
+
outputs: ["node_modules"],
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The first time you build in a checkout, Warm runs `npm ci` at the checkout root and checks that it produced `node_modules`. Later builds in that checkout use the same installation until a listed input or the step itself changes, or the output goes missing.
|
|
85
|
+
|
|
86
|
+
If only some commands need a step, add a `when` condition to it. For example, a Tuist generation step with `when: { executable: "xcodebuild", flags: ["-workspace"] }` runs before a workspace build when the generated files need updating. You can run `swift test` in a nested package without generating the workspace, even on the first build in a checkout.
|
|
87
|
+
|
|
88
|
+
Include every input that can change the result. For example, if `npm ci` depends on a project `.npmrc`, add it to `inputs`. If Git ignores that file, also list it under `includeIgnored` so Warm copies it into the checkout. For a generator that depends on the build variant, `envInputs: ["BUILD_VARIANT"]` reruns the step when that variable changes.
|
|
89
|
+
|
|
90
|
+
If an input is a symlink to a file in the checkout, editing that file reruns the step on the next matching build. A link to a directory, a missing file or a target outside the checkout makes the step run on every matching build.
|
|
91
|
+
|
|
92
|
+
Warm runs steps in order, so a step can list an earlier step's output in its `inputs`. Give the generator a `when` condition that matches every command that needs those files, or omit the condition. A command that skips the generator can use an up-to-date copy in the checkout. If the files are missing or need regenerating, Warm names the skipped generator and stops before the step that needs them.
|
|
93
|
+
|
|
94
|
+
If two steps produce different files in one directory, list each file as an output so Warm can reuse them independently. When the steps share an output path, Warm can reuse the result while the same steps run in the same order. Switching to a command that skips one of them clears the shared output so the remaining steps can rebuild it. A step that reads an intermediate version can also cause Warm to rerun the step that produced it.
|
|
95
|
+
|
|
96
|
+
Warm checks that each prepared output exists. If a successful build edits a prepared file, the next build can reuse that edit while the step's inputs stay the same. After a failed build, Warm clears the old outputs the next time it uses the checkout and reruns the steps that match the new command.
|
|
97
|
+
|
|
98
|
+
Prepared files stay in the checkout. To [return one to your worktree](#return-files-from-a-build), list it under the top-level `outputs`. If you request a different file with `--output`, the prepared files remain available for the next build.
|
|
99
|
+
|
|
100
|
+
## Apply settings to a particular command
|
|
101
|
+
|
|
102
|
+
A profile lets you keep a cache relative to the directory where you run a particular command. If each package in your repository has its own `.cache/objects`, the profile below keeps `packages/client/.cache/objects` when you run `warm run -- make build` from `packages/client`.
|
|
103
|
+
|
|
104
|
+
```json5
|
|
105
|
+
{
|
|
106
|
+
profiles: [
|
|
107
|
+
{
|
|
108
|
+
executable: "make",
|
|
109
|
+
when: { subcommands: ["build"] },
|
|
110
|
+
caches: [{ directory: ".cache/objects" }],
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Warm runs the command in the corresponding directory in the checkout. This profile matches `make build` because `make` is the executable after `--` and `build` is its first argument. With `sh -c 'make build'`, Warm would look for a profile for `sh`. See the [profile reference](#profiles) for script paths and other argument matches.
|
|
117
|
+
|
|
118
|
+
The [built-in profiles](profiles.json5) use the same rules. Cargo and SwiftPM usually write to `target/` and `.build/` respectively, and their profiles recognise options that select another directory. For Xcode scheme builds, Warm supplies a DerivedData path inside the checkout if you omit one. To replace a built-in profile, define one for the same executable in `warm.json5`.
|
|
119
|
+
|
|
120
|
+
For a direct call such as `warm run -- tsc -p packages/client`, Warm reads the project's compiler settings. An incremental type check can keep its build info across edits. If the compiler also emits files to a dedicated directory, Warm clears those files and the build info together when inputs change or preparation runs again. This prevents a file removed from the project from surviving in the compiled output.
|
|
121
|
+
|
|
122
|
+
For project references, `tsc --build` or a wrapper such as `warm run -- npm run build`, declare the paths to keep in `warm.json5`. Give concurrent builds separate build info files if you configure those paths yourself.
|
|
123
|
+
|
|
124
|
+
## Start a new checkout with an existing cache
|
|
125
|
+
|
|
126
|
+
When a build needs a new checkout, Warm looks for the latest complete snapshot with the same profile and cache paths. Each checkout updates its own snapshot after a successful build, so two builds can finish saving their caches while a third starts from the last one that was ready. On the same APFS volume the copies share disk blocks until one changes. Run `warm explain` after a build to see which paths it started with.
|
|
127
|
+
|
|
128
|
+
If a build fails or you remove its checkout, Warm reclaims that checkout's older copies. If it holds the latest snapshot, Warm keeps that snapshot available until another build replaces it.
|
|
129
|
+
|
|
130
|
+
The built-in profiles choose what to copy for each tool.
|
|
131
|
+
|
|
132
|
+
| Tool | What a new checkout can reuse |
|
|
133
|
+
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
134
|
+
| Cargo | The target directory, including a relative path set with `--target-dir`. |
|
|
135
|
+
| Xcode scheme builds | Compilation, module and SDK caches from DerivedData. An existing checkout also keeps its build products and incremental build records at the same path. |
|
|
136
|
+
| SwiftPM | The `out/` directory under `.build/` or your custom scratch path. With SwiftPM's native build system, which uses a different layout, SwiftPM builds from scratch in a fresh checkout. |
|
|
137
|
+
| TypeScript | Build info from a direct incremental type check with matching project settings. A build that emits JavaScript starts fresh so the compiler writes every output. |
|
|
138
|
+
|
|
139
|
+
If there's no snapshot, a cache rule can use files already in your worktree. TypeScript needs a matching snapshot because its build info depends on the project settings. If the files are missing or can't be copied safely, the tool builds from scratch.
|
|
140
|
+
|
|
141
|
+
If you use a relative DerivedData path, pass it as usual. Running `xcodebuild -scheme App -derivedDataPath ./BuildData` from `ios/` uses `ios/BuildData/` in the checkout, or in your own worktree with `--in-place`. When the checkout changes, Xcode may recompile files whose build records refer to the previous path.
|
|
142
|
+
|
|
143
|
+
For a custom build, put `seed: [".cache/objects"]` in `warm.json5` to give new build checkouts and editing worktrees a copy of those objects. An explicit seed looks in your worktree first. If you built directly, run `warm seed` in that worktree after the build to make the declared caches available to other worktrees. To keep a cache in each checkout, list it under `retain` instead. For example, `retain: ["DerivedData"]` lets Xcode reuse that directory in the same checkout and saves the time Warm would spend copying it for new checkouts.
|
|
144
|
+
|
|
145
|
+
## Share a compiler cache across worktrees
|
|
146
|
+
|
|
147
|
+
A compiler with a shared cache can reuse compilation results across parallel builds even though each checkout has its own build directory. Point the compiler at a folder under `WARM_CACHE_DIR`. Warm sets this variable to the same path for build checkouts and in-place commands across the repository.
|
|
148
|
+
|
|
149
|
+
In a shell command, `warm cache-path` prints that directory. For example, you can point Xcode's compilation cache there while keeping DerivedData in each checkout.
|
|
150
|
+
|
|
151
|
+
```sh
|
|
152
|
+
warm run -- xcodebuild -scheme App \
|
|
153
|
+
COMPILATION_CACHE_ENABLE_CACHING=YES \
|
|
154
|
+
"COMPILATION_CACHE_CAS_PATH=$(warm cache-path)/xcode" build
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
For Rust builds that use sccache, set `RUSTC_WRAPPER` to `sccache`. To store its cache under Warm's shared directory, set `SCCACHE_DIR` to `${WARM_CACHE_DIR}/sccache` in the project's `env` settings before starting the sccache server. [sccache local storage](https://github.com/mozilla/sccache/blob/main/docs/Local.md)
|
|
158
|
+
|
|
159
|
+
For Apple's `clang-cache`, set `LLVM_CACHE_CAS_PATH` to `${WARM_CACHE_DIR}/clang` in `env`. If the compiler misses the cache for identical sources in different checkouts, check its path mapping. Absolute source paths can give the same file different cache keys.
|
|
160
|
+
|
|
161
|
+
## Set build and disk limits
|
|
162
|
+
|
|
163
|
+
Warm allows three concurrent builds in its pool across your repositories by default. To change that limit or set a free-space target, edit `~/Library/Application Support/warm/settings.json5`. If you set `WARM_HOME` to an absolute path, Warm reads `settings.json5` from there instead.
|
|
164
|
+
|
|
165
|
+
```json5
|
|
166
|
+
{
|
|
167
|
+
maxConcurrent: 4,
|
|
168
|
+
minFreeGiB: 20,
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
With this limit, four builds can run at once across your repositories. Warm creates checkouts as it needs them. If you build four worktrees one at a time, all four can use the same build checkout. If you build them together, each running command needs its own checkout. `maxConcurrent` accepts integers from 1 to 128. To give one project fewer checkouts, set `poolSize` in its `warm.json5` or pass `--pool-size` for one build.
|
|
173
|
+
|
|
174
|
+
Warm first looks for a free checkout that built the same commit. If several did, it prefers one that built your worktree. If none did, it looks for one that built your worktree at another commit before trying other checkouts. A profile can break a tie by matching the command, its working directory and its inputs. For example, the Cargo profile checks `Cargo.lock`. A [custom profile](#profiles) can name its own files.
|
|
175
|
+
|
|
176
|
+
Warm waits up to an hour for a checkout and a machine permit. Use `warm status` to see what's running, what's queued and whether Git has locked a checkout. Pass `--wait 30` to limit the wait to 30 seconds, or `--no-wait` to fail if Warm would have to wait.
|
|
177
|
+
|
|
178
|
+
With `minFreeGiB: 20`, Warm aims to keep 20 GiB free. You can also specify a fraction of a GiB. Before each build in the pool Warm checks the repository's volume and removes the least recently used idle checkouts in that repository until it reaches the target. If it runs out of eligible checkouts, it reports the shortfall and starts the build. If cleanup needs to wait for another build to finish saving its cache, the same wait limit applies.
|
|
179
|
+
|
|
180
|
+
A running build can use space below the target. To see which build checkouts Warm would remove beforehand, [preview the cleanup](#inspect-builds-and-reclaim-space). Leaving `minFreeGiB` at its default of zero turns off automatic cleanup.
|
|
181
|
+
|
|
182
|
+
## Keep a worktree open in your editor
|
|
183
|
+
|
|
184
|
+
To start editing on a new branch at the current commit, use `cd` with the path returned by `warm acquire`.
|
|
185
|
+
|
|
186
|
+
```sh
|
|
187
|
+
cd "$(warm acquire -b feature/search)"
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
From there you can use `warm run -- <command>` without a `warm.json5` file. Warm can reuse the build checkout from your last run. If it's busy, Warm can use another from the [shared pool](#set-build-and-disk-limits) or wait for one to become free.
|
|
191
|
+
|
|
192
|
+
For example, you can run `warm run -- xcodebuild -scheme App build` without passing `-derivedDataPath`. Warm supplies a path inside the build checkout, so Xcode can find its previous products when Warm reuses that checkout.
|
|
193
|
+
|
|
194
|
+
If you prefer to build directly in the editing worktree, `warm acquire` can copy a cache from your last direct build into a fresh worktree. Choose a cache that works at a different path and commit its worktree-relative path under [`seed` in `warm.json5`](#start-a-new-checkout-with-an-existing-cache) before you create the branch. To save that cache for another worktree later, run `warm seed` after a successful build.
|
|
195
|
+
|
|
196
|
+
For an existing branch, use `warm acquire feature/search`. If the branch already has a worktree, Warm returns its path without copying caches into it.
|
|
197
|
+
|
|
198
|
+
For a direct build in your editor, declare the caches you want to keep when the checkout changes branches. A Cargo project could use `retain: ["target"]`.
|
|
199
|
+
|
|
200
|
+
Once you've committed your changes, close the editor and stop any watchers before running `warm release` in the managed checkout. You can also run `warm release feature/search` from another worktree. Warm checks for local changes and unfinished Git operations before freeing the checkout for another branch. Releasing it keeps the branch.
|
|
201
|
+
|
|
202
|
+
## Review changes to build and test commands
|
|
203
|
+
|
|
204
|
+
If CI runs `make test`, a change to the Makefile or its scripts can change which tests run. To review those files alongside `warm.json5`, compare your worktree with the branch you intend to merge into.
|
|
205
|
+
|
|
206
|
+
```sh
|
|
207
|
+
warm review --base main Makefile scripts/tests
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
The diff includes uncommitted edits and new files that Git doesn't ignore. To review the same paths each time, set `verificationFiles: ["Makefile", "scripts/tests"]` in the base branch's `warm.json5` and run `warm review --base main`. Warm reads the list from the base so a branch can't hide a change by dropping a file from the list. You can pass extra paths relative to the worktree root.
|
|
211
|
+
|
|
212
|
+
## Inspect builds and reclaim space
|
|
213
|
+
|
|
214
|
+
If a build in the pool did more work than you expected, start with `warm explain`. It tells you which checkout Warm used and which build paths it kept or cleared. For a reused checkout with a recorded successful build, it also names the previous branch or commit.
|
|
215
|
+
|
|
216
|
+
The source counts show how many files Warm had to copy into the checkout. Files that matched keep their timestamps so the build tool can recognise unchanged inputs. If a preparation step ran again, the report gives the reason. For compilers with a profile that recognises cache hits and misses, it also shows those counts.
|
|
217
|
+
|
|
218
|
+
Run `warm explain --json` to see how long queuing, syncing, building and delivering outputs took. The `restoreMs` field shows how much of that time went into restoring caches.
|
|
219
|
+
|
|
220
|
+
To find output from one of the last ten builds in the pool, run `warm history`. Warm normally records a log and rewrites source paths in diagnostics so you can open the files in your worktree. For binary output, use `warm run --raw` to pass the output through unchanged and skip the log. If a command opens `/dev/tty` for a password or an interactive prompt, run it in your own worktree with `warm run --in-place`.
|
|
221
|
+
|
|
222
|
+
To find the build directories themselves, run `warm pool list` from any worktree. For a main checkout at `~/Projects/App`, Warm keeps them under `~/Projects/.warm/App-<hash>/` and names them `build-1`, `build-2` and so on. If you've moved the repository, `warm doctor` can identify checkouts left at the old location.
|
|
223
|
+
|
|
224
|
+
To inspect checkout sizes and preview which checkouts you could remove while keeping the most recently used one, use these commands.
|
|
225
|
+
|
|
226
|
+
```sh
|
|
227
|
+
warm pool list --sizes
|
|
228
|
+
warm pool prune --keep 1 --dry-run
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
On APFS, files in different checkouts can [share disk blocks](https://developer.apple.com/documentation/foundation/about-apple-file-system#Clones-Reduce-the-Cost-of-Copying), so a checkout's listed size may exceed what removing it would free. Omit `--dry-run` to remove the checkouts in the preview.
|
|
232
|
+
|
|
233
|
+
Use `warm prune --dry-run` to see what a broader cleanup would remove, including released editing worktrees and cache snapshots. Both prune commands keep the shared compiler cache.
|
|
234
|
+
|
|
235
|
+
To preview cleanup for a [free-space target](#set-build-and-disk-limits), run `warm pool prune --min-free-gib 20 --dry-run`. Warm lists candidates in the order it would remove them. During cleanup it measures the free space after each removal and stops when it reaches the target.
|
|
236
|
+
|
|
237
|
+
## Configuration reference
|
|
238
|
+
|
|
239
|
+
Put project settings in a JSON5 object in `warm.json5` at the root of your worktree. Limits that apply across repositories belong in your [user settings](#set-build-and-disk-limits). Run `warm doctor` to check both files.
|
|
240
|
+
|
|
241
|
+
### Project settings
|
|
242
|
+
|
|
243
|
+
All project fields are optional. Write paths relative to the worktree root. For `prepare.inputs` you can also use globs.
|
|
244
|
+
|
|
245
|
+
| Field | Value | When to use it |
|
|
246
|
+
| ----------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
247
|
+
| `retain` | List of paths | Keep build products in the checkout across source edits. |
|
|
248
|
+
| `seed` | List of paths | Give new checkouts a copy of a cache that works at a different path. |
|
|
249
|
+
| `outputs` | List of paths | Copy products back to your worktree after a successful build in the pool. Warm clears them in the checkout when its inputs change. Add a path for one build with `--output`. |
|
|
250
|
+
| `resetOnRevisionChange` | List of paths | Clear products when a checkout's inputs change or an editing worktree moves to another revision. |
|
|
251
|
+
| `includeIgnored` | List of paths | Copy files or directories into the checkout even if Git ignores them. |
|
|
252
|
+
| `prepare` | List of [steps](#preparation-steps) | Install dependencies or generate files before a build in the pool. Warm checks each step in order. |
|
|
253
|
+
| `env` | Object with string values | Set variables for preparation and builds, including in-place commands. Use `${WARM_CACHE_DIR}` in a value for the repository's shared cache directory. |
|
|
254
|
+
| `poolSize` | Integer from 1 to 128 | Use a smaller pool for this repository. By default it shares your Mac's `maxConcurrent` limit. |
|
|
255
|
+
| `profiles` | List of [profiles](#profiles) | Apply settings to particular commands. A project profile replaces the whole built-in profile for the same executable. |
|
|
256
|
+
| `builtinProfiles` | Boolean | Set to `false` to turn off the [built-in profiles](profiles.json5). |
|
|
257
|
+
| `verificationFiles` | List of paths | Include these paths alongside `warm.json5` in `warm review`. Warm reads the list from the base revision. |
|
|
258
|
+
|
|
259
|
+
Use untracked paths for build products. If a generator writes to `codegen/out` and updates those files when its inputs change, `retain: ["codegen/out"]` lets it skip that work after an unrelated edit.
|
|
260
|
+
|
|
261
|
+
A path you copy into the checkout with `includeIgnored` can't also be a path you retain, reset or return. The same restriction applies if one directory contains the other.
|
|
262
|
+
|
|
263
|
+
Keep paths to reset separate from retained paths, including seeds and preparation outputs. A returned product can overlap a retained path. If you list it in `outputs`, Warm clears it when the checkout's inputs change.
|
|
264
|
+
|
|
265
|
+
### Preparation steps
|
|
266
|
+
|
|
267
|
+
A preparation step runs from the checkout root and needs a command, at least one input to watch and at least one output. The [`npm ci` example](#prepare-a-build-checkout) shows how those fields fit together.
|
|
268
|
+
|
|
269
|
+
| Field | Value |
|
|
270
|
+
| ----------- | ---------------------------------------------------------------------------------------------------------------------------------- |
|
|
271
|
+
| `run` | The executable followed by its arguments, such as `["npm", "ci"]`. Invoke a shell explicitly if you need shell syntax. |
|
|
272
|
+
| `when` | Selects the build commands that need this step. Omit it to check the step on every build in the pool. |
|
|
273
|
+
| `inputs` | A list of file paths or globs such as `"specs/**/*.txt"`. A step can watch outputs from an earlier step. |
|
|
274
|
+
| `envInputs` | Names of environment variables to watch. |
|
|
275
|
+
| `outputs` | Paths the command must produce. Warm reruns the step if any are missing. To copy one back, list it in the project's `outputs` too. |
|
|
276
|
+
|
|
277
|
+
In `when`, set `executable` to a command name or a project script such as `"./tools/build"`. You can narrow the match with the same `subcommands`, `skipFirstPrefix` and `flags` conditions used by [profiles](#profiles). Warm matches the command you pass to `warm run` before it adds any profile options. Skipping a step preserves its saved inputs for the next matching build.
|
|
278
|
+
|
|
279
|
+
### Profiles
|
|
280
|
+
|
|
281
|
+
Each entry in `profiles` names a different executable, as in the [Make example](#apply-settings-to-a-particular-command). All other fields are optional.
|
|
282
|
+
|
|
283
|
+
| Field | What it does |
|
|
284
|
+
| ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
285
|
+
| `executable` | Use a command name such as `"cargo"` or a script path from the worktree root such as `"./tools/build"`. |
|
|
286
|
+
| `when` | Limits cache rules and compiler inspection to calls that meet all the conditions below. Omit it to match every call. |
|
|
287
|
+
| `caches` | Lists [cache rules](#profile-cache-rules) in the order Warm should apply them. |
|
|
288
|
+
| `compiler` | Use `"typescript"` to discover cache paths for direct `tsc` builds. |
|
|
289
|
+
| `checkoutInputs` | When checkouts tie on revision and worktree, prefer one that built the same command in the same directory with matching contents for these repository-relative files. Use `[]` to match just the command and directory. |
|
|
290
|
+
| `remarks` | Give the exact lines to count in `warm explain`, such as `{ hit: "Cache hit", miss: "Cache miss" }`. Counts are independent of `when` and unavailable in raw mode. |
|
|
291
|
+
|
|
292
|
+
When Warm matches an executable path, an exact project script match takes precedence. An absolute path can also match by file name, and a local `node_modules/.bin/tsc` can use the `tsc` profile.
|
|
293
|
+
|
|
294
|
+
The `when` conditions match arguments before the tool's first `--` and are case-sensitive.
|
|
295
|
+
|
|
296
|
+
| Field in `when` | What to match |
|
|
297
|
+
| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
298
|
+
| `subcommands` | A list of names. The first argument must match one of them. |
|
|
299
|
+
| `skipFirstPrefix` | With `subcommands`, skip the first argument if it starts with this prefix. For example, `"+"` makes `build` the subcommand in `cargo +nightly build`. |
|
|
300
|
+
| `flags` | A list of option names. Each must appear as a separate argument. |
|
|
301
|
+
|
|
302
|
+
### Profile cache rules
|
|
303
|
+
|
|
304
|
+
Use `directory` for a default cache path and `from` to read a path from an option or environment variable. A rule needs at least one of the two. This example keeps `.cache` unless the command supplies a different path with `--cache-dir`.
|
|
305
|
+
|
|
306
|
+
```json5
|
|
307
|
+
{ directory: ".cache", from: [{ option: "--cache-dir" }] }
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
| Field | What it does |
|
|
311
|
+
| ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
312
|
+
| `directory` | Names a default directory relative to the command's working directory. With `manifest`, the default is relative to the directory containing that file. |
|
|
313
|
+
| `from` | Lists path sources in priority order. Each entry names one option or environment variable, such as `{ option: "--target-dir" }` or `{ env: "CARGO_TARGET_DIR" }`. Warm uses the first defined value. |
|
|
314
|
+
| `addOption` | Passes an option such as `-derivedDataPath` when Warm retains the default directory. Use with `directory` alone or with `from`. An explicit value for the option takes precedence over `from`. |
|
|
315
|
+
| `ignoreContains` | Skips a supplied path containing this text. Cargo's profile uses `"{"` to skip paths that Cargo expands itself. |
|
|
316
|
+
| `seed` | Use `true` for the whole cache, `["products"]` for named paths or `"entries"` to copy its top-level entries independently. Omit it to keep the cache in its original checkout. |
|
|
317
|
+
| `manifest` | Locates the default `directory` relative to a project file using the fields below. |
|
|
318
|
+
|
|
319
|
+
With `seed: "entries"`, each child must be safe to copy on its own. If one contains Git metadata or a link outside that child, Warm skips it and continues with the others. To keep a location-dependent database in its original checkout, use `seed: { entriesExcept: ["build/db"] }`. Paths are relative to the cache directory, so a fresh checkout can still reuse files alongside the database.
|
|
320
|
+
|
|
321
|
+
Warm reads both `--name value` and `--name=value` and uses the last occurrence before the tool's `--`. Supply paths relative to the working directory. Warm leaves absolute paths and paths that conflict with source files or project settings alone.
|
|
322
|
+
|
|
323
|
+
| Field in `manifest` | What it does |
|
|
324
|
+
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
|
|
325
|
+
| `name` | The required file name, such as `"Package.swift"`. Warm looks in the working directory and its parents up to the worktree root. |
|
|
326
|
+
| `locationOption` | Names an option that changes where the search starts, such as `"--package-path"`. An absolute value skips the search. |
|
|
327
|
+
| `locationKind` | By default `locationOption` points to a `"directory"`. Use `"file"` to start in the named file's parent directory. |
|
|
328
|
+
| `search` | Use `"nearest"` (the default) for the closest matching manifest or `"all"` for every match up to the worktree root. |
|
|
329
|
+
|
|
330
|
+
## Development
|
|
331
|
+
|
|
332
|
+
Building from source uses the Xcode Command Line Tools and the headers included with Node.js. Run these commands from the Warm repository to check formatting, lint the source and run the tests.
|
|
333
|
+
|
|
334
|
+
```sh
|
|
335
|
+
npm ci
|
|
336
|
+
npm run format:check
|
|
337
|
+
npm run lint
|
|
338
|
+
npm test
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
`npm test` type-checks and builds the CLI before running the tests. For a quicker type check during development, run `npm run typecheck`. To build the npm tarball, run `npm pack`.
|
|
342
|
+
|
|
343
|
+
For command-line help, run `warm --help` or `warm run --help`. If you're writing a tool that needs to look up command or option names, `warm commands --json` returns them as JSON.
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Suyash Srijan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|