no-mistakes 0.15.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -87,5 +87,6 @@ npx no-mistakes rust-no-inline-tests crates/*/src
87
87
  npx no-mistakes rust-max-lines-per-file crates/*/src crates/*/tests
88
88
  ```
89
89
 
90
- See the full documentation in [docs/](../../docs/README.md) and the
91
- [CLI reference](../../docs/cli-reference.md).
90
+ See the full documentation in [docs/](../../docs/README.md), the
91
+ [CLI command index](../../docs/cli/README.md), and the
92
+ [Node/N-API guide](../../docs/node-api.md).
package/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import type {
2
2
  CheckReport,
3
+ AnalyzeProjectOptions,
4
+ AnalyzeProjectResult,
3
5
  DependencyResult,
4
6
  FetchesOptions,
5
7
  GraphEdge,
@@ -27,6 +29,7 @@ export * from "./types";
27
29
  export function dependencies(options: TraverseOptions): Promise<DependencyResult>;
28
30
  export function dependents(options: TraverseOptions): Promise<DependencyResult>;
29
31
  export function related(options: TraverseOptions): Promise<DependencyResult>;
32
+ export function analyzeProject(options: AnalyzeProjectOptions): Promise<AnalyzeProjectResult>;
30
33
  export function symbols(options: SymbolsOptions): Promise<SymbolsResult>;
31
34
  export function fetches(options?: FetchesOptions): Promise<unknown>;
32
35
  export function check(options?: ProjectOptions): Promise<CheckReport>;
package/index.js CHANGED
@@ -18,6 +18,10 @@ async function related(options) {
18
18
  return callJson(native.relatedJson, options);
19
19
  }
20
20
 
21
+ async function analyzeProject(options) {
22
+ return callJson(native.analyzeProjectJson, options);
23
+ }
24
+
21
25
  async function symbols(options) {
22
26
  return callJson(native.symbolsJson, options);
23
27
  }
@@ -115,6 +119,7 @@ async function version() {
115
119
  }
116
120
 
117
121
  module.exports = {
122
+ analyzeProject,
118
123
  check,
119
124
  dependencies,
120
125
  dependents,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "no-mistakes",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "description": "Static codebase analysis tools for TS/JS dependencies, dependents, and symbols",
5
5
  "license": "MIT",
6
6
  "repository": {
package/report-types.d.ts CHANGED
@@ -8,7 +8,6 @@ export interface PlaywrightOptions {
8
8
  allowSkippedTests?: boolean;
9
9
  assertUniqueTestIds?: boolean;
10
10
  assertUniqueHtmlIds?: boolean;
11
- assertUniqueSelectors?: boolean;
12
11
  }
13
12
 
14
13
  export interface PlaywrightRelatedOptions extends PlaywrightOptions {
package/test-types.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import type { SymbolEntrypoint } from "./traversal-types";
2
+
1
3
  export interface TestsPlanOptions {
2
4
  framework?: "vitest" | "playwright";
3
5
  root?: string;
@@ -9,8 +11,10 @@ export interface TestsPlanOptions {
9
11
  changedFilesFile?: string;
10
12
  /** Inline unified diff content to extract changed files from. */
11
13
  diff?: string;
12
- /** file#export entrypoints to trace impact from (union of all). */
13
- entrypoints?: string[];
14
+ /** Entrypoints to trace impact from: strings may use file#export, or pass { file, symbol }. */
15
+ entrypoints?: Array<string | SymbolEntrypoint>;
16
+ /** Enables symbol fields in entrypoints and symbol-node traversal. */
17
+ includeSymbols?: boolean;
14
18
  environment?: string;
15
19
  limitPercent?: number;
16
20
  limitFiles?: number;
@@ -21,8 +25,10 @@ export interface TestsImpactOptions {
21
25
  root?: string;
22
26
  config?: string;
23
27
  tsconfig?: string;
24
- /** file#export entrypoints to trace impact from. */
25
- entrypoints: string[];
28
+ /** Entrypoints to trace impact from: strings may use file#export, or pass { file, symbol }. */
29
+ entrypoints: Array<string | SymbolEntrypoint>;
30
+ /** Enables symbol fields in entrypoints and symbol-node traversal. */
31
+ includeSymbols?: boolean;
26
32
  }
27
33
 
28
34
  export interface TestPlan {
@@ -37,6 +43,15 @@ export interface SelectedTest {
37
43
  test_file: string;
38
44
  confidence: "low" | "medium" | "high";
39
45
  reasons: ImpactReason[];
46
+ targets?: TestExecutionTarget[];
47
+ }
48
+
49
+ export interface TestExecutionTarget {
50
+ runner: "vitest" | "playwright";
51
+ config?: string | null;
52
+ project?: string | null;
53
+ base_command: string[];
54
+ runner_args: string[];
40
55
  }
41
56
 
42
57
  export interface ImpactReason {
@@ -1,3 +1,5 @@
1
+ import type { PlaywrightOptions, PlaywrightRelatedOptions } from "./report-types";
2
+
1
3
  export type Relationship =
2
4
  | "import"
3
5
  | "import-static"
@@ -18,7 +20,7 @@ export type Relationship =
18
20
  | "all";
19
21
 
20
22
  export interface TraverseOptions {
21
- files: string[];
23
+ files: Array<string | SymbolEntrypoint>;
22
24
  root?: string;
23
25
  tsconfig?: string;
24
26
  depth?: number;
@@ -26,10 +28,13 @@ export interface TraverseOptions {
26
28
  targetModules?: string[];
27
29
  tests?: string[];
28
30
  relationships?: Relationship[];
31
+ includeSymbols?: boolean;
29
32
  }
30
33
 
31
34
  export interface DependencyFile {
32
35
  path?: string;
36
+ file?: string;
37
+ symbol?: string;
33
38
  queueFile?: string;
34
39
  job?: string;
35
40
  module?: string;
@@ -37,6 +42,11 @@ export interface DependencyFile {
37
42
  via?: string[];
38
43
  }
39
44
 
45
+ export interface SymbolEntrypoint {
46
+ file: string;
47
+ symbol?: string;
48
+ }
49
+
40
50
  export interface DependencyResult {
41
51
  roots: string[];
42
52
  files: DependencyFile[];
@@ -106,8 +116,53 @@ export interface ProjectOptions {
106
116
  direction?: "deps" | "dependents" | "both";
107
117
  }
108
118
 
119
+ type BatchedProjectOptions = Omit<ProjectOptions, "root" | "tsconfig" | "config">;
120
+ type BatchedQueueRelatedOptions = BatchedProjectOptions & { files: string[] };
121
+ type BatchedServerRouteRelatedOptions = BatchedProjectOptions &
122
+ ({ files: string[] } | { roots: string[] });
123
+
109
124
  export interface FetchesOptions {
110
125
  root?: string;
111
126
  config?: string;
112
127
  targets?: string[];
113
128
  }
129
+
130
+ export type AnalyzeProjectReportRequest =
131
+ | ({ type: "dependencies" | "dependents" | "related"; id?: string } & Omit<
132
+ TraverseOptions,
133
+ "root" | "tsconfig"
134
+ >)
135
+ | ({ type: "symbols"; id?: string } & SymbolsOptions)
136
+ | ({ type: "queues" | "queueEdges" | "queueCheck"; id?: string } & BatchedProjectOptions)
137
+ | ({ type: "queueRelated"; id?: string } & BatchedQueueRelatedOptions)
138
+ | ({
139
+ type: "serverRoutes" | "serverRouteList" | "serverRouteEdges";
140
+ id?: string;
141
+ } & BatchedProjectOptions)
142
+ | ({ type: "serverRouteRelated"; id?: string } & BatchedServerRouteRelatedOptions)
143
+ | ({ type: "reactAnalyze" | "reactCheck"; id?: string } & Pick<
144
+ ProjectOptions,
145
+ "targets" | "depth" | "assertNoFetch"
146
+ >)
147
+ | ({
148
+ type: "playwrightCheck" | "playwrightEdges" | "playwrightTests";
149
+ id?: string;
150
+ } & Omit<PlaywrightOptions, "root" | "config">)
151
+ | ({ type: "playwrightRelated"; id?: string } & Omit<PlaywrightRelatedOptions, "root" | "config">)
152
+ | { type: "check"; id?: string };
153
+
154
+ export interface AnalyzeProjectOptions {
155
+ root?: string;
156
+ tsconfig?: string;
157
+ config?: string;
158
+ filters?: string[];
159
+ reports: AnalyzeProjectReportRequest[];
160
+ }
161
+
162
+ export interface AnalyzeProjectResult {
163
+ reports: Array<{
164
+ id?: string;
165
+ type: AnalyzeProjectReportRequest["type"];
166
+ result: unknown;
167
+ }>;
168
+ }