@zukhruf/git-hooks 0.8.20 → 0.8.22

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 (115) hide show
  1. package/README.md +275 -37
  2. package/dist/build.d.ts +1 -1
  3. package/dist/build.d.ts.map +1 -1
  4. package/dist/build.js +44 -46
  5. package/dist/build.js.map +1 -1
  6. package/dist/codegen.d.ts.map +1 -1
  7. package/dist/codegen.js +41 -8
  8. package/dist/codegen.js.map +1 -1
  9. package/dist/commit.d.ts +29 -10
  10. package/dist/commit.d.ts.map +1 -1
  11. package/dist/commit.js +244 -85
  12. package/dist/commit.js.map +1 -1
  13. package/dist/dependency-checks.d.ts.map +1 -1
  14. package/dist/dependency-checks.js +49 -44
  15. package/dist/dependency-checks.js.map +1 -1
  16. package/dist/dockerfile-installs.d.ts +7 -0
  17. package/dist/dockerfile-installs.d.ts.map +1 -0
  18. package/dist/dockerfile-installs.js +132 -0
  19. package/dist/dockerfile-installs.js.map +1 -0
  20. package/dist/format.d.ts.map +1 -1
  21. package/dist/format.js +33 -24
  22. package/dist/format.js.map +1 -1
  23. package/dist/git.d.ts +3 -0
  24. package/dist/git.d.ts.map +1 -0
  25. package/dist/git.js +20 -0
  26. package/dist/git.js.map +1 -0
  27. package/dist/index.d.ts +8 -3
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +3 -3
  30. package/dist/index.js.map +1 -1
  31. package/dist/lockfile-sync.d.ts +8 -0
  32. package/dist/lockfile-sync.d.ts.map +1 -0
  33. package/dist/lockfile-sync.js +82 -0
  34. package/dist/lockfile-sync.js.map +1 -0
  35. package/dist/no-numeric-pins.d.ts.map +1 -1
  36. package/dist/no-numeric-pins.js +12 -3
  37. package/dist/no-numeric-pins.js.map +1 -1
  38. package/dist/npm/lockfile.d.ts +18 -0
  39. package/dist/npm/lockfile.d.ts.map +1 -0
  40. package/dist/npm/lockfile.js +108 -0
  41. package/dist/npm/lockfile.js.map +1 -0
  42. package/dist/npmrc-policy.d.ts +7 -0
  43. package/dist/npmrc-policy.d.ts.map +1 -0
  44. package/dist/npmrc-policy.js +93 -0
  45. package/dist/npmrc-policy.js.map +1 -0
  46. package/dist/push.d.ts +14 -9
  47. package/dist/push.d.ts.map +1 -1
  48. package/dist/push.js +20 -93
  49. package/dist/push.js.map +1 -1
  50. package/dist/ref-update.d.ts +1 -1
  51. package/dist/ref-update.d.ts.map +1 -1
  52. package/dist/run/commit-msg.d.ts +9 -0
  53. package/dist/run/commit-msg.d.ts.map +1 -0
  54. package/dist/run/commit-msg.js +8 -0
  55. package/dist/run/commit-msg.js.map +1 -0
  56. package/dist/run/pre-commit.d.ts +14 -0
  57. package/dist/run/pre-commit.d.ts.map +1 -0
  58. package/dist/run/pre-commit.js +41 -0
  59. package/dist/run/pre-commit.js.map +1 -0
  60. package/dist/run/pre-push.d.ts +14 -0
  61. package/dist/run/pre-push.d.ts.map +1 -0
  62. package/dist/run/pre-push.js +27 -0
  63. package/dist/run/pre-push.js.map +1 -0
  64. package/dist/run/step-runner.d.ts +17 -0
  65. package/dist/run/step-runner.d.ts.map +1 -0
  66. package/dist/run/step-runner.js +27 -0
  67. package/dist/run/step-runner.js.map +1 -0
  68. package/dist/scripts/commit-msg.d.ts +1 -1
  69. package/dist/scripts/commit-msg.d.ts.map +1 -1
  70. package/dist/scripts/commit-msg.js +14 -19
  71. package/dist/scripts/commit-msg.js.map +1 -1
  72. package/dist/scripts/host.d.ts +10 -0
  73. package/dist/scripts/host.d.ts.map +1 -0
  74. package/dist/scripts/host.js +37 -0
  75. package/dist/scripts/host.js.map +1 -0
  76. package/dist/scripts/pre-commit.d.ts +1 -1
  77. package/dist/scripts/pre-commit.d.ts.map +1 -1
  78. package/dist/scripts/pre-commit.js +14 -17
  79. package/dist/scripts/pre-commit.js.map +1 -1
  80. package/dist/scripts/pre-push.d.ts +1 -1
  81. package/dist/scripts/pre-push.d.ts.map +1 -1
  82. package/dist/scripts/pre-push.js +16 -32
  83. package/dist/scripts/pre-push.js.map +1 -1
  84. package/dist/snapshot/drift.d.ts +0 -2
  85. package/dist/snapshot/drift.d.ts.map +1 -1
  86. package/dist/snapshot/drift.js +5 -57
  87. package/dist/snapshot/drift.js.map +1 -1
  88. package/dist/snapshot/installs.d.ts +1 -0
  89. package/dist/snapshot/installs.d.ts.map +1 -1
  90. package/dist/snapshot/installs.js +85 -29
  91. package/dist/snapshot/installs.js.map +1 -1
  92. package/dist/snapshot/snapshot.d.ts +21 -0
  93. package/dist/snapshot/snapshot.d.ts.map +1 -0
  94. package/dist/snapshot/snapshot.js +54 -0
  95. package/dist/snapshot/snapshot.js.map +1 -0
  96. package/dist/snapshot/snapshots.d.ts +30 -0
  97. package/dist/snapshot/snapshots.d.ts.map +1 -0
  98. package/dist/snapshot/snapshots.js +180 -0
  99. package/dist/snapshot/snapshots.js.map +1 -0
  100. package/dist/sync.d.ts.map +1 -1
  101. package/dist/sync.js +16 -16
  102. package/dist/sync.js.map +1 -1
  103. package/dist/testing.d.ts +23 -0
  104. package/dist/testing.d.ts.map +1 -0
  105. package/dist/testing.js +41 -0
  106. package/dist/testing.js.map +1 -0
  107. package/dist/tree.d.ts +24 -0
  108. package/dist/tree.d.ts.map +1 -0
  109. package/dist/tree.js +96 -0
  110. package/dist/tree.js.map +1 -0
  111. package/package.json +10 -4
  112. package/dist/snapshot/nx.d.ts +0 -7
  113. package/dist/snapshot/nx.d.ts.map +0 -1
  114. package/dist/snapshot/nx.js +0 -20
  115. package/dist/snapshot/nx.js.map +0 -1
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @zukhruf/git-hooks
2
2
 
3
- Git hooks written in TypeScript. A pre-commit hook runs steps in order against the staged commit. The steps check the staged copy of each file with Prettier and change nothing, run `nx sync` and stage only the files that sync wrote, and build generated files when nx says that their projects are affected. A pre-push hook runs steps in order against the push. Its build step builds each pushed commit in a snapshot, never the working tree. A commit-msg hook runs steps in order against the message of the commit. Its scope step stops a subject that nx release reads with the wrong scope. A repo adds a step of its own as a class.
3
+ Git hooks written in TypeScript. A pre-commit hook runs steps in order against the staged commit. The steps check the staged copy of each file with Prettier and change nothing, run `nx sync` on the staged commit and stage only the files that sync wrote, and build generated files when nx says that their projects are affected. A step reads a tree of the commit, and runs its tools in a snapshot of the commit, never in the working tree. A pre-push hook runs steps in order against the push. Its build step builds each pushed commit in a snapshot, never the working tree. A commit-msg hook runs steps in order against the message of the commit. Its scope step stops a subject that nx release reads with the wrong scope. A repo adds a step of its own as a class.
4
4
 
5
5
  The words in these documents have one meaning each. See the glossary in [CONTEXT.md](./CONTEXT.md).
6
6
 
@@ -38,7 +38,7 @@ Tell git where the hooks are, in the `prepare` script of `package.json`:
38
38
 
39
39
  ## Check the format of the staged files
40
40
 
41
- `Format` checks the staged copy of each staged file with the Prettier config of the repo. It skips the files that `.prettierignore` names, the files that Prettier has no parser for, and links, because the staged copy of a link is the path that it points to. When a file is not formatted, or Prettier cannot parse it, the commit stops and the hook names each file:
41
+ `Format` checks the staged copy of each staged file with the Prettier and the Prettier config of the commit. It runs Prettier in the snapshot of the staged commit, with the commit's packages (see [Where a step runs its tools](#where-a-step-runs-its-tools)). It skips the files that `.prettierignore` names, the files that Prettier has no parser for, and links, because the staged copy of a link is the path that it points to. When a file is not formatted, or Prettier cannot parse it, the commit stops and the hook names each file:
42
42
 
43
43
  ```text
44
44
  format 2 staged files are not formatted:
@@ -52,7 +52,7 @@ The step changes no file and stages nothing. A file that is partly staged is jud
52
52
 
53
53
  ## Stage the files that nx sync writes
54
54
 
55
- `Sync` runs `nx sync` and stages the files that it changed. The option `stage` names the files that the sync generators of the repo write. The default is `**/tsconfig*.json`. A repo with the Tailwind sync generator adds its style sheets:
55
+ `Sync` runs `nx sync` in a snapshot of the staged commit, and stages the files that it changed there. The option `stage` holds globs of the files that the sync generators of the repo write. The default is `**/tsconfig*.json`. A repo with the Tailwind sync generator adds its style sheets:
56
56
 
57
57
  ```ts
58
58
  import { Format, Sync, preCommit } from '@zukhruf/git-hooks';
@@ -63,7 +63,7 @@ await preCommit([
63
63
  ]);
64
64
  ```
65
65
 
66
- The step does not stage a file that was changed before the hook ran, or a changed file that `stage` does not name: another session can edit the same working tree. When `nx sync` fails, the commit stops, and the hook shows the reason that nx gave.
66
+ nx sync reads the staged commit, so an edit that is not staged does not change what it writes. The step stages only a changed file that `stage` matches. It also writes that file into the working tree, but only when the working-tree copy still equals the old staged copy, so `git status` stays clean. When the working-tree copy holds another edit, the step leaves it, and the hook names it. When `nx sync` fails, the commit stops, and the hook shows the reason that nx gave. A partial commit, such as `git commit --only` or `git commit <paths>`, cannot take a synced file: the commit stops, and the hook names the files and the command that adds them (see [Write generated files](#write-generated-files)).
67
67
 
68
68
  ## Refuse a Node or npm version written as a number
69
69
 
@@ -82,9 +82,55 @@ import { Format, NoNumericPins, Sync, preCommit } from '@zukhruf/git-hooks';
82
82
  await preCommit([new Sync(), new Format(), new NoNumericPins()]);
83
83
  ```
84
84
 
85
+ ## Keep package-lock.json in step with each package.json
86
+
87
+ `LockfileSync` runs when a commit changes a `package.json`, `package-lock.json` or `.npmrc`, a deletion included. The commit stops when the staged lockfile does not record the staged manifests, so CI and each image install the commit with `npm ci`:
88
+
89
+ - each dependency of a staged `package.json` must have the spec that the lockfile recorded for its project. `npm ci` accepts a range edit that the locked version still satisfies, such as `^1.0.0` to `^1.2.0` with `1.3.0` locked, so the lockfile would keep the old range;
90
+ - then `npm ci --dry-run` runs in the snapshot of the staged commit: npm's own check that the lockfile holds each dependency of each `package.json`, such as a new workspace package. It reads the npm cache first and the registry only for what the cache does not hold.
91
+
92
+ A commit with a `package.json` and no `package-lock.json` stops too. The fix for each case is the same: run `npm install`, stage `package-lock.json`, and commit again.
93
+
94
+ ```ts
95
+ import { LockfileSync, NpmrcPolicy, preCommit } from '@zukhruf/git-hooks';
96
+
97
+ await preCommit([new NpmrcPolicy(), new LockfileSync()]);
98
+ ```
99
+
100
+ ## Decide how npm installs, in the repo
101
+
102
+ `NpmrcPolicy` reads the staged `.npmrc` on each commit. The repo's `.npmrc` decides two settings for each install, so the `~/.npmrc` of the user never does:
103
+
104
+ - `legacy-peer-deps=false`: npm resolves peer dependencies for real. Write `legacy-peer-deps=true` only under a comment that names the peer conflict and the backlog item that tracks it, such as `# express 5 against a peer of express 4 (#2394)`.
105
+ - `strict-allow-scripts=true`: an install fails when a dependency has an install script that `allowScripts` in `package.json` does not name. Without it, npm skips the script and only warns.
106
+
107
+ The commit stops when `.npmrc` is missing, when a setting is missing, has another value, or is set twice (npm reads a key that is set twice as a list), and when `legacy-peer-deps=true` has no such comment. The step reads `.npmrc` as npm does: spaces around `=`, quoted values and a comment after a value are allowed, and only the keys above the first `[section]` count.
108
+
109
+ ```ts
110
+ import { NoNumericPins, NpmrcPolicy, preCommit } from '@zukhruf/git-hooks';
111
+
112
+ await preCommit([new NoNumericPins(), new NpmrcPolicy()]);
113
+ ```
114
+
115
+ ## Install from the lockfile in a Dockerfile
116
+
117
+ `DockerfileInstallsFromLockfile` reads the staged copy of each staged Dockerfile, such as `Dockerfile`, `Dockerfile.migration` or `api.Dockerfile`. The commit stops when a `RUN` instruction installs packages without the lockfile: `npm install` (and its other names, such as `npm i` and `npm add`), `yarn` or `yarn add`, and `pnpm` or `bun` with `install`, `i` or `add`. `npm install` resolves the ranges of `package.json` when the image builds, so the image runs versions that no commit names. Write `npm ci` after a `COPY` of `package.json` and `package-lock.json`, and `npm ci --omit=dev` for a runtime image. A global install of a tool, such as `npm install -g npm@latest`, passes.
118
+
119
+ The step reads `RUN` as Docker does: continuation lines, flags such as `--mount`, the exec form `["npm", "install"]`, and a heredoc.
120
+
121
+ ```ts
122
+ import {
123
+ DockerfileInstallsFromLockfile,
124
+ NoNumericPins,
125
+ preCommit,
126
+ } from '@zukhruf/git-hooks';
127
+
128
+ await preCommit([new NoNumericPins(), new DockerfileInstallsFromLockfile()]);
129
+ ```
130
+
85
131
  ## Lint the package.json of each touched project
86
132
 
87
- `DependencyChecks` lints the staged `package.json` of each project that the commit touches, with the repo's own ESLint config. The project of a staged file is the nearest folder above it that has a `package.json` in the commit. A dependency rule, such as Nx's `dependency-checks`, reports on `package.json`, so a lint of the staged source files alone never runs it. Without this step, an import of an undeclared package passes the commit and fails CI after the push. The step changes nothing. It needs `eslint` in the repo:
133
+ `DependencyChecks` lints the staged `package.json` of each project that the commit touches, with the ESLint and the ESLint config of the commit. It runs ESLint in the snapshot of the staged commit, with the commit's packages. The project of a changed path is the nearest folder above it that has a `package.json` in the staged tree. A deleted path touches its project too. A dependency rule, such as Nx's `dependency-checks`, reports on `package.json`, so a lint of the staged source files alone never runs it. Without this step, an import of an undeclared package passes the commit and fails CI after the push. The step changes nothing. It needs `eslint` in the repo:
88
134
 
89
135
  ```ts
90
136
  import { DependencyChecks, Format, preCommit } from '@zukhruf/git-hooks';
@@ -94,7 +140,7 @@ await preCommit([new Format(), new DependencyChecks()]);
94
140
 
95
141
  ## Build generated files
96
142
 
97
- `Codegen` runs nx targets that write generated files, and stages those files. With `when`, it builds only when nx says that the staged files affect one of those projects:
143
+ `Codegen` runs nx targets that write generated files in a snapshot of the staged commit. It stages each file that the targets changed there and that `stage` matches. `stage` holds globs. With `when`, it builds only when nx says that the changes of the commit affect one of those projects:
98
144
 
99
145
  ```ts
100
146
  import { Codegen, Format, Sync, preCommit } from '@zukhruf/git-hooks';
@@ -104,35 +150,228 @@ await preCommit([
104
150
  new Codegen({
105
151
  when: ['backend', 'frontend'],
106
152
  run: ['backend:build', 'frontend:build'],
107
- stage: ['openapi.json', 'packages/client/src'],
153
+ stage: ['openapi.json', 'packages/client/src/**'],
108
154
  }),
109
155
  new Format(),
110
156
  ]);
111
157
  ```
112
158
 
113
- The targets run in the order that `run` gives. When a target fails, the commit stops, and the hook shows the reason that the target gave. Put `Format` after `Codegen`, so that the generated files are checked too. nx and its tasks get none of the variables that tie git to one repo (see [Where a pre-push build runs](#where-a-pre-push-build-runs)), so a target that runs git in a folder of its own does not change the repo. The hook's own git commands keep these variables, so they read and write the index of the commit.
159
+ The targets run in the order that `run` gives. They build from the staged commit, so an edit that is not staged is not in the generated files. When a target fails, the commit stops, and the hook shows the reason that the target gave. The working tree and a partial commit follow the same rules as for `Sync`. Put `Format` after `Codegen`, so that the generated files are checked too. nx and its tasks get the tool environment (see [Where a step runs its tools](#where-a-step-runs-its-tools)), so a target that runs git in a folder of its own does not change the repo.
160
+
161
+ ## Write a step
162
+
163
+ A pre-commit step is a subclass of `Step<Commit>`. It names itself and gives an outcome: `this.pass()`, `this.skip(why)` or `this.fail(why)`. A fail stops the commit. A step reads the commit only through its subject. It never reads the working tree, and it never gets an environment.
164
+
165
+ `Commit`, `Push` and `CommitMessage` are types, not classes: the hook builds them. Import them with `type`. These are the types that a step uses:
166
+
167
+ ```ts
168
+ interface Commit {
169
+ tree(): Promise<Tree>;
170
+ changes(): Promise<readonly DiffEntry[]>;
171
+ touches(globs: readonly string[]): Promise<boolean>;
172
+ snapshot(options?: { readonly packages?: false }): Promise<Snapshot>;
173
+ snapshot(options: { readonly packages: true }): Promise<PackagedSnapshot>;
174
+ generate(
175
+ globs: readonly string[],
176
+ work: (snapshot: PackagedSnapshot) => Promise<void>,
177
+ ): Promise<readonly DiffEntry[]>;
178
+ }
179
+
180
+ interface Push {
181
+ readonly remote: { readonly name: string; readonly url: string };
182
+ readonly updates: readonly RefUpdate[];
183
+ tree(sha: string): Promise<Tree>;
184
+ changes(
185
+ update: Extract<RefUpdate, { kind: 'create' | 'update' }>,
186
+ ): Promise<readonly DiffEntry[]>;
187
+ snapshot(
188
+ sha: string,
189
+ options?: { readonly packages?: false },
190
+ ): Promise<Snapshot>;
191
+ snapshot(
192
+ sha: string,
193
+ options: { readonly packages: true },
194
+ ): Promise<PackagedSnapshot>;
195
+ }
196
+
197
+ interface Tree {
198
+ readonly id: string;
199
+ entries(globs?: readonly string[]): readonly TreeEntry[];
200
+ read(path: string): Promise<string | undefined>;
201
+ }
202
+
203
+ interface TreeEntry {
204
+ readonly path: string;
205
+ readonly kind: 'file' | 'link' | 'submodule';
206
+ }
207
+
208
+ type DiffEntry =
209
+ | {
210
+ readonly change: 'added' | 'modified' | 'type-changed';
211
+ readonly path: string;
212
+ readonly kind: 'file' | 'link' | 'submodule';
213
+ }
214
+ | { readonly change: 'deleted'; readonly path: string };
215
+
216
+ interface Snapshot {
217
+ readonly folder: string;
218
+ run(
219
+ command: string,
220
+ args: readonly string[],
221
+ options?: { readonly env?: Readonly<Record<string, string>> },
222
+ ): Promise<ProcessResult>;
223
+ }
224
+
225
+ interface PackagedSnapshot extends Snapshot {
226
+ readonly nxCacheDirectory: string;
227
+ bin(
228
+ name: string,
229
+ args: readonly string[],
230
+ options?: { readonly env?: Readonly<Record<string, string>> },
231
+ ): Promise<ProcessResult>;
232
+ }
233
+
234
+ interface ProcessResult {
235
+ readonly status: number | null;
236
+ readonly stdout: string;
237
+ readonly stderr: string;
238
+ }
239
+ ```
240
+
241
+ ### Read the commit
242
+
243
+ `commit.tree()` gives the staged tree: the tree that `git write-tree` writes from the index of the hook. A tree does not change, so a step judges one state of the commit. After `generate` stages a file, `tree()` gives the new tree. `tree.id` is the object id of the tree.
244
+
245
+ `tree.entries(globs?)` lists the tree entries, without folders. Each entry has its `path` and its `kind`: `file` (also an executable file), `link` or `submodule`. With `globs`, it lists only the paths that match one of them, as `path.matchesGlob` of Node matches them. `tree.read(path)` gives the content of an entry as UTF-8 text, or `undefined` when the tree has no file or link at `path`. The content of a link is the path that it points to, so a step that checks content reads only the entries of the kind `file`.
114
246
 
115
- ## Add a step of your own
247
+ `commit.changes()` gives the diff entries from the tree of `HEAD` to the staged tree. Each entry has its `path` and its `change`: `added`, `modified`, `deleted` or `type-changed`. An entry that is not deleted also has the `kind` of its new entry. A rename is a deleted entry and an added entry. A step that checks content skips the deleted entries. `commit.touches(globs)` says whether a diff entry matches one of the globs, and deleted entries count. Thus a commit that only deletes `package-lock.json` touches `package-lock.json`.
116
248
 
117
- A pre-commit step is a subclass of `Step<Commit>`. It names itself and gives an outcome: `this.pass()`, `this.skip(why)` or `this.fail(why)`. A fail stops the commit. `Commit` reads the staged commit: `staged()`, `files()` (the staged paths that hold file content, without links and submodules), `blob(path)`, `touches(globs)`, and `inSnapshot(work)`, which runs `work` on a copy of the staged tree in a temporary folder:
249
+ This step reads a file that the commit need not change:
118
250
 
119
251
  ```ts
120
252
  import { type Commit, Step } from '@zukhruf/git-hooks';
121
253
 
122
- export class DesignCheck extends Step<Commit> {
123
- readonly name = 'design';
254
+ export class StrictPeers extends Step<Commit> {
255
+ readonly name = 'npmrc';
124
256
 
125
257
  async run(commit: Commit) {
126
- if (!(await commit.touches(['DESIGN.md', 'apps/**/*.css'])))
127
- return this.skip('no design files staged');
128
- const valid = await commit.inSnapshot((folder) => checkDesign(folder));
129
- return valid
258
+ const npmrc = await (await commit.tree()).read('.npmrc');
259
+ if (npmrc === undefined) return this.fail('the commit has no .npmrc');
260
+ return /^legacy-peer-deps\s*=\s*false\s*$/m.test(npmrc)
130
261
  ? this.pass()
131
- : this.fail('DESIGN.md disagrees with the styles');
262
+ : this.fail('.npmrc does not set legacy-peer-deps=false');
263
+ }
264
+ }
265
+ ```
266
+
267
+ ### Run a tool in a snapshot
268
+
269
+ `commit.snapshot()` gives the snapshot of the staged tree (see [Where a step runs its tools](#where-a-step-runs-its-tools)). `snapshot.folder` is its folder. `snapshot.run(command, args)` runs a command from the `PATH` in that folder, with the tool environment. A snapshot with packages also has `snapshot.bin(name, args)`, which runs `node_modules/.bin/<name>` of the snapshot in the same way. The option `env` adds variables. Each call gives a `ProcessResult`: the `status`, which is the exit code or `null` when a signal ended the process, the `stdout` and the `stderr`. An exit code other than 0 is a result, not an error. When the command cannot start, the call throws the error of Node.
270
+
271
+ A snapshot has no `node_modules` unless the step asks for packages with `commit.snapshot({ packages: true })`, which gives a `PackagedSnapshot`. These are the packages of the commit's own lockfile, so the tree must have `package-lock.json`, or `snapshot` throws. The steps that ask for the same tree share one snapshot, so a step does not change the files in it. A later ask for packages adds a `node_modules` to the same snapshot. A step that writes files uses `generate`. The hook deletes each snapshot after the last step. `snapshot.nxCacheDirectory` is the nx cache of the state folder, where nx writes the summary of its last run.
272
+
273
+ This step runs npm on the staged tree. `npm ci --dry-run` needs no `node_modules`, so the step asks for no packages:
274
+
275
+ ```ts
276
+ import { type Commit, Step } from '@zukhruf/git-hooks';
277
+
278
+ const npmFiles = ['**/package.json', 'package-lock.json', '.npmrc'];
279
+
280
+ export class LockfileInSync extends Step<Commit> {
281
+ readonly name = 'lockfile';
282
+
283
+ async run(commit: Commit) {
284
+ if (!(await commit.touches(npmFiles)))
285
+ return this.skip('no manifest, lockfile or .npmrc changed');
286
+ const snapshot = await commit.snapshot();
287
+ const npm = await snapshot.run('npm', [
288
+ 'ci',
289
+ '--dry-run',
290
+ '--ignore-scripts',
291
+ '--no-audit',
292
+ '--no-fund',
293
+ ]);
294
+ return npm.status === 0
295
+ ? this.pass('package-lock.json records the manifests')
296
+ : this.fail(npm.stderr.trimEnd());
132
297
  }
133
298
  }
134
299
  ```
135
300
 
301
+ ### Write generated files
302
+
303
+ A step that writes files calls `commit.generate(globs, work)`. `work` runs in a private snapshot of the staged tree, with packages. Then the hook stages each file that the work changed, added or deleted there, and that matches one of the globs. A file that `.gitignore` names is not staged. `generate` gives the diff entries of the files that it staged. After it, `commit.tree()` gives the new staged tree, and the next steps read that tree.
304
+
305
+ The hook also writes each staged file into the working tree, or deletes it there, but only when the working-tree copy still equals the old staged copy. Thus `git status` stays clean. When the working-tree copy holds another edit, the hook leaves it. It prints a line that names the file, under the name of the step.
306
+
307
+ When `work` throws, `generate` stages nothing and throws the same error. In a partial commit, such as `git commit --only` or `git commit <paths>`, git commits its real index after the hook, so a file that the hook staged would be in the commit but not in the index. There, `generate` writes the working-tree copies by the same rule, stages nothing, and throws an error that names the files and the command that adds them to the commit.
308
+
309
+ ```ts
310
+ import { type Commit, Step } from '@zukhruf/git-hooks';
311
+
312
+ export class OpenApi extends Step<Commit> {
313
+ readonly name = 'openapi';
314
+
315
+ async run(commit: Commit) {
316
+ try {
317
+ const staged = await commit.generate(
318
+ ['openapi.json'],
319
+ async (snapshot) => {
320
+ const nx = await snapshot.bin('nx', ['run', 'api:openapi']);
321
+ if (nx.status !== 0) throw new Error(nx.stderr.trimEnd());
322
+ },
323
+ );
324
+ return this.pass(`staged ${staged.length} generated files`);
325
+ } catch (error) {
326
+ if (!Error.isError(error)) throw error;
327
+ return this.fail(error.message);
328
+ }
329
+ }
330
+ }
331
+ ```
332
+
333
+ ### How a hook runs its steps
334
+
335
+ `preCommit`, `prePush` and `commitMsg` run their steps with one loop. The loop runs the steps in order, prints the outcome of each step, and stops at the first fail. When each step passed or skipped, the pre-commit hook writes the tree of the index again: the index guard. When that tree differs from the last staged tree that the steps read, the commit stops: the index changed while the hook ran, for example because another session ran `git add`. At the end, the hook deletes each snapshot that the steps opened.
336
+
337
+ ### Test a step
338
+
339
+ `@zukhruf/git-hooks/testing` runs steps as each hook runs them, with the folder and the environment that the test gives. It gives the outcome of each step that ran, in order, and stops after the first fail, as the hook does. The index guard, `generate` and the snapshots work as in the hook:
340
+
341
+ - `preCommit({ root, environment }, steps)` runs pre-commit steps against the index of the repo at `root`.
342
+ - `prePush({ root, environment, remote, input }, steps)` runs pre-push steps. `remote` has the `name` and the `url`, and `input` holds the lines that git gives the hook on its standard input.
343
+ - `commitMsg({ root, environment, file }, steps)` runs commit-msg steps on the message in `file`.
344
+
345
+ ```ts
346
+ import assert from 'node:assert/strict';
347
+ import { execFileSync } from 'node:child_process';
348
+ import { mkdtempDisposable, writeFile } from 'node:fs/promises';
349
+ import { tmpdir } from 'node:os';
350
+ import { join } from 'node:path';
351
+ import test from 'node:test';
352
+
353
+ import { preCommit } from '@zukhruf/git-hooks/testing';
354
+
355
+ import { StrictPeers } from './strict-peers.ts';
356
+
357
+ test('a commit without .npmrc fails', async () => {
358
+ // Arrange
359
+ await using repo = await mkdtempDisposable(join(tmpdir(), 'npmrc-'));
360
+ execFileSync('git', ['init', '--quiet'], { cwd: repo.path });
361
+ await writeFile(join(repo.path, 'package.json'), '{}\n');
362
+ execFileSync('git', ['add', 'package.json'], { cwd: repo.path });
363
+
364
+ // Act
365
+ const [outcome] = await preCommit(
366
+ { root: repo.path, environment: process.env },
367
+ [new StrictPeers()],
368
+ );
369
+
370
+ // Assert
371
+ assert.equal(outcome?.kind, 'fail');
372
+ });
373
+ ```
374
+
136
375
  ## Install the pre-push hook
137
376
 
138
377
  Git runs the pre-push hook before `git push` sends commits to a remote. Write the hook in `.husky/pre-push.ts`:
@@ -216,25 +455,25 @@ In one repo, one pre-push build runs at a time. A second push waits for the firs
216
455
  build waiting for another pre-push build in this repo
217
456
  ```
218
457
 
219
- ## Where a pre-push build runs
458
+ ## Where a step runs its tools
220
459
 
221
- Each pushed commit is built in a snapshot: a clone of the repo in a temporary folder outside the repo, with the files of that commit. The hook makes the clone with `git clone --shared --no-checkout`, and then runs `git checkout --detach <sha>` in it. The clone shares the object store of the repo through `objects/info/alternates`, so git copies no objects. The snapshot holds what the commit holds, and nothing that is only in the working tree. A file that `.gitignore` names, such as `.env`, is not in the snapshot. Git writes the files of the commit as in each checkout: it makes the links and the executable files, and it applies `.gitattributes` and the filters of your git config.
460
+ A step runs its tools in a snapshot: a clone of the repo in a temporary folder outside the repo, with the files of one commit. Both hooks make it in the same way. The hook makes the clone with `git clone --shared --no-checkout`, and then runs `git checkout --detach <sha>` in it. For the staged commit, the hook first writes a commit of the staged tree with `git commit-tree`, with `HEAD` as its parent, and with an author, a committer and a date that do not change. Thus one tree and one parent always give the same commit. No ref holds that commit, and `git gc` prunes it. The clone shares the object store of the repo through `objects/info/alternates`, so git copies no objects. The snapshot holds what the commit holds, and nothing that is only in the working tree. A file that `.gitignore` names, such as `.env`, is not in the snapshot. Git writes the files of the commit as in each checkout: it makes the links and the executable files, and it applies `.gitattributes` and the filters of your git config.
222
461
 
223
- nx runs in the snapshot, and git commands in nx work there. The snapshot is a repo of its own, so git sees a clean checkout of the pushed commit, with no changed and no untracked files. `nx affected --base --head` works, because git finds the base commit through the shared object store.
462
+ nx and the other tools run in the snapshot, and git commands in them work there. The snapshot is a repo of its own, so git sees a clean checkout of the commit, with no changed and no untracked files. `nx affected --base --head` works, because git finds the base commit through the shared object store.
224
463
 
225
- nx and its tasks get none of the variables that tie git to one repo, such as `GIT_DIR`, `GIT_WORK_TREE` and `GIT_INDEX_FILE`. The hook removes each variable that `git rev-parse --local-env-vars` lists. Git removes the same list when it runs a command in another repo, such as a submodule. Thus a task that runs `git init` in a temporary folder of its own makes a repo in that folder, and does not change the repo that pushes. Before 0.3.43, the hook gave nx these variables. In sdk-it, a test ran `git init` in a temporary folder, and git wrote `core.worktree` into the config of the real repo. The snapshot was then deleted, so each git command in the repo failed.
464
+ Each tool gets the tool environment: the environment of the hook without the variables that tie git to one repo, such as `GIT_DIR`, `GIT_WORK_TREE` and `GIT_INDEX_FILE`. The hook removes each variable that `git rev-parse --local-env-vars` lists. Git removes the same list when it runs a command in another repo, such as a submodule (githooks(5)). Thus a task that runs `git init` in a temporary folder of its own makes a repo in that folder, and does not change the repo of the hook. In a snapshot, the tool environment also has `NX_DAEMON=false` and the nx cache of the state folder. Only the hook's own git commands on the repo keep these variables, so they read and write the index of the commit.
226
465
 
227
- The snapshot uses the packages that the repo installed when they match the `package-lock.json` of the commit. Then the setup takes about 1 s. A workspace package resolves to its folder in the snapshot, not in the working tree.
466
+ A snapshot has a `node_modules` only when a step asks for packages. It then uses the packages that the repo installed when they match the `package-lock.json` of the commit. Then the setup takes about 1 s. A workspace package resolves to its folder in the snapshot, not in the working tree.
228
467
 
229
- When the installed packages do not match the `package-lock.json` of the commit, the hook installs that lockfile in a folder of its own, and the snapshot uses that install. This is install drift: a package that the lockfile names is missing or has a different version, or a package is installed that the lockfile does not name. An extra package is drift too, because code that imports it builds here and fails in CI. Install drift occurs when a peer changed the dependencies but did not commit the change, or when the push sends a commit with other dependencies. The hook prints a line before the install, because a full install takes some time:
468
+ When the installed packages do not match the `package-lock.json` of the commit, the hook installs that lockfile in a folder of its own, and the snapshot uses that install. This is install drift: a package that the lockfile names is missing or has a different version, or a package is installed that the lockfile does not name. An extra package is drift too, because code that imports it builds here and fails in CI. Install drift occurs when a peer changed the dependencies but did not commit the change, when a commit changes the lockfile, or when the push sends a commit with other dependencies. The hook prints a line before the install, because a full install takes some time:
230
469
 
231
470
  ```text
232
471
  build a1b2c3d: the installed packages differ from package-lock.json; installing it with npm ci (first time for this lockfile)
233
472
  ```
234
473
 
235
- The install runs `npm ci --ignore-scripts`, and then `npm rebuild` with the names of the dependencies that have install scripts. The lockfile marks these dependencies with `hasInstallScript`. Thus the install scripts of the dependencies run, such as those of esbuild and prisma. With npm 12, only the install scripts that the `allowScripts` of the repo's `package.json` approves run, as in the repo's own `npm install`. To approve a dependency, run `npm install-scripts approve <name>`. The scripts of the repo and of its workspace packages, such as `prepare`, do not run. The install has a copy of each folder of the commit that a `file:` dependency links to, such as a vendored package, because the packages of the install resolve it in the install. Each push copies these folders again from its commit, because their files can change while the lockfile stays the same. The first push with a new lockfile waits for a full install. The next pushes with that lockfile use the same install. The hook keeps the two installs that it used last. A repo with no `node_modules` gets its install the same way.
474
+ The install starts from a copy of the full tree of the commit, without `.git` and `node_modules`. Thus npm finds each file that it reads in a clean checkout: the `package.json` of the root and of each workspace, the lockfile, `.npmrc`, the patch files that `patchedDependencies` names, a `.npm-extension.mjs`, and the folders that `file:` dependencies link to. npm gets the tool environment. The install runs `npm ci --ignore-scripts`, and then `npm rebuild` with the names of the dependencies that have install scripts. The lockfile marks these dependencies with `hasInstallScript`. Thus the install scripts of the dependencies run, such as those of esbuild and prisma. With npm 12, only the install scripts that the `allowScripts` of the repo's `package.json` approves run, as in the repo's own `npm install`. To approve a dependency, run `npm install-scripts approve <name>`. The scripts of the repo and of its workspace packages, such as `prepare`, do not run. The name of an install is the hash of the lockfile and the `.npmrc` together, so a change of either one makes a new install. The first commit or push with a new lockfile waits for a full install. The next ones use the same install. Each use copies again the folders of the commit that a `file:` dependency links to, such as a vendored package, because their files can change while the lockfile stays the same, and the packages of the install resolve them in the install. A folder that the lockfile names but the commit does not have, such as a workspace that `.gitignore` names, is not copied. The hook keeps the two installs that it used last. A repo with no `node_modules` gets its install the same way.
236
475
 
237
- The hook keeps the installs and the nx cache of the pre-push builds in its state folder: `git-hooks` in the common git folder of the repo (`git rev-parse --git-common-dir`). Linked worktrees use the same state folder. The nx cache of the working tree (`.nx`) is not used, and the hook does not write to it. A file lock in the state folder lets one pre-push build run at a time. The hook deletes each snapshot after its build.
476
+ The hook keeps the installs and the nx cache in its state folder: `git-hooks` in the common git folder of the repo (`git rev-parse --git-common-dir`). Linked worktrees use the same state folder. The nx cache of the working tree (`.nx`) is not used, and the hook does not write to it. The pre-push hook holds the file lock `build.lock` in the state folder from its first snapshot to its end, so one pre-push build runs at a time. A hook holds `installs.lock` only while it installs or prunes, so a commit does not wait for a pre-push build. The hook deletes each snapshot after the last step.
238
477
 
239
478
  On Windows, the snapshot links to folders with junctions, which need no administrator rights.
240
479
 
@@ -255,7 +494,7 @@ A create or an update also has a `head` and a `base`. The `head` is the local co
255
494
  - When the remote has the `head` already, the `base` is the `head`, and the range is empty.
256
495
  - When the remote has no commit of that history, there is no `base`, and the step must check the whole history.
257
496
 
258
- `push.inSnapshot(sha, work)` runs `work` on the snapshot of one commit. `work` gets the folder of the snapshot and an environment for the tools that it runs there: the environment of the hook without the variables that tie git to one repo, `NX_DAEMON=false`, and the nx cache of the state folder. `push.nx(sha, ...args)` runs nx in the snapshot of one commit, with that environment, and gives its standard output. When nx exits with a code other than 0, it throws.
497
+ `push.tree(sha)` gives the tree of one commit, as `commit.tree()` gives the staged tree (see [Write a step](#write-a-step)). `push.changes(update)` gives the diff entries of a create or an update: from the tree of its `base` to the tree of its `head`, or from the empty tree when there is no `base`. `push.snapshot(sha, options?)` gives the snapshot of one commit, as `commit.snapshot` does. The first snapshot of a push takes `build.lock` of the repo, so a second push waits for it.
259
498
 
260
499
  This step runs the tests of the projects that each pushed range affects:
261
500
 
@@ -268,17 +507,16 @@ export class AffectedTest extends Step<Push> {
268
507
  async run(push: Push) {
269
508
  const updates = push.updates.filter((update) => update.kind !== 'delete');
270
509
  if (updates.length === 0) return this.skip('the push only deletes refs');
271
- try {
272
- for (const { base, head } of updates)
273
- await push.nx(
274
- head,
275
- ...(base === undefined
276
- ? ['run-many', '-t', 'test']
277
- : ['affected', '-t', 'test', `--base=${base}`, `--head=${head}`]),
278
- );
279
- } catch (error) {
280
- if (!(error instanceof Error)) throw error;
281
- return this.fail(error.message.trimEnd());
510
+ for (const { base, head } of updates) {
511
+ const snapshot = await push.snapshot(head, { packages: true });
512
+ const nx = await snapshot.bin(
513
+ 'nx',
514
+ base === undefined
515
+ ? ['run-many', '-t', 'test']
516
+ : ['affected', '-t', 'test', `--base=${base}`, `--head=${head}`],
517
+ );
518
+ if (nx.status !== 0)
519
+ return this.fail(`${nx.stdout}${nx.stderr}`.trimEnd());
282
520
  }
283
521
  return this.pass();
284
522
  }
package/dist/build.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { type Push } from './push.ts';
1
+ import type { Push } from './push.ts';
2
2
  import { type Outcome, Step } from './step.ts';
3
3
  interface BuildOptions {
4
4
  readonly targets?: readonly string[];
@@ -1 +1 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAIA,OAAO,EAAwB,KAAK,IAAI,EAAE,MAAM,WAAW,CAAC;AAE5D,OAAO,EAAE,KAAK,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE/C,UAAU,YAAY;IAEpB,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAErC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAG3B,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACjD;AAuBD,qBAAa,KAAM,SAAQ,IAAI,CAAC,IAAI,CAAC;;IACnC,QAAQ,CAAC,IAAI,WAAW;gBAKZ,EAAE,OAAmB,EAAE,QAAQ,EAAE,GAAQ,EAAE,GAAE,YAAiB;IAOpE,GAAG,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC;CAgGxC"}
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,KAAK,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE/C,UAAU,YAAY;IAEpB,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAErC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAG3B,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACjD;AAuBD,qBAAa,KAAM,SAAQ,IAAI,CAAC,IAAI,CAAC;;IACnC,QAAQ,CAAC,IAAI,WAAW;gBAKZ,EAAE,OAAmB,EAAE,QAAQ,EAAE,GAAQ,EAAE,GAAE,YAAiB;IAOpE,GAAG,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC;CA+FxC"}
package/dist/build.js CHANGED
@@ -1,8 +1,7 @@
1
1
  import { readFile, rm } from 'node:fs/promises';
2
2
  import { join } from 'node:path';
3
3
  import { stripVTControlCharacters } from 'node:util';
4
- import { MissingLockfileError } from "./push.js";
5
- import { runNx } from "./snapshot/nx.js";
4
+ import { MissingLockfileError } from "./snapshot/snapshots.js";
6
5
  import { Step } from "./step.js";
7
6
  // The lines of error output that a fail shows for each failed task.
8
7
  const shownLines = 20;
@@ -47,50 +46,49 @@ export class Build extends Step {
47
46
  async #build(push, head) {
48
47
  const short = head.slice(0, 7);
49
48
  try {
50
- return await push.inSnapshot(head, async (folder, environment) => {
51
- const cache = environment.NX_CACHE_DIRECTORY ?? '';
52
- // A run that ends before its tasks writes no summary, so the summary
53
- // of an older run must not stay.
54
- await rm(join(cache, 'run.json'), { force: true });
55
- const { code, stdout, stderr } = await runNx(folder, { ...environment, ...this.#env }, [
56
- 'run-many',
57
- `--targets=${this.#targets.join(',')}`,
58
- '--configuration=production',
59
- ...(this.#parallel === undefined
60
- ? []
61
- : [`--parallel=${this.#parallel}`]),
62
- ]);
63
- const tasks = await lastRun(cache);
64
- if (code === 0) {
65
- const projects = new Set(tasks.map((task) => task.projectName));
66
- const cached = tasks.filter((task) => task.cacheStatus !== 'cache-miss');
67
- return {
68
- kind: 'built',
69
- line: `${short}: built ${projects.size} projects, ${cached.length} of ${tasks.length} tasks from cache`,
70
- };
71
- }
72
- // nx exits with 130 when a task fails, so each code other than 0 is a
73
- // fail.
74
- const failed = tasks.filter((task) => task.status !== 0);
75
- if (failed.length === 0)
76
- return {
77
- kind: 'failed',
78
- lines: [
79
- `${short}: nx exited with ${code}`,
80
- ...shown(`${stdout}\n${stderr}`),
81
- ],
82
- };
83
- const lines = [
84
- `${short}: ${failed.length} of ${tasks.length} tasks failed: ${failed.map(taskName).join(', ')}`,
85
- ];
86
- for (const task of failed) {
87
- if (failed.length > 1)
88
- lines.push(` ${taskName(task)}`);
89
- const output = await readFile(join(cache, 'terminalOutputs', task.hash), 'utf8').catch(() => '');
90
- lines.push(...shown(output, true));
91
- }
92
- return { kind: 'failed', lines };
93
- });
49
+ const snapshot = await push.snapshot(head, { packages: true });
50
+ const cache = snapshot.nxCacheDirectory;
51
+ // A run that ends before its tasks writes no summary, so the summary of
52
+ // an older run must not stay.
53
+ await rm(join(cache, 'run.json'), { force: true });
54
+ const { status, stdout, stderr } = await snapshot.bin('nx', [
55
+ 'run-many',
56
+ `--targets=${this.#targets.join(',')}`,
57
+ '--configuration=production',
58
+ ...(this.#parallel === undefined
59
+ ? []
60
+ : [`--parallel=${this.#parallel}`]),
61
+ ], { env: this.#env });
62
+ const tasks = await lastRun(cache);
63
+ if (status === 0) {
64
+ const projects = new Set(tasks.map((task) => task.projectName));
65
+ const cached = tasks.filter((task) => task.cacheStatus !== 'cache-miss');
66
+ return {
67
+ kind: 'built',
68
+ line: `${short}: built ${projects.size} projects, ${cached.length} of ${tasks.length} tasks from cache`,
69
+ };
70
+ }
71
+ // nx exits with 130 when a task fails, so each code other than 0 is a
72
+ // fail.
73
+ const failed = tasks.filter((task) => task.status !== 0);
74
+ if (failed.length === 0)
75
+ return {
76
+ kind: 'failed',
77
+ lines: [
78
+ `${short}: nx exited with ${status}`,
79
+ ...shown(`${stdout}\n${stderr}`),
80
+ ],
81
+ };
82
+ const lines = [
83
+ `${short}: ${failed.length} of ${tasks.length} tasks failed: ${failed.map(taskName).join(', ')}`,
84
+ ];
85
+ for (const task of failed) {
86
+ if (failed.length > 1)
87
+ lines.push(` ${taskName(task)}`);
88
+ const output = await readFile(join(cache, 'terminalOutputs', task.hash), 'utf8').catch(() => '');
89
+ lines.push(...shown(output, true));
90
+ }
91
+ return { kind: 'failed', lines };
94
92
  }
95
93
  catch (error) {
96
94
  if (error instanceof MissingLockfileError)
package/dist/build.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"build.js","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAErD,OAAO,EAAE,oBAAoB,EAAa,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAgB,IAAI,EAAE,MAAM,WAAW,CAAC;AAY/C,oEAAoE;AACpE,MAAM,UAAU,GAAG,EAAE,CAAC;AAetB,0EAA0E;AAC1E,yEAAyE;AACzE,wEAAwE;AACxE,8EAA8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