@williamthorsen/nmr 0.39.0 → 0.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/.meta/changelog.json +128 -4
  2. package/.readyup/kits/default.js +47 -32
  3. package/.readyup/manifest.json +12 -7
  4. package/CHANGELOG.md +38 -0
  5. package/README.md +41 -73
  6. package/agents/README.md +8 -8
  7. package/agents/guidance/rulebooks/nmr.md +8 -8
  8. package/bin/ensure-prepublish-hooks.js +1 -1
  9. package/bin/nmr-clean.js +1 -1
  10. package/bin/nmr-compile.js +1 -1
  11. package/bin/nmr-fmt.js +1 -1
  12. package/bin/nmr-report-catalog.js +1 -1
  13. package/bin/nmr-report-overrides.js +1 -1
  14. package/bin/nmr-taze.js +1 -1
  15. package/bin/nmr.js +1 -1
  16. package/dist/esm/UserError.d.ts +1 -2
  17. package/dist/esm/check-cache.d.ts +59 -61
  18. package/dist/esm/commands/build-output.d.ts +35 -36
  19. package/dist/esm/commands/build.d.ts +13 -14
  20. package/dist/esm/commands/build.js +3 -3
  21. package/dist/esm/commands/clean.d.ts +6 -6
  22. package/dist/esm/commands/ensure-prepublish-hooks.d.ts +5 -5
  23. package/dist/esm/commands/fmt.d.ts +8 -8
  24. package/dist/esm/commands/fmt.js +1 -1
  25. package/dist/esm/commands/report-catalog.d.ts +5 -7
  26. package/dist/esm/commands/report-catalog.js +1 -1
  27. package/dist/esm/commands/report-overrides.d.ts +0 -2
  28. package/dist/esm/commands/report-overrides.js +1 -1
  29. package/dist/esm/commands/taze.d.ts +9 -8
  30. package/dist/esm/config.d.ts +5 -5
  31. package/dist/esm/config.js +3 -3
  32. package/dist/esm/context.d.ts +1 -2
  33. package/dist/esm/default-scripts.d.ts +5 -6
  34. package/dist/esm/defineConfig.d.ts +1 -1
  35. package/dist/esm/git-ignored-paths.d.ts +9 -0
  36. package/dist/esm/git-ignored-paths.js +10 -0
  37. package/dist/esm/glyphs.d.ts +3 -3
  38. package/dist/esm/help.d.ts +2 -2
  39. package/dist/esm/helpers/clampToBytes.d.ts +4 -5
  40. package/dist/esm/helpers/config-path.d.ts +0 -2
  41. package/dist/esm/helpers/createBoundedBuffer.d.ts +2 -2
  42. package/dist/esm/helpers/deriveExcerpt.d.ts +4 -5
  43. package/dist/esm/helpers/duration.d.ts +8 -9
  44. package/dist/esm/helpers/filter-selection.d.ts +19 -19
  45. package/dist/esm/helpers/findClosestName.d.ts +1 -1
  46. package/dist/esm/helpers/hook-name.d.ts +2 -5
  47. package/dist/esm/helpers/package-json.d.ts +9 -8
  48. package/dist/esm/helpers/readStringValues.d.ts +2 -3
  49. package/dist/esm/helpers/reportClosing.d.ts +8 -9
  50. package/dist/esm/helpers/transcript.d.ts +13 -13
  51. package/dist/esm/helpers/type-guards.d.ts +1 -0
  52. package/dist/esm/output-style.d.ts +12 -13
  53. package/dist/esm/prettier.d.ts +2 -2
  54. package/dist/esm/recording.d.ts +20 -15
  55. package/dist/esm/recording.js +7 -7
  56. package/dist/esm/replay-assembly.d.ts +10 -10
  57. package/dist/esm/report-format.d.ts +14 -19
  58. package/dist/esm/reportCliFailure.d.ts +2 -3
  59. package/dist/esm/resolve-scripts.d.ts +4 -5
  60. package/dist/esm/resolveBinStyles.d.ts +4 -5
  61. package/dist/esm/resolver.d.ts +14 -18
  62. package/dist/esm/runCli.d.ts +6 -6
  63. package/dist/esm/runCli.js +21 -21
  64. package/dist/esm/runner.d.ts +19 -19
  65. package/dist/esm/steps.d.ts +43 -42
  66. package/dist/esm/taze.d.ts +1 -1
  67. package/dist/esm/tests.d.ts +18 -13
  68. package/dist/esm/tests.js +2 -2
  69. package/dist/esm/tiers.d.ts +27 -23
  70. package/dist/esm/tiers.js +6 -2
  71. package/dist/esm/types.d.ts +5 -5
  72. package/dist/esm/verbosity.d.ts +22 -20
  73. package/dist/esm/verdict.d.ts +33 -33
  74. package/dist/esm/verdict.js +1 -1
  75. package/dist/esm/vitest-source-resolution.d.ts +11 -11
  76. package/dist/esm/vitest-source-resolution.js +2 -2
  77. package/dist/esm/vitest.d.ts +25 -24
  78. package/dist/esm/vitest.js +16 -8
  79. package/dist/esm/workspace.d.ts +4 -4
  80. package/docs/check-cache.md +57 -57
  81. package/docs/prettier.md +10 -10
  82. package/docs/reporting.md +46 -46
  83. package/docs/scripts.md +29 -29
  84. package/docs/upgrades.md +18 -18
  85. package/docs/utilities.md +13 -13
  86. package/docs/vitest.md +64 -62
  87. package/docs/workspace.md +19 -19
  88. package/package.json +5 -4
@@ -1,15 +1,15 @@
1
1
  /**
2
- * One element of a resolved command chain, carrying how it was composed rather than how its text reads.
3
- * A `structural` step is nmr's own composition, held as argv; an `opaque` step is a command nmr does not parse.
2
+ * One element of a resolved command chain, recording how it was composed rather than how its text reads.
3
+ * A `structural` step is nmr's own composition, stored as argv; an `opaque` step is a command that nmr does not
4
+ * parse.
4
5
  *
5
6
  * A structural step's argv leads with the file to spawn, so the runner has one to hand `spawn` without a shell.
6
7
  *
7
- * `shouldDeclineArguments` travels from the composite element that composed the step to the one reader that acts on it,
8
- * the binding of the invocation's trailing arguments. Every stage between the two -- the devBin substitution,
9
- * the chain rendering, the replay assembly, the runner -- passes it through and asks nothing of it.
8
+ * `shouldDeclineArguments` is passed from the composite element that composed the step to the one reader that acts
9
+ * on it, the binding of the invocation's trailing arguments. Every stage between the two passes it through unread.
10
10
  *
11
11
  * `shouldWithholdInput` is read by the runner alone, which gives the step's child the null device as stdin rather
12
- * than nmr's own. Like `shouldDeclineArguments`, it is set only where it holds and leaves the rendered chain unchanged.
12
+ * than nmr's own. Like `shouldDeclineArguments`, it is set only when it holds and leaves the rendered chain unchanged.
13
13
  */
14
14
  export type Step = {
15
15
  kind: 'opaque';
@@ -20,81 +20,82 @@ export type Step = {
20
20
  shouldDeclineArguments?: boolean;
21
21
  shouldWithholdInput?: boolean;
22
22
  };
23
- /** What a structural step asks of the nmr process it spawns. */
23
+ /** What a structural step asks of the nmr process that it spawns. */
24
24
  export interface NmrStepTarget {
25
25
  command: string;
26
- /** Whether the command is fanned out to other scopes, where a `-R` or `-F` sends it. */
26
+ /** Whether the command is fanned out to other scopes, as it is when a `-R` or `-F` sends it. */
27
27
  isDelegate: boolean;
28
28
  /**
29
- * Whether the command is fanned out to every package, where a `-R` sends it. A separate field rather than a
30
- * narrowing of `isDelegate`, whose reader surveys the scopes a `-F` may also have reached.
29
+ * Whether the command is fanned out to every package, as it is when a `-R` sends it. A separate field rather
30
+ * than a narrowing of `isDelegate`, whose reader surveys the scopes that a `-F` may also have reached.
31
31
  */
32
32
  isRecursive: boolean;
33
- /** Whether the command runs against the root registry, where a `-w` anchors it. */
33
+ /** Whether the command runs against the root registry, as it does when a `-w` anchors it. */
34
34
  isWorkspaceRoot: boolean;
35
35
  }
36
36
  /**
37
- * How a `package.json` entry names the command it is declared under: as its whole value, or alongside other
38
- * steps. `sole` covers an entry carrying trailing arguments, which declare no step of their own.
37
+ * How a `package.json` entry names the command under which it is declared: as its whole value, or alongside
38
+ * other steps. `sole` covers an entry with trailing arguments, which do not declare a step of their own.
39
39
  */
40
40
  export type SelfReference = 'chained' | 'sole';
41
41
  /**
42
42
  * Composes the structural step that re-invokes nmr for one composite element.
43
43
  *
44
- * The element tokenizes on whitespace, so it may carry nmr's own flags but cannot carry a space-bearing token.
45
- * `-w` is prepended as its own token, so the child selects the root registry on its own.
44
+ * The element tokenizes on whitespace, so it may contain nmr's own flags but cannot contain a space-bearing
45
+ * token. `-w` is prepended as its own token: The child selects the root registry on its own.
46
46
  *
47
- * `shouldDeclineArguments` is set only where it holds, so a step that takes the trailing arguments renders and compares
48
- * exactly as it did before any element declared anything.
47
+ * Because `shouldDeclineArguments` is set only when it holds, a step that takes the trailing arguments compares
48
+ * equal to one composed without the option.
49
49
  */
50
50
  export declare function composeNmrStep(element: string, isWorkspaceRoot: boolean, shouldDeclineArguments?: boolean): Step;
51
51
  /**
52
- * Returns the steps that still run in a workspace holding no package: every step but the ones a `-R` fans out.
52
+ * Returns the steps that still run in a workspace without any package: every step but the ones that a `-R` fans
53
+ * out.
53
54
  *
54
- * A `-F` step is left standing. It names one package, and its absence is a real error whoever composed the
55
- * step, where a `-R` asked for every package and a workspace with none has nothing for it to do.
55
+ * A `-F` step is kept. It names one package, and its absence is a real error whoever composed the step, whereas
56
+ * a `-R` asked for every package and a workspace with none has nothing for it to do.
56
57
  */
57
58
  export declare function dropRecursiveSteps(steps: readonly Step[]): Step[];
58
59
  /**
59
- * Returns the text of the first opaque step that reaches nmr through a shell, or `undefined` when none does.
60
+ * Returns the text of the first opaque step that runs nmr through a shell, or `undefined` when none does.
60
61
  *
61
62
  * Recognizes nmr in command position: at the start of the step, after `&&`, `||`, `;`, `|`, or a newline, past
62
63
  * any leading environment assignments, and behind a launcher such as `npx` or `pnpm exec`. A separator inside
63
- * quotes opens no position, so a command merely naming nmr in an argument is not a crossing.
64
+ * quotes does not open a command position, so a command merely naming nmr in an argument is not a crossing.
64
65
  *
65
- * Partial by construction, and partial in stated ways rather than arbitrary ones: a value-taking flag standing
66
+ * Partial by construction, and partial in stated ways rather than arbitrary ones: A value-taking flag standing
66
67
  * immediately before the program name hides it (`npx -p foo nmr`), and a launcher outside `LAUNCHERS` goes
67
- * unreported. What it finds is the boundary below which nmr cannot tell its own processes from the tools it
68
- * runs.
68
+ * unreported. What it finds is the boundary below which nmr cannot tell its own processes from the tools that
69
+ * it runs.
69
70
  */
70
71
  export declare function findNmrCrossing(steps: readonly Step[]): string | undefined;
71
72
  /**
72
73
  * Returns the first token of a composite element that falls outside the grammar, or `undefined` when the
73
- * element is a command name optionally preceded by nmr's own flags. A token the shell would not read
74
- * literally is one the rendering would quote whole, turning the element into a command nobody wrote.
74
+ * element is a command name optionally preceded by nmr's own flags. A token that the shell would not read
75
+ * literally would be quoted whole by the rendering, turning the element into a command that nobody wrote.
75
76
  */
76
77
  export declare function findUnexpressibleToken(element: string): string | undefined;
77
78
  /**
78
- * Returns the command a structural step's nmr process runs, whether the step hands that command to other
79
- * scopes rather than running it where it stands, and whether it anchors the command at the monorepo root.
80
- * Reports nothing for a step that names no nmr command.
79
+ * Returns the command that a structural step's nmr process runs, whether the step hands that command to other
80
+ * scopes rather than running it in its own scope, and whether it anchors the command at the monorepo root.
81
+ * Reports nothing for a step that does not name an nmr command.
81
82
  *
82
- * The inverse of `composeNmrStep`, and beside it because the two share one grammar: an element may lead with
83
+ * The inverse of `composeNmrStep`, and beside it because the two share one grammar: An element may lead with
83
84
  * nmr's own flags, and the command is the first token that is not one.
84
85
  */
85
86
  export declare function readNmrStep(step: Step): NmrStepTarget | undefined;
86
87
  /**
87
- * Reports whether a `package.json` entry re-invokes the command it is declared under, and whether it declares
88
- * anything besides. Reports nothing for an entry that names another command, or none.
88
+ * Reports whether a `package.json` entry re-invokes the command under which it is declared, and whether it
89
+ * declares anything besides. Reports nothing for an entry that names another command, or none.
89
90
  *
90
- * Honouring such an entry would spawn a shell running the same command in the same directory, reaching the
91
- * same entry again without bound, so resolution discards it however it reads. `chained` is what separates an
92
- * entry that thereby loses steps from one that declares nothing to lose.
91
+ * Honouring such an entry would spawn a shell running the same command in the same directory, which reads the
92
+ * same entry again without bound, so resolution discards it however it reads. `chained` separates an entry that
93
+ * thereby loses steps from one that declares nothing to lose.
93
94
  *
94
- * A segment that delegates carries the command to other scopes rather than back to this one. `-w` re-enters
95
- * only from the root, a package's entry reaching the root's registry and `package.json` instead of its own.
95
+ * A segment that delegates sends the command to other scopes rather than back to this one. `-w` re-enters
96
+ * only from the root, a package's `-w` entry resolving against the root's registry and `package.json` instead of its own.
96
97
  *
97
- * Partial in the same ways `findNmrCrossing` is, and for the same reason: what goes unrecognized re-enters
98
+ * Partial in the same ways `findNmrCrossing` is, and for the same reason: What goes unrecognized re-enters
98
99
  * without bound, which hangs rather than passing quietly.
99
100
  */
100
101
  export declare function readSelfReference(options: {
@@ -103,9 +104,9 @@ export declare function readSelfReference(options: {
103
104
  script: string;
104
105
  }): SelfReference | undefined;
105
106
  /**
106
- * Renders a step list as the `&&` chain a shell runs.
107
+ * Renders a step list as the `&&` chain that a shell runs.
107
108
  *
108
- * The sole producer of a chain string: the check-result cache keys on that string, so a change to the rendering
109
- * invalidates every recorded pass by construction rather than by anyone remembering to.
109
+ * The sole producer of a chain string: The check-result cache keys on that string, so a change to the rendering
110
+ * invalidates every recorded pass.
110
111
  */
111
112
  export declare function renderChain(steps: readonly Step[]): string;
@@ -12,7 +12,7 @@ export type TazeConfig = {
12
12
  /**
13
13
  * Builds a taze configuration from nmr's shared upgrade policy and a repo's own settings.
14
14
  *
15
- * Any property the caller supplies wins, including `0` and an explicit `undefined` — the latter restores
15
+ * Any property that the caller supplies wins, including `0` and an explicit `undefined`. The latter restores
16
16
  * taze's inheritance of pnpm's `minimumReleaseAge`, which only applies while `maturityPeriod` is unset.
17
17
  *
18
18
  * The merge is shallow, which suits a policy of scalar defaults. A nested default would clobber rather
@@ -1,29 +1,34 @@
1
1
  /**
2
- * Declares a suite asserting that a repo's test files hold to nmr's conventions: every collected file names an
3
- * isolation tier, and every test file sits under a `__tests__` directory.
2
+ * Declares a suite asserting that a repo's test files follow nmr's conventions: Every collected file names an
3
+ * isolation tier, and every test file is under a `__tests__` directory.
4
4
  *
5
- * Wire it from a one-line test of the repo's own, so the file stays under the repo's `__tests__` and the repo
6
- * scopes what the sweep covers. Both halves are silent without it: `unit` is the residual project, so an untiered
7
- * file runs and passes, and a file outside `__tests__` is collected by nothing at all.
5
+ * Call it from a one-line test of the repo's own, so that the file stays under the repo's `__tests__` and the repo
6
+ * scopes what the sweep covers. Without it, a violation of either half goes unreported: `unit` is the residual
7
+ * project, so an untiered file runs and passes, and a file outside `__tests__` is collected by nothing at all.
8
8
  *
9
- * `excludedBasenames` names directory basenames the sweep prunes at any depth, additive to the ones nmr always
9
+ * `excludedBasenames` names directory basenames that the sweep prunes at any depth, additive to the ones nmr always
10
10
  * prunes. Pass the same array to `defineVitestConfig`'s `testCollectionExclude`, or the sweep and the collection
11
- * glob describe different trees: a directory pruned here alone still runs the files this suite stopped reporting.
11
+ * glob describe different trees: Vitest still runs the files in a directory pruned here alone, and this suite no
12
+ * longer reports them.
13
+ *
14
+ * Because untracked paths that git ignores are out of scope for the sweep and the shared configs' collection alike,
15
+ * a directory that `.gitignore` covers does not need an entry in `excludedBasenames`. Outside a git repository, only
16
+ * the named directories are pruned.
12
17
  */
13
18
  export declare function checkTestFileConventions(options?: TestFileConventionsOptions): void;
14
19
  /**
15
- * Sweeps a repo for both halves of the convention, reporting the root it swept alongside what it found.
20
+ * Sweeps a repo for both halves of the convention, reporting the root that it swept alongside what it found.
16
21
  *
17
- * The root is what makes the result trustworthy, and it is the one thing an assertion cannot check: a sweep
18
- * started from the directory Vitest supplies covers one package, finds nothing, and passes.
22
+ * The root makes the result trustworthy, and it is the one thing that an assertion cannot check: A sweep started
23
+ * from the directory that Vitest supplies covers one package, finds nothing, and passes.
19
24
  *
20
25
  * @internal - Exported only to enable testing
21
26
  */
22
27
  export declare function reportTestFileConventions(options?: TestFileConventionsOptions): TestFileConventionsReport;
23
28
  export interface TestFileConventionsOptions {
24
29
  /**
25
- * Directory basenames the sweep prunes at any depth, additive to the ones nmr always prunes. The array a repo
26
- * passes here is the array it passes to `defineVitestConfig`'s `testCollectionExclude`.
30
+ * Directory basenames that the sweep prunes at any depth, additive to the ones nmr always prunes and to the paths
31
+ * that git ignores. A repo passes the same array here and to `defineVitestConfig`'s `testCollectionExclude`.
27
32
  */
28
33
  excludedBasenames?: readonly string[];
29
34
  /**
@@ -32,7 +37,7 @@ export interface TestFileConventionsOptions {
32
37
  */
33
38
  rootDir?: string;
34
39
  }
35
- /** What one sweep found, and the root it found it in. Paths are relative to that root and POSIX-separated. */
40
+ /** What one sweep found, and the root in which it found it. Paths are relative to that root and POSIX-separated. */
36
41
  export interface TestFileConventionsReport {
37
42
  misplacedFiles: string[];
38
43
  rootDir: string;
package/dist/esm/tests.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { describe, expect, it } from 'vitest';
2
2
  import { findMisplacedTestFiles, findUntieredTestFiles, TIER_NAMES } from "./tiers.js";
3
3
  import { findMonorepoRoot } from "./workspace.js";
4
- const MISPLACED_REMEDY = 'Every test file must sit under a `__tests__` directory, the only place the shared Vitest config collects from. Move each file below into one, or name its directory in `excludedBasenames`.';
4
+ const MISPLACED_REMEDY = 'Every test file must be under a `__tests__` directory, the only place from which the shared Vitest config collects. Move each file below into one, or name its directory in `excludedBasenames`.';
5
5
  const UNTIERED_REMEDY = `Every collected test file must name its isolation tier in the segment before \`.test.\`, one of: ${TIER_NAMES.join(', ')}. Rename each file below to <subject>[.<aspect>].<tier>.test.ts.`;
6
6
  const RETIRED_OPTION_KEYS = new Map([['exclude', 'excludedBasenames']]);
7
7
  export function checkTestFileConventions(options = {}) {
@@ -11,7 +11,7 @@ export function checkTestFileConventions(options = {}) {
11
11
  it('every collected test file names its tier', () => {
12
12
  expect(untieredFiles, `${UNTIERED_REMEDY} Swept from ${rootDir}.`).toStrictEqual([]);
13
13
  });
14
- it('every test file sits under a __tests__ directory', () => {
14
+ it('every test file is under a __tests__ directory', () => {
15
15
  expect(misplacedFiles, `${MISPLACED_REMEDY} Swept from ${rootDir}.`).toStrictEqual([]);
16
16
  });
17
17
  });
@@ -1,30 +1,30 @@
1
- /** Collection patterns for the residual project, which claims every test file the named tiers leave. */
1
+ /** Collection patterns for the residual project, which claims every test file that the named tiers leave. */
2
2
  export declare const ALL_TEST_PATTERNS: string[];
3
3
  /** Builds the collection patterns for one tier. */
4
4
  export declare function buildTierPatterns(tier: string): string[];
5
5
  /**
6
- * Walks `rootDir` for every `*.test.ts` or `*.test.tsx` file sitting outside a `__tests__` directory, returning
7
- * paths relative to it, POSIX-separated and sorted.
6
+ * Walks `rootDir` for every `*.test.ts` or `*.test.tsx` file outside a `__tests__` directory, returning paths
7
+ * relative to it, POSIX-separated and sorted.
8
8
  *
9
- * No project collects such a file, so it runs nowhere and reports nothing. Only a sweep of the tree tells it apart
10
- * from a file that runs and passes.
9
+ * The shared config's projects do not collect such a file, so it runs nowhere and reports nothing. Only a sweep of
10
+ * the tree tells it apart from a file that runs and passes.
11
11
  */
12
12
  export declare function findMisplacedTestFiles(rootDir: string, options?: TestFileScanOptions): string[];
13
13
  /**
14
- * Walks `rootDir` for every test file the shared config's projects collect, returning paths relative to it,
14
+ * Walks `rootDir` for every test file that the shared config's projects collect, returning paths relative to it,
15
15
  * POSIX-separated and sorted.
16
16
  *
17
- * A walk, because `node:fs` `globSync` does not descend into a dot-directory and honours no option that would make
18
- * it. Vitest's globber does, so the same pattern string means different things to the two: a check built on the glob
19
- * would report clean over every test file under a dot-directory.
17
+ * A walk, because `node:fs` `globSync` does not descend into a dot-directory and does not honour any option that
18
+ * would make it. Vitest's globber does, so the same pattern string means different things to the two: A check built
19
+ * on the glob would report clean over every test file under a dot-directory.
20
20
  */
21
21
  export declare function findTestFiles(rootDir: string, options?: TestFileScanOptions): string[];
22
22
  /**
23
- * Walks `rootDir` for every collected test file whose name selects no tier, returning paths relative to it,
23
+ * Walks `rootDir` for every collected test file whose name does not select a tier, returning paths relative to it,
24
24
  * POSIX-separated and sorted.
25
25
  *
26
- * `unit` is the residual project, so such a file runs under it and reports success: no test run tells it apart from
27
- * a conformant file.
26
+ * Because `unit` is the residual project, such a file runs under it and reports success: A test run cannot tell it
27
+ * apart from a conformant file.
28
28
  */
29
29
  export declare function findUntieredTestFiles(rootDir: string, options?: TestFileScanOptions): string[];
30
30
  /**
@@ -35,27 +35,31 @@ export declare function findUntieredTestFiles(rootDir: string, options?: TestFil
35
35
  */
36
36
  export declare function hasTierInfix(filePath: string): boolean;
37
37
  /**
38
- * Directory names that hold no test worth collecting: dependencies, build output, and generated reports.
38
+ * Names of directories that do not contain any test worth collecting: dependencies, build output, and generated
39
+ * reports.
39
40
  *
40
- * The one point where the collection glob and the walk must agree about scope. Over-reporting is a failure a
41
- * consumer cannot fix; under-reporting is the silence a conformance check exists to end.
41
+ * These and the paths that git ignores are the scope on which the collection glob and the walk must agree.
42
+ * Over-reporting is a failure that a consumer cannot fix; under-reporting hides the violations that a conformance
43
+ * check exists to report.
42
44
  */
43
45
  export declare const TEST_COLLECTION_EXCLUDE: string[];
44
- /** Options every sweep over a repo's test files takes. */
46
+ /** Options that every sweep over a repo's test files takes. */
45
47
  export interface TestFileScanOptions {
46
48
  /**
47
- * Directory basenames pruned at any depth, additive to `TEST_COLLECTION_EXCLUDE`.
49
+ * Directory basenames pruned at any depth, additive to `TEST_COLLECTION_EXCLUDE` and to the paths that git
50
+ * ignores.
48
51
  *
49
- * Basenames rather than globs, so the array a repo passes here is the array it passes to the shared Vitest
50
- * config's `testCollectionExclude`. A directory pruned from the sweep but still collected by Vitest is the
51
- * silence these sweeps exist to end.
52
+ * Basenames rather than globs, so that a repo can pass the same array here and to the shared Vitest config's
53
+ * `testCollectionExclude`. Vitest still runs the files in a directory pruned from the sweep alone, and the sweep
54
+ * does not report them.
52
55
  */
53
56
  excludedBasenames?: readonly string[];
54
57
  }
55
58
  /**
56
- * The isolation ladder, ordered by the furthest thing a test reaches. A tier names what a test reaches, never how it
57
- * invokes it: a test driving a compiler through its JavaScript API is `tool`, exactly as one spawning `tsc` would be.
58
- * Each named tier's name is also its filename infix, so `parse.tool.test.ts` lands in `tool`.
59
+ * The isolation ladder, ordered by the furthest thing that a test reaches. A tier names what a test reaches, never
60
+ * how it invokes it: A test driving a compiler through its JavaScript API is `tool`, exactly as one spawning `tsc`
61
+ * would be. Each named tier's name is also its filename infix, so `parse.tool.test.ts` is collected by the `tool`
62
+ * project.
59
63
  */
60
64
  export declare const TIER_NAMES: readonly ["unit", "tool", "localhost", "remote"];
61
65
  /** One of the four isolation tiers. */
package/dist/esm/tiers.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { readdirSync } from 'node:fs';
2
2
  import path from 'node:path';
3
+ import { listGitIgnoredPaths } from "./git-ignored-paths.js";
3
4
  const TEST_DIR = '__tests__';
4
5
  const TEST_EXTENSIONS = '{ts,tsx}';
5
6
  const TEST_GLOB_PREFIX = `**/${TEST_DIR}/**`;
@@ -28,11 +29,13 @@ function collectTestFiles(dir, relativeDir, isInTestDir, context) {
28
29
  for (const entry of entries) {
29
30
  const relativePath = relativeDir === '' ? entry.name : `${relativeDir}/${entry.name}`;
30
31
  if (entry.isDirectory()) {
31
- if (context.pruned.has(entry.name))
32
+ if (context.pruned.has(entry.name) || context.ignoredPaths.has(`${relativePath}/`))
32
33
  continue;
33
34
  collectTestFiles(path.join(dir, entry.name), relativePath, isInTestDir || entry.name === TEST_DIR, context);
34
35
  }
35
- else if (isInTestDir !== context.misplaced && TEST_FILE_PATTERN.test(entry.name)) {
36
+ else if (isInTestDir !== context.misplaced &&
37
+ TEST_FILE_PATTERN.test(entry.name) &&
38
+ !context.ignoredPaths.has(relativePath)) {
36
39
  context.foundPaths.push(relativePath);
37
40
  }
38
41
  }
@@ -40,6 +43,7 @@ function collectTestFiles(dir, relativeDir, isInTestDir, context) {
40
43
  function walkTestFiles(rootDir, { excludedBasenames = [] }, misplaced) {
41
44
  const context = {
42
45
  foundPaths: [],
46
+ ignoredPaths: new Set(listGitIgnoredPaths(rootDir)),
43
47
  misplaced,
44
48
  pruned: new Set([...TEST_COLLECTION_EXCLUDE, ...excludedBasenames]),
45
49
  };
@@ -6,7 +6,7 @@ export type { CommandVerbosity } from './verbosity.js';
6
6
  export interface BuildConfig {
7
7
  /**
8
8
  * Patterns added to the build's default ignore set. Extends rather than replaces, so that declaring one pattern
9
- * cannot silently drop the defaults and start shipping a package's own tests.
9
+ * cannot silently drop the defaults and start publishing a package's own tests.
10
10
  * The programmatic `buildPackage` option of the same name behaves identically; its bare `ignorePatterns` replaces.
11
11
  */
12
12
  extraIgnorePatterns?: string[];
@@ -23,7 +23,7 @@ export interface CheckCacheConfig {
23
23
  /**
24
24
  * Command names added to the cacheable set. Extends rather than replaces, so that declaring one command
25
25
  * cannot silently drop the defaults. A name listed here promises exit-status-only semantics through its whole
26
- * chain, hooks included, and has to resolve to a command: both lists are read by name alone, so a misspelt
26
+ * chain, hooks included, and has to resolve to a command: Both lists are read by name alone, so a misspelt
27
27
  * entry would otherwise be inert.
28
28
  */
29
29
  extraCommands?: string[];
@@ -31,13 +31,13 @@ export interface CheckCacheConfig {
31
31
  /** Output settings honored at the monorepo root. */
32
32
  export interface OutputConfig {
33
33
  /**
34
- * The verbosity a run takes when neither `-q` nor the environment named one. Both of those outrank it, and it
35
- * outranks agent-harness detection, so `full` here is also how a repo declines to be detected.
34
+ * The verbosity that a run takes when neither `-q` nor the environment named one. Both of those outrank it.
35
+ * Because it outranks agent-harness detection, `full` here is also how a repo declines to be detected.
36
36
  */
37
37
  commandVerbosity?: CommandVerbosity;
38
38
  /**
39
39
  * Environment-variable names added to the set whose presence marks an agent harness. Extends rather than
40
- * replaces, so that declaring one name cannot silently drop the shipped list, and a repo absorbs a harness's
40
+ * replaces, so that declaring one name cannot silently drop the built-in list, and a repo handles a harness's
41
41
  * rename without waiting for an nmr release.
42
42
  */
43
43
  extraAgentEnvVars?: string[];
@@ -1,55 +1,57 @@
1
1
  import type { OutputConfig } from './types.js';
2
2
  /**
3
- * Environment variables a known agent harness sets, whose presence selects quiet when no level above them chose.
4
- * The identifiers belong to ecosystems nmr does not control and that rename, so `output.extraAgentEnvVars` extends
5
- * this list rather than a repo waiting for a release. `ROVO_CLI` anticipates a rename of `ROVODEV_CLI` that Rovo
6
- * has signalled but not made; a variable nobody sets never fires.
3
+ * Environment variables that a known agent harness sets, whose presence selects quiet when every level above them
4
+ * left the verbosity unset. `output.extraAgentEnvVars` extends the list. `ROVO_CLI` anticipates a rename of
5
+ * `ROVODEV_CLI` that Rovo has signalled but not made.
7
6
  */
8
7
  export declare const AGENT_ENV_VARS: readonly ["CLAUDECODE", "ROVODEV_CLI", "ROVO_CLI"];
9
8
  /**
10
9
  * The points on the loudness ladder. Both are spelled out rather than leaving `full` implicit in the variable's
11
- * absence, so a repo-level default is overridable from the environment in either direction.
10
+ * absence, so that a repo-level default is overridable from the environment in either direction.
12
11
  */
13
12
  export declare const COMMAND_VERBOSITIES: readonly ["full", "quiet"];
14
13
  /**
15
- * Carries the resolved verbosity down the spawned chain, so `-q` reaches every process rather than the first.
16
- * Deliberately not a keyed variable: it changes what a run prints and never what a command concludes, so folding
17
- * it into the cache key would stop a quiet run from hitting a pass a loud one recorded.
14
+ * Passes the resolved verbosity down the chain of spawned processes, so that `-q` applies to every process rather
15
+ * than only the first. The pass key does not include it: It changes what a run prints and never what a command
16
+ * concludes, so a quiet run can reuse a pass that a full run recorded.
18
17
  */
19
18
  export declare const COMMAND_VERBOSITY_ENV_VAR = "NMR_COMMAND_VERBOSITY";
20
- /** How loudly nmr reports the output of the commands it runs, which is never its own verdicts. */
19
+ /** How loudly nmr reports the output of the commands that it runs, which is never its own verdicts. */
21
20
  export type CommandVerbosity = (typeof COMMAND_VERBOSITIES)[number];
22
21
  /**
23
- * Renders the rejection of a value off the loudness ladder, naming where it was written. Every source that accepts
24
- * a verbosity renders through this, so no two of them can come to name different ladders.
22
+ * Renders the rejection of a value off the loudness ladder, naming where it was written. Because every source that
23
+ * accepts a verbosity renders through this, the sources cannot come to name different ladders.
25
24
  */
26
25
  export declare function formatVerbosityRejection(source: string, value: string): string;
27
26
  /** Narrows a raw value to a point on the loudness ladder. */
28
27
  export declare function isCommandVerbosity(value: string): value is CommandVerbosity;
29
28
  /**
30
- * Reads the verbosity the environment names. An unrecognized value resolves to nothing at all, since falling back
31
- * would pick a mode nobody chose and hide a misspelling for the life of the shell.
29
+ * Reads the verbosity that the environment names. An unrecognized value is returned as an error, since a fallback
30
+ * would pick a mode that nobody chose and hide a misspelling for the life of the shell.
32
31
  *
33
- * An unset or empty variable names no verbosity rather than resolving to `full`, which is what leaves the config
34
- * and detection levels reachable: a floor written in here would outrank both of them.
32
+ * For an unset or empty variable, this returns a result without a verbosity rather than resolving to `full`, which
33
+ * is what leaves the config and detection levels reachable: A floor written in here would outrank both of them.
35
34
  */
36
35
  export declare function readVerbosityEnv(env: NodeJS.ProcessEnv): VerbosityRead;
37
36
  export interface ResolveVerbosityOptions {
38
- /** Read for the detection level, and for that alone: the variable this module owns arrives as `envVerbosity`. */
37
+ /**
38
+ * Read for the detection level, and for that alone: The caller passes the variable that this module owns as
39
+ * `envVerbosity`.
40
+ */
39
41
  env: NodeJS.ProcessEnv;
40
42
  envVerbosity: CommandVerbosity | undefined;
41
43
  hasQuietFlag: boolean;
42
44
  output: OutputConfig | undefined;
43
45
  }
44
46
  /**
45
- * Resolves the verbosity this process runs at: the flag, then the environment, then the repo's config, then
47
+ * Resolves the verbosity at which this process runs: the flag, then the environment, then the repo's config, then
46
48
  * detection of a known agent harness, then `full`.
47
49
  *
48
- * Total by construction. The environment was validated as it was read and the config as it was loaded, so no
49
- * rejection is left for this to report and the whole ladder reads in one place.
50
+ * Total by construction. The environment was validated as it was read and the config as it was loaded, so this does
51
+ * not have any rejection left to report, and the whole ladder can be read in one place.
50
52
  */
51
53
  export declare function resolveVerbosity(options: ResolveVerbosityOptions): CommandVerbosity;
52
- /** The verbosity the environment names, if any, or the message naming why its value could not be read. */
54
+ /** The verbosity that the environment names, if any, or the message naming why its value could not be read. */
53
55
  export type VerbosityRead = {
54
56
  ok: true;
55
57
  verbosity?: CommandVerbosity;
@@ -3,40 +3,41 @@ import { type OutputStyle } from '@williamthorsen/nmr-core';
3
3
  import type { ReplayLine } from './check-cache.js';
4
4
  import type { ReportFormat } from './report-format.js';
5
5
  /**
6
- * The ceiling a rendered verdict, its newline included, is held to.
6
+ * The ceiling to which a rendered verdict, its newline included, is held.
7
7
  *
8
- * POSIX guarantees a write at or below `PIPE_BUF` reaches a pipe whole, and 512 is the smallest bound the
9
- * standard permits, so one write of a line this size cannot be interleaved by a concurrent scope under
10
- * `pnpm --recursive`. No Node API reports the platform's own bound, and a per-platform table would move the
11
- * truncation point from one machine to the next. The ceiling governs pipes: a terminal offers no such
12
- * guarantee at any size.
8
+ * POSIX guarantees that a write at or below `PIPE_BUF` arrives in a pipe whole, and 512 is the smallest bound that
9
+ * the standard permits, so one write of a line this size cannot be interleaved by a concurrent scope under
10
+ * `pnpm --recursive`. Node does not have an API that reports the platform's own bound, and a per-platform table
11
+ * would move the truncation point from one machine to the next. The ceiling applies to pipes: A terminal does not
12
+ * offer that guarantee at any size.
13
13
  */
14
14
  export declare const VERDICT_LINE_LIMIT_BYTES = 512;
15
15
  /**
16
- * Why a command ran nothing, which the `no-op` outcome carries and `--json` serializes.
16
+ * Why a command ran nothing, which the `no-op` outcome includes and `--json` serializes.
17
17
  *
18
- * `empty-workspace` and `empty-override` both leave a chain with no step in it, so the reason is what tells
19
- * a command emptied by the workspace apart from one emptied by an override.
18
+ * `empty-workspace` and `empty-override` both leave a chain without any step in it, so the reason tells a command
19
+ * emptied by the workspace apart from one emptied by an override.
20
20
  */
21
21
  export type NoOpReason = 'empty-override' | 'empty-workspace' | 'noop-override';
22
22
  /**
23
- * What a command nmr ran came to, holding the facts a reporting line is rendered from rather than the line
24
- * itself, so a machine-readable rendering spends the same record a human-readable one does.
23
+ * The result of a command that nmr ran. It contains the facts from which a reporting line is rendered rather than
24
+ * the line itself, which lets a machine-readable rendering use the same record as a human-readable one.
25
25
  *
26
- * A recalled pass carries its saving as a duration and not as a decision about whether to mention it: whether
27
- * one is worth naming belongs to rendering, and a consumer bypassing the renderer inherits neither the
28
- * threshold nor an obligation to restate it.
26
+ * A recalled pass records its saving as a duration and not as a decision about whether to mention it: Whether
27
+ * one is worth naming belongs to rendering, and a consumer bypassing the renderer inherits neither the threshold
28
+ * nor an obligation to restate it.
29
29
  */
30
30
  export type Verdict = {
31
31
  command: string;
32
32
  scope: string;
33
33
  } & VerdictOutcome;
34
34
  /**
35
- * How a command ended, together with the facts that ending carries and no other does, and the trailing detail
36
- * a line reserves room for.
35
+ * How a command ended, together with the facts specific to that ending, and the trailing detail for which a line
36
+ * reserves room.
37
37
  *
38
- * A recalled pass carries the excerpts it replays rather than a composed detail string, so the marker naming
39
- * them a recording, and the ceiling they are held to, stay with the module that owns the line's grammar.
38
+ * A recalled pass contains the excerpts that it replays rather than a composed detail string, so that the marker
39
+ * naming them a recording, and the ceiling to which they are held, stay with the module that owns the line's
40
+ * grammar.
40
41
  */
41
42
  export type VerdictOutcome = {
42
43
  detail?: string;
@@ -57,29 +58,28 @@ export type VerdictOutcome = {
57
58
  reason: NoOpReason;
58
59
  });
59
60
  /**
60
- * Renders a verdict as the line nmr reports it on, without the newline that terminates it.
61
+ * Renders a verdict as the line on which nmr reports it, without the newline that terminates it.
61
62
  *
62
- * The line ends without terminal punctuation and reserves its tail for `detail`, so a later change appends to
63
- * the grammar rather than rewriting it. A detail carrying nothing but line breaks takes its whole clause with
64
- * it, rather than leaving a separator pointing at nothing.
63
+ * The line ends without terminal punctuation and reserves its tail for `detail`, so that a later change appends to
64
+ * the grammar rather than rewriting it. When a detail contains nothing but line breaks, the line omits the detail's
65
+ * whole clause rather than leaving a separator pointing at nothing.
65
66
  *
66
- * The marker takes no padding column: every plain marker a verdict reaches for is four characters, so the
67
- * lines align by construction. `formatStatusLine` pads to a column that `BLOCK` widens, and no verdict is one.
67
+ * The marker does not take a padding column. Because every plain marker that a verdict uses is four characters,
68
+ * the lines align by construction. `formatStatusLine` pads to a column that `BLOCK` widens, and a verdict is never
69
+ * one.
68
70
  */
69
71
  export declare function renderVerdict(verdict: Verdict, style: OutputStyle): string;
70
72
  /**
71
- * Renders a verdict as the JSON object a machine consumer reads, without the newline that terminates it.
73
+ * Renders a verdict as the JSON object that a machine consumer reads, without the newline that terminates it.
72
74
  *
73
- * Held to the ceiling the prose line is held to, so one write still reaches a pipe whole where concurrent
74
- * scopes share a descriptor. Cuts land inside the record's text rather than across its structure, which is
75
- * what leaves the line parseable, and a record is fitted by rungs, each shedding what a reader can better
76
- * spare than the rung below it. What the ceiling costs is [documented](../docs/reporting.md#reporting-for-a-machine)
77
- * in the same order.
75
+ * Held to the same ceiling as the prose line, so that one write still arrives in a pipe whole when concurrent
76
+ * scopes share a descriptor. It cuts inside the record's text rather than across its structure, which leaves the
77
+ * line parseable, and fits a record by rungs, each shedding what a reader can better spare than the rung below it.
78
+ * Each rung is [documented](../docs/reporting.md#reporting-for-a-machine) in the same order.
78
79
  */
79
80
  export declare function serializeVerdict(verdict: Verdict): string;
80
81
  /**
81
- * Writes a verdict to a stream as a single write, which is what holds a line together when concurrent scopes
82
- * share one descriptor. Both renderings spend the one record, so neither can come to report what the other
83
- * does not.
82
+ * Writes a verdict to a stream as a single write, which keeps a line intact when concurrent scopes share one
83
+ * descriptor. Both renderings use the one record, so neither can come to report what the other does not.
84
84
  */
85
85
  export declare function writeVerdict(verdict: Verdict, stream: Writable, format: ReportFormat, style: OutputStyle): void;
@@ -52,7 +52,7 @@ function describeNoOpReason(reason) {
52
52
  case 'empty-override':
53
53
  return 'the override is empty';
54
54
  case 'empty-workspace':
55
- return 'the workspace declares no package';
55
+ return 'the workspace does not declare any package';
56
56
  case 'noop-override':
57
57
  return 'the override is a no-op';
58
58
  default: {