gate-cache 0.8.0__tar.gz → 0.9.0__tar.gz

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 (80) hide show
  1. {gate_cache-0.8.0 → gate_cache-0.9.0}/PKG-INFO +24 -9
  2. {gate_cache-0.8.0 → gate_cache-0.9.0}/README.md +23 -8
  3. {gate_cache-0.8.0 → gate_cache-0.9.0}/pyproject.toml +1 -1
  4. {gate_cache-0.8.0 → gate_cache-0.9.0}/pyproject.toml.orig +1 -1
  5. {gate_cache-0.8.0 → gate_cache-0.9.0}/src/gate_cache/__init__.py +1 -1
  6. gate_cache-0.9.0/src/gate_cache/agent/prompt.md +24 -0
  7. {gate_cache-0.8.0 → gate_cache-0.9.0}/src/gate_cache/agent/skill.md +7 -3
  8. {gate_cache-0.8.0 → gate_cache-0.9.0}/src/gate_cache/cli.py +6 -5
  9. {gate_cache-0.8.0 → gate_cache-0.9.0}/src/gate_cache/dashboard/app.py +1 -1
  10. {gate_cache-0.8.0 → gate_cache-0.9.0}/src/gate_cache/dashboard/server.py +57 -8
  11. gate_cache-0.9.0/src/gate_cache/dashboard/static/assets/Arc.svelte-CNpcs8X3.js +1 -0
  12. gate_cache-0.9.0/src/gate_cache/dashboard/static/assets/Bar-0aBK7UpN.js +1 -0
  13. gate_cache-0.9.0/src/gate_cache/dashboard/static/assets/BrushContext.svelte-CCZcZhce.js +1 -0
  14. gate_cache-0.9.0/src/gate_cache/dashboard/static/assets/ChartAnnotations.svelte-rQYciYRB.js +1 -0
  15. gate_cache-0.9.0/src/gate_cache/dashboard/static/assets/DefaultTooltip-B5CAhh2Q.css +1 -0
  16. gate_cache-0.9.0/src/gate_cache/dashboard/static/assets/DefaultTooltip-CY_C86gN.js +1 -0
  17. gate_cache-0.8.0/src/gate_cache/dashboard/static/assets/Labels-OE4x1xdX.js → gate_cache-0.9.0/src/gate_cache/dashboard/static/assets/Labels-DR5FYZws.js +1 -1
  18. gate_cache-0.9.0/src/gate_cache/dashboard/static/assets/Legend-d30gUpuK.js +1 -0
  19. gate_cache-0.8.0/src/gate_cache/dashboard/static/assets/Path.canvas-BJu5Zu14.js → gate_cache-0.9.0/src/gate_cache/dashboard/static/assets/Path.canvas-DOOOEuJg.js +1 -1
  20. gate_cache-0.9.0/src/gate_cache/dashboard/static/assets/Path.svg-BEFmR18I.js +2 -0
  21. gate_cache-0.9.0/src/gate_cache/dashboard/static/assets/Points-Boe_SZ9_.js +1 -0
  22. gate_cache-0.9.0/src/gate_cache/dashboard/static/assets/Points.html-DjDCSC2I.js +1 -0
  23. gate_cache-0.9.0/src/gate_cache/dashboard/static/assets/Spline-1ZDp-X2F.js +1 -0
  24. gate_cache-0.9.0/src/gate_cache/dashboard/static/assets/TransformContext.svelte-BICq8-YE.js +1 -0
  25. gate_cache-0.9.0/src/gate_cache/dashboard/static/assets/Voronoi.svelte-UEy6r0as.js +1 -0
  26. gate_cache-0.8.0/src/gate_cache/dashboard/static/assets/d3-scale-DJX62D6g.js → gate_cache-0.9.0/src/gate_cache/dashboard/static/assets/d3-scale-BZIMHxO8.js +1 -1
  27. gate_cache-0.9.0/src/gate_cache/dashboard/static/assets/index-Bp9x91ei.css +1 -0
  28. gate_cache-0.9.0/src/gate_cache/dashboard/static/assets/index-CYgojWsw.js +21 -0
  29. gate_cache-0.9.0/src/gate_cache/dashboard/static/assets/index-client-B3yOqiGu.js +2 -0
  30. gate_cache-0.8.0/src/gate_cache/dashboard/static/assets/key.svelte-x8TjJ5F6.js → gate_cache-0.9.0/src/gate_cache/dashboard/static/assets/key.svelte-B7SM1zzp.js +1 -1
  31. gate_cache-0.9.0/src/gate_cache/dashboard/static/assets/scales.svelte-CzvR6oHT.js +1 -0
  32. gate_cache-0.9.0/src/gate_cache/dashboard/static/assets/transition-7dBkedGA.js +6 -0
  33. {gate_cache-0.8.0 → gate_cache-0.9.0}/src/gate_cache/dashboard/static/index.html +8 -8
  34. {gate_cache-0.8.0 → gate_cache-0.9.0}/src/gate_cache/stats/archive.py +22 -4
  35. {gate_cache-0.8.0 → gate_cache-0.9.0}/src/gate_cache/stats/queries.py +346 -77
  36. gate_cache-0.8.0/src/gate_cache/agent/prompt.md +0 -11
  37. gate_cache-0.8.0/src/gate_cache/dashboard/static/assets/Arc.svelte-BJ8loEOb.js +0 -1
  38. gate_cache-0.8.0/src/gate_cache/dashboard/static/assets/Bar-DQUfE5ZY.js +0 -1
  39. gate_cache-0.8.0/src/gate_cache/dashboard/static/assets/BrushContext.svelte-C-wFbghj.js +0 -1
  40. gate_cache-0.8.0/src/gate_cache/dashboard/static/assets/ChartAnnotations.svelte-B2_NW2WT.js +0 -1
  41. gate_cache-0.8.0/src/gate_cache/dashboard/static/assets/DefaultTooltip-C53ir0g7.css +0 -1
  42. gate_cache-0.8.0/src/gate_cache/dashboard/static/assets/DefaultTooltip-S6pJdSim.js +0 -1
  43. gate_cache-0.8.0/src/gate_cache/dashboard/static/assets/Legend-CwKDgmED.js +0 -1
  44. gate_cache-0.8.0/src/gate_cache/dashboard/static/assets/Path.svg-CMpSs27p.js +0 -2
  45. gate_cache-0.8.0/src/gate_cache/dashboard/static/assets/Points-CaIpnL4S.js +0 -1
  46. gate_cache-0.8.0/src/gate_cache/dashboard/static/assets/Points.html-6PBuO4Yr.js +0 -1
  47. gate_cache-0.8.0/src/gate_cache/dashboard/static/assets/Spline-CheNKKUI.js +0 -1
  48. gate_cache-0.8.0/src/gate_cache/dashboard/static/assets/TransformContext.svelte-CJ1x6IlJ.js +0 -1
  49. gate_cache-0.8.0/src/gate_cache/dashboard/static/assets/Voronoi.svelte-C4J_TVhL.js +0 -1
  50. gate_cache-0.8.0/src/gate_cache/dashboard/static/assets/index-3jI0ZFKA.js +0 -18
  51. gate_cache-0.8.0/src/gate_cache/dashboard/static/assets/index-BFVfitfh.css +0 -1
  52. gate_cache-0.8.0/src/gate_cache/dashboard/static/assets/index-client-y1DkY4QG.js +0 -2
  53. gate_cache-0.8.0/src/gate_cache/dashboard/static/assets/scales.svelte-D57BD9dU.js +0 -1
  54. gate_cache-0.8.0/src/gate_cache/dashboard/static/assets/transition-C58PZtCD.js +0 -4
  55. {gate_cache-0.8.0 → gate_cache-0.9.0}/LICENSE +0 -0
  56. {gate_cache-0.8.0 → gate_cache-0.9.0}/src/gate_cache/config.py +0 -0
  57. {gate_cache-0.8.0 → gate_cache-0.9.0}/src/gate_cache/console.py +0 -0
  58. {gate_cache-0.8.0 → gate_cache-0.9.0}/src/gate_cache/dashboard/__init__.py +0 -0
  59. {gate_cache-0.8.0 → gate_cache-0.9.0}/src/gate_cache/dashboard/static/assets/Bar-DcuSsIRy.css +0 -0
  60. {gate_cache-0.8.0 → gate_cache-0.9.0}/src/gate_cache/dashboard/static/assets/Labels-sEaJtb97.css +0 -0
  61. {gate_cache-0.8.0 → gate_cache-0.9.0}/src/gate_cache/dashboard/static/assets/Legend-DeowBKKb.css +0 -0
  62. {gate_cache-0.8.0 → gate_cache-0.9.0}/src/gate_cache/dashboard/static/assets/Path-MiPiAzgz.css +0 -0
  63. {gate_cache-0.8.0 → gate_cache-0.9.0}/src/gate_cache/dashboard/static/assets/d3-quadtree-DlddCuIi.js +0 -0
  64. {gate_cache-0.8.0 → gate_cache-0.9.0}/src/gate_cache/dashboard/static/favicon.svg +0 -0
  65. {gate_cache-0.8.0 → gate_cache-0.9.0}/src/gate_cache/dashboard/static/theme.js +0 -0
  66. {gate_cache-0.8.0 → gate_cache-0.9.0}/src/gate_cache/env.py +0 -0
  67. {gate_cache-0.8.0 → gate_cache-0.9.0}/src/gate_cache/gate.py +0 -0
  68. {gate_cache-0.8.0 → gate_cache-0.9.0}/src/gate_cache/gate_lock.py +0 -0
  69. {gate_cache-0.8.0 → gate_cache-0.9.0}/src/gate_cache/git.py +0 -0
  70. {gate_cache-0.8.0 → gate_cache-0.9.0}/src/gate_cache/markers.py +0 -0
  71. {gate_cache-0.8.0 → gate_cache-0.9.0}/src/gate_cache/runner.py +0 -0
  72. {gate_cache-0.8.0 → gate_cache-0.9.0}/src/gate_cache/scratch.py +0 -0
  73. {gate_cache-0.8.0 → gate_cache-0.9.0}/src/gate_cache/snapshot.py +0 -0
  74. {gate_cache-0.8.0 → gate_cache-0.9.0}/src/gate_cache/stats/__init__.py +0 -0
  75. {gate_cache-0.8.0 → gate_cache-0.9.0}/src/gate_cache/stats/clear.py +0 -0
  76. {gate_cache-0.8.0 → gate_cache-0.9.0}/src/gate_cache/stats/config.py +0 -0
  77. {gate_cache-0.8.0 → gate_cache-0.9.0}/src/gate_cache/stats/context.py +0 -0
  78. {gate_cache-0.8.0 → gate_cache-0.9.0}/src/gate_cache/stats/lock.py +0 -0
  79. {gate_cache-0.8.0 → gate_cache-0.9.0}/src/gate_cache/stats/recorder.py +0 -0
  80. {gate_cache-0.8.0 → gate_cache-0.9.0}/src/gate_cache/wait_settings.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: gate-cache
3
- Version: 0.8.0
3
+ Version: 0.9.0
4
4
  Summary: Skip lint and test gates that already passed on the exact same git tree.
5
5
  Author: Nate Landau
6
6
  Author-email: Nate Landau <github@natenate.org>
@@ -74,9 +74,11 @@ Run `uvx gate-cache --prompt` and follow the instructions that it prints.
74
74
 
75
75
  The agent reads the guide that gate-cache prints and asks you which commands to wrap, how to install gate-cache, which gates to scope to their paths, and whether git hooks run the gates. Then it wraps the commands, makes sure that each gate works, and stops before it commits. The instructions always match the version of gate-cache that the agent runs.
76
76
 
77
+ If the repository already uses gate-cache, the agent reviews the setup instead. It compares each gate with the guide of the latest gate-cache release, and reports any defects and any features that the setup does not use. It changes nothing until you choose which recommendations to apply.
78
+
77
79
  Two flags print text for agents:
78
80
 
79
- - `gate-cache --prompt` prints the setup task that the agent follows.
81
+ - `gate-cache --prompt` prints the setup and review task that the agent follows.
80
82
  - `gate-cache --skill` prints the guide for an agent that works in a repository that uses gate-cache. The output is a `SKILL.md` file. To give it to Claude Code in every session, save it as a skill:
81
83
 
82
84
  ```sh
@@ -152,7 +154,7 @@ gate-cache works with [prek](https://github.com/j178/prek) and with [pre-commit]
152
154
  ```yaml
153
155
  repos:
154
156
  - repo: https://github.com/natelandau/gate-cache
155
- rev: v0.8.0
157
+ rev: v0.9.0
156
158
  hooks:
157
159
  - id: gate-cache
158
160
  name: pytest
@@ -204,21 +206,23 @@ An absolute path in the command, such as `{{ justfile_directory() }}/tests`, put
204
206
 
205
207
  ### Inputs that git does not track
206
208
 
207
- A marker does not cover ignored files, environment variables, or tool versions. To make a gate depend on one of these inputs, put its value in the name. When the value changes, the name changes, so no marker matches and the command runs again:
209
+ A marker does not cover ignored files, environment variables, or tool versions. To make a gate depend on one of these inputs, put its value in the name, after an `@`. When the value changes, the name changes, so no marker matches and the command runs again:
208
210
 
209
211
  ```just
210
212
  # Run again when the uv version changes
211
213
  test:
212
- gate-cache --name "test-uv$(uv --version | cut -d' ' -f2)" -- uv run pytest
214
+ gate-cache --name "test@uv$(uv --version | cut -d' ' -f2)" -- uv run pytest
213
215
 
214
216
  # Run again when the ignored .env file changes
215
217
  integration:
216
- gate-cache --name "integration-$(git hash-object .env)" -- uv run pytest tests/integration
218
+ gate-cache --name "integration@$(git hash-object .env)" -- uv run pytest tests/integration
217
219
  ```
218
220
 
221
+ The text before the first `@` is the gate, and the text after it is the key. The stats dashboard counts the runs of every key toward the gate, so `test@uv0.13.0` and `test@uv0.14.0` show as one gate, `test`. This rule applies only to a name with no spaces and with text on both sides of the `@`. A name with a space, such as a command line, is one gate. To key on more than one input, join the values after one `@`, such as `test@node22-3f2a9c`.
222
+
219
223
  `git hash-object` prints a hash of the file, so the name does not hold the secrets in `.env`. Do not put a secret value in a name, because the marker and `gate-cache status` record the name as plain text. Without `--name`, the command line is the name, so give `--name` to a command that takes a secret as an argument.
220
224
 
221
- The shell of the recipe expands `$(...)` before gate-cache starts. A hook `entry` or `args` list does not go through a shell, so put the command in a recipe and call the recipe from the hook. To look up the gate with `gate-cache status --name`, give the expanded name, such as `test-uv0.13.0`.
225
+ The shell of the recipe expands `$(...)` before gate-cache starts. A hook `entry` or `args` list does not go through a shell, so put the command in a recipe and call the recipe from the hook. To look up the gate with `gate-cache status --name`, give the expanded name, such as `test@uv0.13.0`.
222
226
 
223
227
  ### Makefile
224
228
 
@@ -383,7 +387,18 @@ gate-cache dashboard
383
387
 
384
388
  The dashboard listens on `127.0.0.1` and opens in your browser. It listens on port 7878, or on a free port when 7878 is taken. With `--port N`, it listens on that port only, and the command fails when the port is in use. With `--no-browser`, it does not open a browser. Only one dashboard runs at a time. A second `gate-cache dashboard` prints the address of the running one and opens it, unless you give `--no-browser`. Press Ctrl-C to stop it.
385
389
 
386
- The dashboard has pages for an overview, gates, recent activity, and flaky gates. The range picker at the top sets the time range. You can pick a relative range such as 7 days, a calendar period such as This week, or custom dates. The repo filter at the top accepts several repositories at once. On the overview, the Breakdown panel groups the runs by repo, gate, source (such as a git hook, CI, or a coding agent), branch, or machine. Click a repo to filter the dashboard to it, a gate to open its details, or any other row to see its runs. To scope the overview to some days, click a day on the calendar or the daily chart, or drag across days on the daily chart. Click the same day again or remove the chip to see the whole range again. A count on the overview, such as failures or an outcome, opens the Activity page with the runs that the count stands for. The dashboard updates while it runs, so new runs appear within seconds. The theme button at the top right cycles between the system theme (the default), light, and dark, and the dashboard remembers your choice.
390
+ The dashboard has pages for an overview, gates, recent activity, and flaky gates. The range picker at the top sets the time range. You can pick a relative range such as 7 days, a calendar period such as This week, or custom dates. The repo filter at the top accepts several repositories at once. On the overview, the Breakdown panel groups the runs by repo, gate, source (such as a git hook, CI, or a coding agent), branch, or machine. Click a repo to filter the dashboard to it, a gate to open its details, or any other row to see its runs. A gate that ran without `--name` shows its command line on one line, and you see the full command when you hover over it. When a gate has more than one key, the gate details, Activity, Recent failures, and Flaky show the key of each run. To scope the overview to some days, click a day on the calendar or the daily chart, or drag across days on the daily chart. Click the same day again or remove the chip to see the whole range again. A count on the overview, such as failures or an outcome, opens the Activity page with the runs that the count stands for. The dashboard updates while it runs, so new runs appear within seconds. The theme button at the top right cycles between the system theme (the default), light, and dark, and the dashboard remembers your choice.
391
+
392
+ The dashboard also shows what your gates cost to run. The Time gates ran card is the total time that gates ran, failed runs included, with its change against the previous period. It does not count the time that gate-cache itself used or waited. Under the daily chart, the Time gates ran chart shows one bar per day, split into the five gates that took the most time and Other. It has All, Passing, and Failing views, and you pick days on it the same way as on the daily chart. A legend entry opens the details of that gate. Top gates can rank by Time ran and shows the average and median run time of each gate. The Breakdown panel has a Time ran column, and Avg run and Median run columns when it groups by gate. Click a column header to sort by it. A header with a dotted underline explains its column when you hover or focus it, and an info icon on a headline card does the same for the card. The first column of a wide table stays in view while the table scrolls sideways. The Gates table adds these columns:
393
+
394
+ - Time ran: the total time that the gate ran.
395
+ - Avg run, Median run, and p90 run: the average run time of the passing runs, and the run times that half and nine tenths of them do not exceed.
396
+ - CPU/wall: the CPU seconds per second of run time. A value near 1x means that the gate used one core.
397
+ - Peak memory: the highest memory use of a run.
398
+ - Saved by cache: the run time that skipped calls did not spend.
399
+ - Lost to failures: the time that failed runs used.
400
+
401
+ The details of a gate show a histogram of its run times, which needs 5 passing runs. They split failures into early failures, which ended before half of the median passing run, and late failures. They also show the time that the gate ran by source. Average, median, and p90 count passing runs only. CPU and memory show only for runs that recorded them. Skipped runs and runs from older gate-cache versions show n/a.
387
402
 
388
403
  `gate-cache stats clear` permanently deletes all recorded stats. You cannot undo it. Like `gate-cache clear`, it shows a warning and asks you to type `yes`. Any other answer stops the command with exit code 1, and no stats are deleted. While it waits for your answer, `gate-cache dashboard` cannot start, and it reports that a dashboard is already running or that stats clear is in progress. If standard input is not a terminal, as in a script, the command refuses with exit code 1 unless you give `--yes` (or `-y`):
389
404
 
@@ -413,7 +428,7 @@ Each run of a gate adds one event with these fields:
413
428
  - the full command line, when `--name` gives a name that is not the command line
414
429
  - the time the run waited for another run of the same gate, whether the wait reached its limit, and whether the run reported the failure of that run instead of running the command
415
430
 
416
- An event holds no command output and no file content. The gate name is the command line unless you give `--name`, so a secret in a command line is in the record. When you give `--name`, the event also holds the command line, so a secret that you give to the command as an argument is in the record. Never put a secret in a gate name or in a command line. The working tree path and the host name often contain your user name or your real name. The machine ID is random and does not identify you. Recording is off until you turn it on. The data never leaves your machine, and `gate-cache stats clear` deletes it. The dashboard listens only on `127.0.0.1` and rejects requests for any other host name. Its pages load scripts, styles, and images only from the dashboard itself, and other sites cannot show the dashboard in a frame.
431
+ An event holds no command output and no file content. The gate name is the command line unless you give `--name`, so a secret in a command line is in the record. When you give `--name`, the event also holds the command line, so a secret that you give to the command as an argument is in the record. Never put a secret in a gate name or in a command line. The working tree path and the host name often contain your user name or your real name. The machine ID is random and does not identify you. Recording is off until you turn it on. The data never leaves your machine, and `gate-cache stats clear` deletes it. The dashboard listens only on `127.0.0.1` and rejects requests for any other host name. Its pages load scripts, styles, and images only from the dashboard itself, and other sites cannot show the dashboard in a frame. The one outside request is the dashboard font, Geist, from `cdn.jsdelivr.net`. That request sends no stats data. Without a connection to jsDelivr, the dashboard uses your system font.
417
432
 
418
433
  ### When recording is on
419
434
 
@@ -38,9 +38,11 @@ Run `uvx gate-cache --prompt` and follow the instructions that it prints.
38
38
 
39
39
  The agent reads the guide that gate-cache prints and asks you which commands to wrap, how to install gate-cache, which gates to scope to their paths, and whether git hooks run the gates. Then it wraps the commands, makes sure that each gate works, and stops before it commits. The instructions always match the version of gate-cache that the agent runs.
40
40
 
41
+ If the repository already uses gate-cache, the agent reviews the setup instead. It compares each gate with the guide of the latest gate-cache release, and reports any defects and any features that the setup does not use. It changes nothing until you choose which recommendations to apply.
42
+
41
43
  Two flags print text for agents:
42
44
 
43
- - `gate-cache --prompt` prints the setup task that the agent follows.
45
+ - `gate-cache --prompt` prints the setup and review task that the agent follows.
44
46
  - `gate-cache --skill` prints the guide for an agent that works in a repository that uses gate-cache. The output is a `SKILL.md` file. To give it to Claude Code in every session, save it as a skill:
45
47
 
46
48
  ```sh
@@ -116,7 +118,7 @@ gate-cache works with [prek](https://github.com/j178/prek) and with [pre-commit]
116
118
  ```yaml
117
119
  repos:
118
120
  - repo: https://github.com/natelandau/gate-cache
119
- rev: v0.8.0
121
+ rev: v0.9.0
120
122
  hooks:
121
123
  - id: gate-cache
122
124
  name: pytest
@@ -168,21 +170,23 @@ An absolute path in the command, such as `{{ justfile_directory() }}/tests`, put
168
170
 
169
171
  ### Inputs that git does not track
170
172
 
171
- A marker does not cover ignored files, environment variables, or tool versions. To make a gate depend on one of these inputs, put its value in the name. When the value changes, the name changes, so no marker matches and the command runs again:
173
+ A marker does not cover ignored files, environment variables, or tool versions. To make a gate depend on one of these inputs, put its value in the name, after an `@`. When the value changes, the name changes, so no marker matches and the command runs again:
172
174
 
173
175
  ```just
174
176
  # Run again when the uv version changes
175
177
  test:
176
- gate-cache --name "test-uv$(uv --version | cut -d' ' -f2)" -- uv run pytest
178
+ gate-cache --name "test@uv$(uv --version | cut -d' ' -f2)" -- uv run pytest
177
179
 
178
180
  # Run again when the ignored .env file changes
179
181
  integration:
180
- gate-cache --name "integration-$(git hash-object .env)" -- uv run pytest tests/integration
182
+ gate-cache --name "integration@$(git hash-object .env)" -- uv run pytest tests/integration
181
183
  ```
182
184
 
185
+ The text before the first `@` is the gate, and the text after it is the key. The stats dashboard counts the runs of every key toward the gate, so `test@uv0.13.0` and `test@uv0.14.0` show as one gate, `test`. This rule applies only to a name with no spaces and with text on both sides of the `@`. A name with a space, such as a command line, is one gate. To key on more than one input, join the values after one `@`, such as `test@node22-3f2a9c`.
186
+
183
187
  `git hash-object` prints a hash of the file, so the name does not hold the secrets in `.env`. Do not put a secret value in a name, because the marker and `gate-cache status` record the name as plain text. Without `--name`, the command line is the name, so give `--name` to a command that takes a secret as an argument.
184
188
 
185
- The shell of the recipe expands `$(...)` before gate-cache starts. A hook `entry` or `args` list does not go through a shell, so put the command in a recipe and call the recipe from the hook. To look up the gate with `gate-cache status --name`, give the expanded name, such as `test-uv0.13.0`.
189
+ The shell of the recipe expands `$(...)` before gate-cache starts. A hook `entry` or `args` list does not go through a shell, so put the command in a recipe and call the recipe from the hook. To look up the gate with `gate-cache status --name`, give the expanded name, such as `test@uv0.13.0`.
186
190
 
187
191
  ### Makefile
188
192
 
@@ -347,7 +351,18 @@ gate-cache dashboard
347
351
 
348
352
  The dashboard listens on `127.0.0.1` and opens in your browser. It listens on port 7878, or on a free port when 7878 is taken. With `--port N`, it listens on that port only, and the command fails when the port is in use. With `--no-browser`, it does not open a browser. Only one dashboard runs at a time. A second `gate-cache dashboard` prints the address of the running one and opens it, unless you give `--no-browser`. Press Ctrl-C to stop it.
349
353
 
350
- The dashboard has pages for an overview, gates, recent activity, and flaky gates. The range picker at the top sets the time range. You can pick a relative range such as 7 days, a calendar period such as This week, or custom dates. The repo filter at the top accepts several repositories at once. On the overview, the Breakdown panel groups the runs by repo, gate, source (such as a git hook, CI, or a coding agent), branch, or machine. Click a repo to filter the dashboard to it, a gate to open its details, or any other row to see its runs. To scope the overview to some days, click a day on the calendar or the daily chart, or drag across days on the daily chart. Click the same day again or remove the chip to see the whole range again. A count on the overview, such as failures or an outcome, opens the Activity page with the runs that the count stands for. The dashboard updates while it runs, so new runs appear within seconds. The theme button at the top right cycles between the system theme (the default), light, and dark, and the dashboard remembers your choice.
354
+ The dashboard has pages for an overview, gates, recent activity, and flaky gates. The range picker at the top sets the time range. You can pick a relative range such as 7 days, a calendar period such as This week, or custom dates. The repo filter at the top accepts several repositories at once. On the overview, the Breakdown panel groups the runs by repo, gate, source (such as a git hook, CI, or a coding agent), branch, or machine. Click a repo to filter the dashboard to it, a gate to open its details, or any other row to see its runs. A gate that ran without `--name` shows its command line on one line, and you see the full command when you hover over it. When a gate has more than one key, the gate details, Activity, Recent failures, and Flaky show the key of each run. To scope the overview to some days, click a day on the calendar or the daily chart, or drag across days on the daily chart. Click the same day again or remove the chip to see the whole range again. A count on the overview, such as failures or an outcome, opens the Activity page with the runs that the count stands for. The dashboard updates while it runs, so new runs appear within seconds. The theme button at the top right cycles between the system theme (the default), light, and dark, and the dashboard remembers your choice.
355
+
356
+ The dashboard also shows what your gates cost to run. The Time gates ran card is the total time that gates ran, failed runs included, with its change against the previous period. It does not count the time that gate-cache itself used or waited. Under the daily chart, the Time gates ran chart shows one bar per day, split into the five gates that took the most time and Other. It has All, Passing, and Failing views, and you pick days on it the same way as on the daily chart. A legend entry opens the details of that gate. Top gates can rank by Time ran and shows the average and median run time of each gate. The Breakdown panel has a Time ran column, and Avg run and Median run columns when it groups by gate. Click a column header to sort by it. A header with a dotted underline explains its column when you hover or focus it, and an info icon on a headline card does the same for the card. The first column of a wide table stays in view while the table scrolls sideways. The Gates table adds these columns:
357
+
358
+ - Time ran: the total time that the gate ran.
359
+ - Avg run, Median run, and p90 run: the average run time of the passing runs, and the run times that half and nine tenths of them do not exceed.
360
+ - CPU/wall: the CPU seconds per second of run time. A value near 1x means that the gate used one core.
361
+ - Peak memory: the highest memory use of a run.
362
+ - Saved by cache: the run time that skipped calls did not spend.
363
+ - Lost to failures: the time that failed runs used.
364
+
365
+ The details of a gate show a histogram of its run times, which needs 5 passing runs. They split failures into early failures, which ended before half of the median passing run, and late failures. They also show the time that the gate ran by source. Average, median, and p90 count passing runs only. CPU and memory show only for runs that recorded them. Skipped runs and runs from older gate-cache versions show n/a.
351
366
 
352
367
  `gate-cache stats clear` permanently deletes all recorded stats. You cannot undo it. Like `gate-cache clear`, it shows a warning and asks you to type `yes`. Any other answer stops the command with exit code 1, and no stats are deleted. While it waits for your answer, `gate-cache dashboard` cannot start, and it reports that a dashboard is already running or that stats clear is in progress. If standard input is not a terminal, as in a script, the command refuses with exit code 1 unless you give `--yes` (or `-y`):
353
368
 
@@ -377,7 +392,7 @@ Each run of a gate adds one event with these fields:
377
392
  - the full command line, when `--name` gives a name that is not the command line
378
393
  - the time the run waited for another run of the same gate, whether the wait reached its limit, and whether the run reported the failure of that run instead of running the command
379
394
 
380
- An event holds no command output and no file content. The gate name is the command line unless you give `--name`, so a secret in a command line is in the record. When you give `--name`, the event also holds the command line, so a secret that you give to the command as an argument is in the record. Never put a secret in a gate name or in a command line. The working tree path and the host name often contain your user name or your real name. The machine ID is random and does not identify you. Recording is off until you turn it on. The data never leaves your machine, and `gate-cache stats clear` deletes it. The dashboard listens only on `127.0.0.1` and rejects requests for any other host name. Its pages load scripts, styles, and images only from the dashboard itself, and other sites cannot show the dashboard in a frame.
395
+ An event holds no command output and no file content. The gate name is the command line unless you give `--name`, so a secret in a command line is in the record. When you give `--name`, the event also holds the command line, so a secret that you give to the command as an argument is in the record. Never put a secret in a gate name or in a command line. The working tree path and the host name often contain your user name or your real name. The machine ID is random and does not identify you. Recording is off until you turn it on. The data never leaves your machine, and `gate-cache stats clear` deletes it. The dashboard listens only on `127.0.0.1` and rejects requests for any other host name. Its pages load scripts, styles, and images only from the dashboard itself, and other sites cannot show the dashboard in a frame. The one outside request is the dashboard font, Geist, from `cdn.jsdelivr.net`. That request sends no stats data. Without a connection to jsDelivr, the dashboard uses your system font.
381
396
 
382
397
  ### When recording is on
383
398
 
@@ -11,7 +11,7 @@ description = "Skip lint and test gates that already passed on the exact same gi
11
11
  name = "gate-cache"
12
12
  readme = "README.md"
13
13
  requires-python = ">=3.11"
14
- version = "0.8.0"
14
+ version = "0.9.0"
15
15
 
16
16
  [[project.authors]]
17
17
  name = "Nate Landau"
@@ -15,7 +15,7 @@
15
15
  name = "gate-cache"
16
16
  readme = "README.md"
17
17
  requires-python = ">=3.11"
18
- version = "0.8.0"
18
+ version = "0.9.0"
19
19
 
20
20
  [project.scripts]
21
21
  gate-cache = "gate_cache.cli:main"
@@ -1,3 +1,3 @@
1
1
  """Skip lint and test gates that already passed on the exact same git tree."""
2
2
 
3
- __version__ = "0.8.0"
3
+ __version__ = "0.9.0"
@@ -0,0 +1,24 @@
1
+ # Set up gate-cache in this repository
2
+
3
+ 1. Run `gate-cache --skill` and read the guide that it prints. If `gate-cache` is not on the `PATH`, run `uvx gate-cache --skill`.
4
+ 2. Search the repository for `gate-cache` and `gate_cache`. Look in task-runner files, scripts, hook config, dependency manifests, and the agent instruction file. If gate-cache is already in use, do the steps in "Review an existing setup". If not, do the steps in "Add gate-cache".
5
+
6
+ ## Add gate-cache
7
+
8
+ 1. Find the lint, format check, type check, and test commands of this repository. Then ask the user these questions before you change anything:
9
+ - Which of these commands do you want gate-cache to wrap? Show the list that you found.
10
+ - How do you want to install gate-cache: as a dev dependency, in a tool manifest such as `mise.toml`, or with `uvx`?
11
+ - Do you want to scope any gate to the paths that it reads, so that a change in another part of the repository does not run it again? Show the paths that you propose for each gate.
12
+ - Do any of these commands depend on an input that git does not track, such as an `.env` file, a tool version, or an external service?
13
+ - Do you want git hooks to run the gates?
14
+ 2. Add gate-cache as the answers and the guide tell you. In the agent instruction file of the repository, such as `AGENTS.md` or `CLAUDE.md`, tell agents to run checks only through the wrapped commands and to run `gate-cache --skill` before they change a gate.
15
+ 3. Do the steps in the "Make sure that a gate works" section of the guide for each gate. Do not commit. Report what you changed.
16
+
17
+ ## Review an existing setup
18
+
19
+ The setup is probably correct. The user chose it, and it works for them. Do not change any file before the user answers your report. Make a recommendation only when you find a real defect or a gate-cache feature that the setup does not use and that helps this repository.
20
+
21
+ 1. Find the gate-cache version that the repository pins, in a lock file, a hook `rev:`, or a tool manifest. Run `uvx gate-cache@latest --version`. If the pinned version is older, read the guide of the latest version with `uvx gate-cache@latest --skill`, and read the entries between the two versions in the changelog at https://github.com/natelandau/gate-cache/blob/main/CHANGELOG.md.
22
+ 2. Compare each gate with the rules in the "Write a gate" section of the guide, the "Scope a gate with --path" section of the guide, and the "Rules" section of the guide. Also make sure that the agent instruction file tells agents to run checks only through the wrapped commands.
23
+ 3. Look for features that the setup does not use and that help this repository. An example is `--path` for a gate that reads only one part of a repository with several parts. If a copy of the guide is saved as a skill file, compare it with the output of `uvx gate-cache@latest --skill`.
24
+ 4. Report to the user. Give one line for each gate that says what it wraps and whether it is correct. Then list each defect and each recommendation, with the reason and the change that you propose. If you find nothing to change, say so. Ask the user which changes to make. Make only those changes, then do the steps in the "Make sure that a gate works" section of the guide for each gate that you changed. Do not commit.
@@ -55,18 +55,22 @@ The syntax is `gate-cache [--name NAME] [--path PATHSPEC]... -- COMMAND [ARGS...
55
55
 
56
56
  - Without `--name`, the name is the command line. Each set of arguments then has its own markers, so a pass of `pytest -k unit` never skips `pytest`.
57
57
  - With `--name`, the arguments are not part of the key. Give a short, stable name, such as `lint`, `typecheck`, or `test`, to a gate whose command line is fixed.
58
+ - A gate in a recipe, a script, or a hook must have a `--name` when its command line is fixed. Without one, `gate-cache status` and the stats dashboard show the full command line as the gate name. A change to any argument then also starts a new gate with no history. A recipe that forwards its arguments is the exception, as the next item explains.
59
+ - Keep a name free of spaces, so that it reads as a name and the `@` rule in "Inputs that git does not see" applies to it.
58
60
  - If a recipe passes extra arguments to its command, such as a test filter, do not give it a fixed `--name`. With a fixed name, a pass with a filter also skips the full suite. When the recipe gets arguments, run the command without gate-cache. Another option is to give no `--name`.
59
61
  - The working directory is not part of the key. If the same command reads different files in different directories, give each directory its own name.
60
62
 
61
63
  ### Inputs that git does not see
62
64
 
63
- A marker covers only the name and the files that git does not ignore. It does not cover ignored files such as `.env`, environment variables, tool versions that no lock file pins, or external services. If a gate depends on one of these inputs, put the value in the name. A changed value gives a new name, so the command runs again:
65
+ A marker covers only the name and the files that git does not ignore. It does not cover ignored files such as `.env`, environment variables, tool versions that no lock file pins, or external services. If a gate depends on one of these inputs, put the value in the name, after an `@`. A changed value gives a new name, so the command runs again:
64
66
 
65
67
  ```sh
66
- gate-cache --name "test-node$(node --version)" -- npm test
67
- gate-cache --name "integration-$(git hash-object .env)" -- uv run pytest tests/integration
68
+ gate-cache --name "test@node$(node --version)" -- npm test
69
+ gate-cache --name "integration@$(git hash-object .env)" -- uv run pytest tests/integration
68
70
  ```
69
71
 
72
+ The text before the first `@` is the gate, and the text after it is the key. The stats dashboard counts the runs of every key toward the gate, so `test@nodev20.11.0` and `test@nodev22.1.0` show as one gate, `test`. The rule applies only to a name with no spaces and with text on both sides of the `@`. To key on more than one input, join the values after one `@`, or hash them together into one value. Do not use any other separator, such as `-`, for a key. With another separator, each value shows as its own gate.
73
+
70
74
  `git hash-object` prints a hash of the file, so the name does not hold the content of `.env`.
71
75
 
72
76
  Never put a secret in a name. Markers and `gate-cache status` store the name as plain text. Without `--name`, the command line is the name, so give `--name` to a command that takes a secret as an argument.
@@ -92,9 +92,10 @@ cover.
92
92
  Only the name and the file content are keyed. The working directory is not, so
93
93
  a command whose meaning depends on it needs a distinct --name. To also key on an
94
94
  ignored file, an environment variable, or a tool version, put its value in
95
- --name. A changed value gives a new name, so the command runs again. Never put a
96
- secret in a name, because markers and status store it as plain text. Give --name
97
- to a command that takes a secret argument.
95
+ --name after an @, as in test@v22. A changed value gives a new name, so the
96
+ command runs again, and stats count every value toward the gate before the @.
97
+ Never put a secret in a name, because markers and status store it as plain
98
+ text. Give --name to a command that takes a secret argument.
98
99
 
99
100
  --path scopes a gate to the files it reads, so a change elsewhere in the
100
101
  repository does not run it again. Each --path is a git pathspec, read from the
@@ -143,7 +144,7 @@ Environment:
143
144
  Typical use:
144
145
  gate-cache -- uv run pytest -x
145
146
  gate-cache --name pytest -- uv run pytest -x
146
- gate-cache --name "test-$(git hash-object .env)" -- uv run pytest
147
+ gate-cache --name "test@$(git hash-object .env)" -- uv run pytest
147
148
  gate-cache --name api-test --path api/ --path uv.lock -- uv run pytest api
148
149
  """
149
150
 
@@ -315,7 +316,7 @@ def _main_parser() -> argparse.ArgumentParser:
315
316
  action="store_const",
316
317
  dest="guide",
317
318
  const="prompt.md",
318
- help="Print a prompt that has a coding agent add gate-cache to a repository.",
319
+ help="Print a prompt that has a coding agent add gate-cache to a repository or review its setup.",
319
320
  )
320
321
  parser.add_argument(
321
322
  "--name",
@@ -81,7 +81,7 @@ def _serve(lock: InstanceLock, *, state: Path, port: int | None, open_browser: b
81
81
  """Run the server on the locked data directory while holding the instance lock."""
82
82
  static_dir = static_root()
83
83
  if static_dir is None:
84
- say(server_module.NO_UI_MESSAGE)
84
+ say(server_module.no_ui_message())
85
85
  return 1
86
86
  try:
87
87
  with Archive.open(state / ARCHIVE_NAME) as archive:
@@ -7,9 +7,12 @@ import errno
7
7
  import json
8
8
  import math
9
9
  import mimetypes
10
+ import os
10
11
  import re
12
+ import shutil
11
13
  import socket
12
14
  import sqlite3
15
+ import sys
13
16
  import threading
14
17
  import time
15
18
  from datetime import UTC, datetime
@@ -29,10 +32,6 @@ if TYPE_CHECKING:
29
32
 
30
33
  HOST = "127.0.0.1"
31
34
  UNKNOWN_REPO = "-"
32
- NO_UI_MESSAGE = (
33
- "This install has no dashboard UI. Install a release with `uv tool install gate-cache`, "
34
- "or build the UI in a source checkout with `uv run duty frontend_build`."
35
- )
36
35
 
37
36
  _MAX_LIMIT = 500
38
37
  _OK = 200
@@ -48,10 +47,11 @@ _HASHED_ASSETS = "assets"
48
47
  _IMMUTABLE = "public, max-age=31536000, immutable"
49
48
  # Files without a hash in the name, such as index.html, revalidate so a new release loads.
50
49
  _REVALIDATE = "no-cache"
51
- # The built UI loads every script, style, image, and API call from its own origin.
50
+ # The built UI loads every script, style, image, and API call from its own origin. Its one
51
+ # font comes from a pinned jsDelivr file; without it the page falls back to the system font.
52
52
  CONTENT_SECURITY_POLICY = (
53
- "default-src 'self'; base-uri 'none'; frame-ancestors 'none'; "
54
- "form-action 'none'; object-src 'none'"
53
+ "default-src 'self'; font-src 'self' https://cdn.jsdelivr.net; base-uri 'none'; "
54
+ "frame-ancestors 'none'; form-action 'none'; object-src 'none'"
55
55
  )
56
56
  _PAGE_HEADERS = (
57
57
  ("Content-Security-Policy", CONTENT_SECURITY_POLICY),
@@ -76,6 +76,48 @@ def static_root() -> Path | None:
76
76
  return root if (root / "index.html").is_file() else None
77
77
 
78
78
 
79
+ def _source_checkout() -> Path | None:
80
+ """Return the repository root when gate-cache runs from a source checkout, else None."""
81
+ root = Path(__file__).resolve().parents[3]
82
+ return root if (root / "frontend" / "package.json").is_file() else None
83
+
84
+
85
+ def _other_installs() -> list[str]:
86
+ """Return the gate-cache executables on PATH that belong to another install."""
87
+ running = Path(sys.prefix).resolve()
88
+ found: list[str] = []
89
+ seen: set[Path] = set()
90
+ for directory in os.environ.get("PATH", "").split(os.pathsep):
91
+ exe = shutil.which("gate-cache", path=directory) if directory else None
92
+ if exe is None:
93
+ continue
94
+ target = Path(exe).resolve()
95
+ if target.is_relative_to(running) or target in seen:
96
+ continue
97
+ seen.add(target)
98
+ found.append(exe)
99
+ return found
100
+
101
+
102
+ def no_ui_message() -> str:
103
+ """Explain why this install has no dashboard UI and how to get one."""
104
+ checkout = _source_checkout()
105
+ if checkout is None:
106
+ message = (
107
+ "This gate-cache was built from source and has no dashboard UI. "
108
+ "Install a release with `uv tool install gate-cache`."
109
+ )
110
+ else:
111
+ message = (
112
+ f"This gate-cache runs from the source checkout at {checkout}, which has no built "
113
+ "dashboard UI. Build it with `uv run duty frontend_build`."
114
+ )
115
+ others = _other_installs()
116
+ if others:
117
+ message += f" Or run another gate-cache on your PATH by its full path: {', '.join(others)}"
118
+ return message
119
+
120
+
79
121
  def _time(params: dict[str, list[str]], key: str) -> float | None:
80
122
  """Return a time query parameter as Unix seconds, or None when absent.
81
123
 
@@ -204,7 +246,7 @@ class _Handler(BaseHTTPRequestHandler):
204
246
  def _static(self, path: str) -> None:
205
247
  root = self.server.static_dir
206
248
  if root is None:
207
- self._send(_UNAVAILABLE, NO_UI_MESSAGE.encode(), "text/plain; charset=utf-8")
249
+ self._send(_UNAVAILABLE, no_ui_message().encode(), "text/plain; charset=utf-8")
208
250
  return
209
251
  base = root.resolve()
210
252
  assets = base / _HASHED_ASSETS
@@ -312,6 +354,12 @@ def _breakdown(server: DashboardServer, params: dict[str, list[str]]) -> dict[st
312
354
  return _query(server, lambda c: queries.breakdown(c, filters, by=by))
313
355
 
314
356
 
357
+ def _spent(server: DashboardServer, params: dict[str, list[str]]) -> dict[str, Any]:
358
+ status = _text(params, "status") or "all"
359
+ filters = _filters(params)
360
+ return _query(server, lambda c: queries.spent(c, filters, status=status)) # ty: ignore[invalid-argument-type]
361
+
362
+
315
363
  def _integer(params: dict[str, list[str]], key: str) -> int | None:
316
364
  """Return an integer query parameter, or None when absent or empty."""
317
365
  text = _text(params, key)
@@ -379,6 +427,7 @@ _ROUTES: dict[str, Callable[[DashboardServer, dict[str, list[str]]], dict[str, A
379
427
  "activity": _activity,
380
428
  "flaky": _simple(queries.flaky),
381
429
  "slowdowns": _timed(queries.slowdowns),
430
+ "spent": _spent,
382
431
  }
383
432
 
384
433
 
@@ -0,0 +1 @@
1
+ import"./index-client-B3yOqiGu.js";function e(){throw Error(`layerchart module ../Arc/Arc.svelte is stubbed out in vite.config.ts`)}export{e as default};
@@ -0,0 +1 @@
1
+ import{B as e}from"./d3-scale-BZIMHxO8.js";import{D as t,E as n,I as r,K as i,L as a,O as o,R as s,a as c,bt as l,c as u,ct as d,dt as f,et as p,ht as m,i as h,j as g,l as _,mt as v,n as y,nt as b,r as x,rt as S,ut as C,wt as w,y as T}from"./index-client-B3yOqiGu.js";import{H as E,R as D,V as O,o as k,t as A}from"./key.svelte-B7SM1zzp.js";import{c as j,n as M,o as N,r as P,s as F}from"./index-CYgojWsw.js";import{t as I}from"./Path.canvas-DOOOEuJg.js";var L=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`]);function R(t,n){m(n,!0);let r=x(n,L),i=new F(()=>r,`canvas`);function a(t,r,a,o,s,c,l,u){return t?e({styles:{strokeWidth:c??i.staticStrokeWidth}},t):{styles:{fill:r??n.fill,fillOpacity:o??i.staticFillOpacity,stroke:a??n.stroke,strokeOpacity:s??i.staticStrokeOpacity,strokeWidth:c??i.staticStrokeWidth,opacity:l??i.staticOpacity},classes:T(`lc-rect`,u??i.staticClassName),style:[n.style,i.dashArrayAttr?`stroke-dasharray: ${i.dashArrayAttr}`:void 0].filter(Boolean).join(`; `)||void 0}}function o(e,t){if(i.dataMode)for(let r of i.resolvedItems){let o=a(t,D(n.fill,r.d,i.chartCtx.cScale),D(n.stroke,r.d,i.chartCtx.cScale),O(n.fillOpacity,r.d),O(n.strokeOpacity,r.d),O(n.strokeWidth,r.d),O(n.opacity,r.d),O(n.class,r.d));r.faces?i.chartCtx.isometric.renderBoxFaces(e,r.faces,o,t):k(e,{x:r.x,y:r.y,width:r.width,height:r.height,rx:i.rx,ry:i.ry,corners:i.resolveCorners(r.width,r.height)},o)}else if(i.pixelFaces)i.chartCtx.isometric.renderBoxFaces(e,i.pixelFaces,a(t),t);else{let n=a(t);k(e,{x:i.motionX,y:i.motionY,width:i.motionWidth,height:i.motionHeight,rx:i.rx,ry:i.ry,corners:i.resolvedCorners},n)}}let s=A(()=>n.fill),c=A(()=>n.stroke);i.chartCtx.registerComponent({name:`Rect`,kind:`mark`,markInfo:()=>j(r,i.dataMode),canvasRender:{render:o,depth:()=>i.paintDepth,events:{click:n.onclick,dblclick:n.ondblclick,pointerdown:n.onpointerdown,pointerenter:n.onpointerenter,pointermove:n.onpointermove,pointerleave:n.onpointerleave,pointerover:n.onpointerover,pointerout:n.onpointerout},deps:()=>[i.dataMode,i.dataMode?i.resolvedItems:null,i.pixelFaces,i.motionX,i.motionY,i.motionWidth,i.motionHeight,s.current,c.current,n.fillOpacity,n.strokeOpacity,n.strokeWidth,n.opacity,n.class,n.style,i.rx,i.ry,i.resolvedCorners,i.dashArrayAttr]}}),v()}var z=new Set([`$$slots`,`$$events`,`$$legacy`]);function B(e,t){let n=x(t,z);N(e,h({get Path(){return I}},()=>n))}var V=new Set([`$$slots`,`$$events`,`$$legacy`]);function H(e,t){let n=x(t,V);P(e,h({get Rect(){return R},get Arc(){return B}},()=>n))}var U=new Set([`$$slots`,`$$events`,`$$legacy`,`children`,`ref`]),W=s(`<div></div>`),G=s(`<div><!></div>`);function K(e,s){m(s,!0);let h=y(s,`ref`,15),E=x(s,U),k=C(void 0);p(()=>{h(i(k))});let A=new F(()=>E,`html`),M=f(()=>{let{z:e,shade:t,...n}=E;return n});A.chartCtx.registerComponent({name:`Rect`,kind:`mark`,markInfo:()=>j(E,A.dataMode)});var N=a(),P=S(N),I=e=>{var t=a(),c=S(t);o(c,17,()=>A.resolvedItems,e=>e.key,(e,t)=>{let o=f(()=>D(s.fill,i(t).d,A.chartCtx.cScale)),c=f(()=>D(s.stroke,i(t).d,A.chartCtx.cScale)),l=f(()=>O(s.strokeWidth,i(t).d)),d=f(()=>O(s.opacity,i(t).d)),p=f(()=>O(s.class,i(t).d)),m=f(()=>i(l)==null?i(c)==null?void 0:`1px`:`${i(l)}px`);var h=a(),v=S(h),y=e=>{let s=f(()=>A.chartCtx.isometric.RectBoxHtml);var c=a(),l=S(c);n(l,()=>i(s),(e,n)=>{n(e,{get faces(){return i(t).faces},get fill(){return i(o)},get opacity(){return i(d)},get class(){return i(p)},get attrs(){return i(M)}})}),r(e,c)},b=e=>{var n=W();_(n,(e,n)=>({...i(M),class:e,[u]:{position:`absolute`,left:`${i(t).x??``}px`,top:`${i(t).y??``}px`,width:`${i(t).width??``}px`,height:`${i(t).height??``}px`,background:i(o),"background-origin":`border-box`,opacity:i(d),"border-width":i(m),"border-style":A.dashArrayResolved?`dashed`:`solid`,"border-color":i(c),"border-radius":n}}),[()=>T(`lc-rect`,i(p)),()=>A.borderRadius(i(t).width,i(t).height)??`${A.rx}px`]),r(e,n)};g(v,e=>{i(t).faces?e(y):e(b,-1)}),r(e,h)}),r(e,t)},L=e=>{let t=f(()=>A.chartCtx.isometric.RectBoxHtml);var o=a(),s=S(o);n(s,()=>i(t),(e,t)=>{t(e,{get faces(){return A.pixelFaces},get fill(){return A.staticFill},get opacity(){return A.staticOpacity},get class(){return A.staticClassName},get attrs(){return i(M)}})}),r(e,o)},R=e=>{var n=G();_(n,e=>({...i(M),class:e,[u]:{position:`absolute`,left:`${A.motionX??``}px`,top:`${A.motionY??``}px`,width:`${A.motionWidth??``}px`,height:`${A.motionHeight??``}px`,background:A.staticFill,"background-origin":`border-box`,opacity:A.staticOpacity,"border-width":A.staticBorderWidth,"border-style":A.dashArrayResolved?`dashed`:`solid`,"border-color":A.staticStroke,"border-radius":A.borderRadiusStyle??`${A.rx}px`}}),[()=>T(`lc-rect`,A.staticClassName)]);var a=b(n);t(a,()=>s.children??w),l(n),c(n,e=>d(k,e),()=>i(k)),r(e,n)};g(P,e=>{A.dataMode?e(I):A.pixelFaces?e(L,1):e(R,-1)}),r(e,N),v()}var q=new Set([`$$slots`,`$$events`,`$$legacy`]);function J(e,t){let n=x(t,q);P(e,h({get Rect(){return K}},()=>n))}var Y=new Set([`$$slots`,`$$events`,`$$legacy`]);function X(e,t){m(t,!0);let n=E(),i=x(t,Y);var o=a(),s=S(o),c=e=>{M(e,h(()=>i))},l=e=>{H(e,h(()=>i))},u=e=>{J(e,h(()=>i))};g(s,e=>{n===`svg`?e(c):n===`canvas`?e(l,1):n===`html`&&e(u,2)}),r(e,o),v()}export{X as default};
@@ -0,0 +1 @@
1
+ import"./index-client-B3yOqiGu.js";function e(){throw Error(`layerchart module ../BrushContext.svelte is stubbed out in vite.config.ts`)}export{e as default};
@@ -0,0 +1 @@
1
+ import"./index-client-B3yOqiGu.js";function e(){throw Error(`layerchart module ../charts/ChartAnnotations.svelte is stubbed out in vite.config.ts`)}export{e as default};
@@ -0,0 +1 @@
1
+ @layer components{:where(.lc-tooltip-header.svelte-1d44xgt){white-space:nowrap;border-bottom:1px solid color-mix(in oklab, var(--color-surface-content,currentColor) 20%, transparent);align-items:center;gap:8px;margin-bottom:4px;padding-bottom:4px;font-weight:600;display:flex}:where(.lc-tooltip-header-color.svelte-1d44xgt){background-color:var(--color);border-radius:9999px;flex-shrink:0;width:8px;height:8px;display:inline-block}:where(.lc-tooltip-item-root.svelte-ytd3mj){display:contents}:where(.lc-tooltip-item-root[data-highlighted].svelte-ytd3mj)>:where(.lc-tooltip-item-label.svelte-ytd3mj,.lc-tooltip-item-value.svelte-ytd3mj){opacity:1;transition:opacity .15s}:where(.lc-tooltip-item-root[data-highlighted=false].svelte-ytd3mj)>:where(.lc-tooltip-item-label.svelte-ytd3mj,.lc-tooltip-item-value.svelte-ytd3mj){opacity:.1}:where(.lc-tooltip-item-color.svelte-ytd3mj){background-color:var(--color);border-radius:9999px;width:8px;height:8px;display:inline-block}:where(.lc-tooltip-item-label.svelte-ytd3mj){white-space:nowrap;align-items:center;gap:8px;display:flex}:where(.lc-tooltip-item-value.svelte-ytd3mj){font-variant-numeric:tabular-nums}:where(.lc-tooltip-item-value.svelte-ytd3mj)[data-align=right]{text-align:right}:where(.lc-tooltip-item-value.svelte-ytd3mj)[data-align=center]{text-align:center}:where(.lc-tooltip-list.svelte-10s3jfe){grid-template-columns:1fr auto;align-items:start;gap:4px 8px;display:grid}:where(.lc-tooltip-separator.svelte-rriep1){background-color:color-mix(in oklab, var(--color-surface-content,currentColor) 20%, transparent);border-radius:4px;grid-column:1/-1;height:1px;margin-top:4px;margin-bottom:4px}}
@@ -0,0 +1 @@
1
+ import{$ as e,_ as t,b as n,d as r,h as i,u as a}from"./d3-scale-BZIMHxO8.js";import{D as o,E as s,I as c,K as l,L as u,O as d,P as f,Q as p,R as m,V as h,_ as g,a as _,at as v,bt as y,c as b,ct as x,dt as S,et as C,g as w,ht as T,i as E,j as D,l as O,mt as k,n as A,nt as j,r as M,rt as N,ut as P,v as F,wt as I,y as L}from"./index-client-B3yOqiGu.js";import{t as R,x as z,y as B}from"./index-CYgojWsw.js";var V=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`colorRef`,`value`,`format`,`color`,`classes`,`props`,`class`,`children`]),H=m(`<div></div>`),U=m(`<div><!> <!></div>`);function W(e,t){T(t,!0);let r=A(t,`ref`,15),i=A(t,`colorRef`,15),a=A(t,`classes`,19,()=>({root:``,color:``})),s=A(t,`props`,19,()=>({root:{},color:{}})),d=M(t,V),m=P(void 0),b=P(void 0);C(()=>{r(l(m))}),C(()=>{i(l(b))});var S=U();O(S,e=>({class:e,...d}),[()=>L(`lc-tooltip-header`,a().root,s().root?.class,t.class)],void 0,void 0,`svelte-1d44xgt`);var E=j(S),R=e=>{var n=H();let r;_(n,e=>x(b,e),()=>l(b)),p(e=>{g(n,1,e,`svelte-1d44xgt`),r=w(n,``,r,{"--color":t.color})},[()=>F(L(`lc-tooltip-header-color`,a().color))]),c(e,n)};D(E,e=>{t.color&&e(R)});var z=v(E,2),W=e=>{var n=u(),r=N(n);o(r,()=>t.children??I),c(e,n)},G=e=>{var r=h();p(e=>f(r,e),[()=>t.format?n(t.value,B(t.format)):t.value]),c(e,r)};D(z,e=>{t.children?e(W):e(G,-1)}),y(S),_(S,e=>x(m,e),()=>l(m)),c(e,S),k()}var G=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`labelRef`,`valueRef`,`colorRef`,`seriesKey`,`label`,`value`,`format`,`valueAlign`,`color`,`classes`,`props`,`class`,`children`,`onpointerenter`,`onpointerleave`]),K=m(`<div></div>`),q=m(`<div><div><!> <!></div> <div><!></div></div>`);function J(e,r){T(r,!0);let i=A(r,`ref`,15),a=A(r,`labelRef`,15),s=A(r,`valueRef`,15),d=A(r,`colorRef`,15),m=A(r,`valueAlign`,3,`left`),g=A(r,`classes`,19,()=>({root:``,label:``,value:``,color:``})),w=A(r,`props`,19,()=>({root:{},label:{},value:{},color:{}})),E=M(r,G),F=t(),I=S(()=>r.seriesKey==null?void 0:F.tooltip.series.find(e=>e.key===r.seriesKey)),R=S(()=>r.seriesKey==null?!0:F.series.series.some(e=>e.key===r.seriesKey)?F.series.isVisible(r.seriesKey):F.series.selectedKeys.isEmpty()||F.series.selectedKeys.isSelected(r.seriesKey)),z=S(()=>r.label??l(I)?.label??r.seriesKey),V=S(()=>r.value===void 0?l(I)?.value:r.value),H=S(()=>r.color??l(I)?.color),U=P(void 0),W=P(void 0),J=P(void 0),Y=P(void 0);C(()=>{i(l(U))}),C(()=>{a(l(W))}),C(()=>{s(l(J))}),C(()=>{d(l(Y))});var X=u(),Z=N(X),Q=e=>{var t=q(),i=e=>{r.seriesKey!=null&&(F.series.highlightKey=r.seriesKey),r.onpointerenter?.(e)},a=e=>{r.seriesKey!=null&&(F.series.highlightKey=null),r.onpointerleave?.(e)};O(t,(e,t)=>({...w().root,class:e,"data-highlighted":t,...E,onpointerenter:i,onpointerleave:a}),[()=>L(`lc-tooltip-item-root`,g().root,r.class,w().root?.class),()=>r.seriesKey==null?void 0:F.series.isHighlighted(r.seriesKey,!0)],void 0,void 0,`svelte-ytd3mj`);var s=j(t);O(s,e=>({...w().label,class:e}),[()=>L(`lc-tooltip-item-label`,`label`,g().label,w().label?.class)],void 0,void 0,`svelte-ytd3mj`);var d=j(s),S=e=>{var t=K();O(t,e=>({...w().color,class:e,[b]:{"--color":l(H)}}),[()=>L(`lc-tooltip-item-color`,`color`,g().color,w().color?.class)],void 0,void 0,`svelte-ytd3mj`),_(t,e=>x(Y,e),()=>l(Y)),c(e,t)};D(d,e=>{l(H)&&e(S)});var C=v(d,2),T=e=>{var t=u(),n=N(t);o(n,()=>l(z)),c(e,t)},k=e=>{var t=h();p(()=>f(t,l(z))),c(e,t)};D(C,e=>{typeof l(z)==`function`?e(T):e(k,-1)}),y(s),_(s,e=>x(W,e),()=>l(W));var A=v(s,2);O(A,e=>({...w().value,class:e,"data-align":m()}),[()=>L(`lc-tooltip-item-value`,`value`,g().value,w().value?.class)],void 0,void 0,`svelte-ytd3mj`);var M=j(A),P=e=>{var t=u(),n=N(t);o(n,()=>r.children),c(e,t)},I=e=>{var t=h();p(e=>f(t,e),[()=>r.format?n(l(V),B(r.format)):l(V)]),c(e,t)};D(M,e=>{r.children?e(P):e(I,-1)}),y(A),_(A,e=>x(J,e),()=>l(J)),y(t),_(t,e=>x(U,e),()=>l(U)),c(e,t)};D(Z,e=>{l(R)&&e(Q)}),c(e,X),k()}var Y=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`children`]),X=m(`<div><!></div>`);function Z(e,t){T(t,!0);let n=A(t,`ref`,15),r=M(t,Y),i=P(void 0);C(()=>{n(l(i))});var a=X();O(a,e=>({class:e,...r}),[()=>L(`lc-tooltip-list`,t.class)],void 0,void 0,`svelte-10s3jfe`);var s=j(a);o(s,()=>t.children??I),y(a),_(a,e=>x(i,e),()=>l(i)),c(e,a),k()}var Q=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`children`]),ee=m(`<div><!></div>`);function te(e,t){T(t,!0);let n=A(t,`ref`,15),r=M(t,Q),i=P(void 0);C(()=>{n(l(i))});var a=ee();O(a,e=>({class:e,...r}),[()=>L(`lc-tooltip-separator`,t.class)],void 0,void 0,`svelte-rriep1`);var s=j(a);o(s,()=>t.children??I),y(a),_(a,e=>x(i,e),()=>l(i)),c(e,a),k()}var ne=m(`<!> <!> <!>`,1),$=m(`<!> <!>`,1);function re(o,f){T(f,!0);let p={Root:R,Header:W,List:Z,Item:J,Separator:te},m=A(f,`canHaveTotal`,3,!1),h=t(),g=S(()=>h.tooltip.series.filter(e=>e.visible));function _(e){if(h.facetBand)return h.facet.panels.find(t=>t.has(e))?.data??[e];let t=h.props.x1==null?h.props.y1==null?h.cKey(e)==null?null:h.valueAxis===`y`?h.x:h.y:h.y:h.x;if(!t)return[e];let n=t(e);return(h.facet.enabled?h.facet.panels.find(t=>t.has(e))?.data??r(h.data):r(h.data)).filter(e=>i(t(e),n))}function y(e){let t=_(e);if(t.length>1&&h.series.isDefaultSeries){let e=h.valueAxis===`y`?h.y:h.x,n=h.facetBand?h.valueAxis===`y`?h.x:h.y:h.props.x1==null?h.props.y1==null?h.c:h.y1:h.x1;return t.map((t,r)=>({key:[n(t),h.cKey(t)??r].join(`\0`),seriesKey:h.cKey(t)??null,label:h.cKey(t)??n(t),value:e(t),color:h.cChannel?h.cGet(t):void 0}))}return(t.length===1&&e===h.tooltip.data?l(g):l(g).map(e=>{let n=e.config,r=a(n?.value??(n?.data?h.props.y??h.props.x:n?.key)),i=t.find(e=>r(e)!=null);return{...e,value:i==null?void 0:r(i)}})).filter(e=>e.value!=null).map(e=>({key:e.key,seriesKey:e.key,label:e.label,value:e.value,color:e.color}))}let b=S(()=>z(h.tooltip.mode)),x=S(()=>l(b)?h.tooltip.series.find(e=>e.key===h.tooltip.data?.seriesKey)??h.tooltip.series[0]:null);function C(e){if(e)return h.facetBand?h.facet.tooltipLabel(e):h.valueAxis===`y`?h.x(e):h.y(e)}function w(e){if(e&&!h.facetBand&&h.facet.enabled)return h.facet.tooltipLabel(e)}function O(e){let t=w(e);return t==null?void 0:`${t} · ${n(C(e),f.tooltipProps?.header?.format)}`}function j(e){return e?h.series.isHighlighted(e,!0):void 0}function M(e){return h.cKey(e)??l(x)?.key??null}var P=u(),F=N(P);{let t=(t,r)=>{let i=()=>(r?.()).data;var a=u(),o=N(a),g=e=>{var t=$(),r=N(t),a=e=>{var t=u(),n=N(t);{let e=S(()=>l(x).label??l(x).key);s(n,()=>p.Header,(t,n)=>{n(t,E({get value(){return l(e)},get color(){return l(x).color}},()=>f.tooltipProps?.header))})}c(e,t)};D(r,e=>{l(x)&&l(x).key!=="default"&&e(a)});var o=v(r,2);s(o,()=>p.List,(e,t)=>{t(e,E(()=>f.tooltipProps?.list,{children:(e,t)=>{var r=ne(),a=N(r);{let e=S(()=>typeof h.config.x==`string`?h.config.x:`x`),t=S(()=>h.x(i())),r=S(()=>j(M(i())));s(a,()=>p.Item,(a,o)=>{o(a,E({get label(){return l(e)},get value(){return l(t)},get"data-highlighted"(){return l(r)},get format(){return n},onpointerenter:()=>h.series.highlightKey=M(i()),onpointerleave:()=>h.series.highlightKey=null},()=>f.tooltipProps?.item))})}var o=v(a,2);{let e=S(()=>typeof h.config.y==`string`?h.config.y:`y`),t=S(()=>h.y(i())),r=S(()=>j(M(i())));s(o,()=>p.Item,(a,o)=>{o(a,E({get label(){return l(e)},get value(){return l(t)},get"data-highlighted"(){return l(r)},get format(){return n},onpointerenter:()=>h.series.highlightKey=M(i()),onpointerleave:()=>h.series.highlightKey=null},()=>f.tooltipProps?.item))})}var d=v(o,2),m=e=>{var t=u(),r=N(t);{let e=S(()=>typeof h.config.r==`string`?h.config.r:`r`),t=S(()=>h.r(i())),a=S(()=>j(M(i())));s(r,()=>p.Item,(r,o)=>{o(r,E({get label(){return l(e)},get value(){return l(t)},get"data-highlighted"(){return l(a)},get format(){return n},onpointerenter:()=>h.series.highlightKey=M(i()),onpointerleave:()=>h.series.highlightKey=null},()=>f.tooltipProps?.item))})}c(e,t)};D(d,e=>{h.config.r&&e(m)}),c(e,r)},$$slots:{default:!0}}))}),c(e,t)},_=t=>{let r=S(()=>O(i()));var a=$(),o=N(a),h=e=>{var t=u(),n=N(t);s(n,()=>p.Header,(e,t)=>{t(e,E(()=>f.tooltipProps?.header,{get value(){return l(r)},format:void 0}))}),c(e,t)},g=e=>{var t=u(),r=N(t);{let e=S(()=>C(i()));s(r,()=>p.Header,(t,r)=>{r(t,E({get value(){return l(e)},get format(){return n}},()=>f.tooltipProps?.header))})}c(e,t)};D(o,e=>{l(r)==null?e(g,-1):e(h)});var _=v(o,2);s(_,()=>p.List,(t,r)=>{r(t,E(()=>f.tooltipProps?.list,{children:(t,r)=>{var a=$(),o=N(a);d(o,19,()=>y(i()),(e,t)=>e.key??t,(e,t)=>{var r=u(),i=N(r);{let e=S(()=>l(t).seriesKey??void 0);s(i,()=>p.Item,(r,i)=>{i(r,E({get seriesKey(){return l(e)},get label(){return l(t).label},get value(){return l(t).value},get color(){return l(t).color},get format(){return n},valueAlign:`right`},()=>f.tooltipProps?.item))})}c(e,r)});var h=v(o,2),g=t=>{var n=$(),r=N(n);s(r,()=>p.Separator,(e,t)=>{t(e,E(()=>f.tooltipProps?.separator,{children:void 0}))});var a=v(r,2);{let t=S(()=>e(y(i()),e=>e.value??0));s(a,()=>p.Item,(e,n)=>{n(e,E({label:`total`,get value(){return l(t)},format:`integer`,valueAlign:`right`},()=>f.tooltipProps?.item))})}c(t,n)},_=S(()=>m()&&y(i()).length>1&&!f.tooltipProps?.hideTotal);D(h,e=>{l(_)&&e(g)}),c(t,a)},$$slots:{default:!0}}))}),c(t,a)};D(o,e=>{l(b)?e(g):e(_,-1)}),c(t,a)};s(F,()=>p.Root,(e,n)=>{n(e,E({get context(){return h}},()=>f.tooltipProps?.root,{children:t,$$slots:{default:!0}}))})}c(o,P),k()}export{re as default};