no-mistakes 0.9.0 → 0.10.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
@@ -17,7 +17,11 @@ Programmatic Node usage loads the same Rust analysis through N-API:
17
17
  const {
18
18
  dependencies,
19
19
  dependents,
20
+ check,
21
+ fetches,
22
+ playwrightRelated,
20
23
  symbols,
24
+ testsPlan,
21
25
  queueEdges,
22
26
  queueRelated,
23
27
  queueCheck,
@@ -44,6 +48,19 @@ const {
44
48
  files: ["src/utils.mts"],
45
49
  include: "both",
46
50
  });
51
+ const plan = await testsPlan({
52
+ root: process.cwd(),
53
+ framework: "vitest",
54
+ changedFiles: ["src/utils.mts"],
55
+ });
56
+ const projectCheck = await check({
57
+ root: process.cwd(),
58
+ tsconfig: "tsconfig.json",
59
+ });
60
+ const coveredByPlaywright = await playwrightRelated({
61
+ root: process.cwd(),
62
+ files: ["web/app/users/page.tsx"],
63
+ });
47
64
 
48
65
  const queueHops = await queueRelated({
49
66
  root: process.cwd(),
package/index.d.ts CHANGED
@@ -1,164 +1,43 @@
1
- export type Relationship =
2
- | "import"
3
- | "import-static"
4
- | "import-dynamic"
5
- | "import-type"
6
- | "import-require"
7
- | "workspace"
8
- | "package"
9
- | "test"
10
- | "route"
11
- | "queue"
12
- | "md"
13
- | "ci"
14
- | "http"
15
- | "process"
16
- | "asset"
17
- | "react"
18
- | "all";
19
-
20
- export interface TraverseOptions {
21
- files: string[];
22
- root?: string;
23
- tsconfig?: string;
24
- depth?: number;
25
- filters?: string[];
26
- targetModules?: string[];
27
- tests?: string[];
28
- relationships?: Relationship[];
29
- }
30
-
31
- export interface DependencyFile {
32
- path?: string;
33
- queueFile?: string;
34
- job?: string;
35
- module?: string;
36
- depth: number;
37
- via?: string[];
38
- }
39
-
40
- export interface DependencyResult {
41
- roots: string[];
42
- files: DependencyFile[];
43
- }
44
-
45
- export type ExportKind =
46
- | "function"
47
- | "class"
48
- | "const"
49
- | "let"
50
- | "var"
51
- | "type"
52
- | "interface"
53
- | "enum"
54
- | "default"
55
- | "re-export";
56
-
57
- export interface SymbolsOptions {
58
- files: string[];
59
- root?: string;
60
- tsconfig?: string;
61
- kinds?: ExportKind[];
62
- include?: "exports" | "imports" | "both";
63
- }
64
-
65
- export interface SymbolExport {
66
- name: string;
67
- kind: string;
68
- line: number;
69
- reExport?: {
70
- source: string;
71
- imported: string;
72
- resolved?: string;
73
- };
74
- }
75
-
76
- export interface SymbolImport {
77
- source: string;
78
- imported: string;
79
- local: string;
80
- line: number;
81
- typeOnly: boolean;
82
- resolved?: string;
83
- }
84
-
85
- export interface SymbolFile {
86
- path: string;
87
- exports?: SymbolExport[];
88
- imports?: SymbolImport[];
89
- }
90
-
91
- export interface SymbolsResult {
92
- roots: string[];
93
- files: SymbolFile[];
94
- }
95
-
96
- export interface ProjectOptions {
97
- root?: string;
98
- tsconfig?: string;
99
- config?: string;
100
- filters?: string[];
101
- targets?: string[];
102
- files?: string[];
103
- roots?: string[];
104
- depth?: number;
105
- assertNoFetch?: boolean;
106
- direction?: "deps" | "dependents" | "both";
107
- }
108
-
109
- export interface QueueReport {
110
- producers: unknown[];
111
- workers: unknown[];
112
- jobs: unknown[];
113
- edges: unknown[];
114
- diagnostics: unknown[];
115
- check: unknown[];
116
- }
117
-
118
- export interface GraphEdge {
119
- from: string;
120
- to: string;
121
- kind: string;
122
- }
123
-
124
- export interface ServerRoutesReport {
125
- summary: {
126
- totalRoutes: number;
127
- totalFiles: number;
128
- dynamicRoutes: number;
129
- };
130
- routes: unknown[];
131
- edges: unknown[];
132
- diagnostics: unknown[];
133
- }
134
-
135
- export interface ReactComponentFacts {
136
- name: string;
137
- file: string;
138
- environment: "server" | "client" | "shared" | "unknown";
139
- hasState: boolean;
140
- hasProps: boolean;
141
- passesProps: boolean;
142
- usesMemo: boolean;
143
- usesContextProvider: boolean;
144
- usesSuspense: boolean;
145
- fetches: unknown[];
146
- dependencies: string[];
147
- children: unknown[];
148
- inheritedFromChildren?: unknown;
149
- }
150
-
151
- export interface ReactViolation {
152
- component: string;
153
- file: string;
154
- rule: string;
155
- detail?: string;
156
- }
1
+ import type {
2
+ CheckReport,
3
+ DependencyResult,
4
+ FetchesOptions,
5
+ GraphEdge,
6
+ PlaywrightOptions,
7
+ PlaywrightRelatedOptions,
8
+ ProjectOptions,
9
+ QueueReport,
10
+ ReactComponentFacts,
11
+ ReactViolation,
12
+ ServerRoutesReport,
13
+ SymbolsOptions,
14
+ SymbolsResult,
15
+ TestGraph,
16
+ TestPlan,
17
+ TestsPlanDocumentOptions,
18
+ TestsPlanOptions,
19
+ TestsWhyOptions,
20
+ TraverseOptions,
21
+ WhyStep,
22
+ } from "./types";
23
+
24
+ export * from "./types";
157
25
 
158
26
  export function dependencies(options: TraverseOptions): Promise<DependencyResult>;
159
27
  export function dependents(options: TraverseOptions): Promise<DependencyResult>;
160
28
  export function related(options: TraverseOptions): Promise<DependencyResult>;
161
29
  export function symbols(options: SymbolsOptions): Promise<SymbolsResult>;
30
+ export function fetches(options?: FetchesOptions): Promise<unknown>;
31
+ export function check(options?: ProjectOptions): Promise<CheckReport>;
32
+ export function testsPlan(options: TestsPlanOptions): Promise<TestPlan>;
33
+ export function testsWhy(options: TestsWhyOptions): Promise<Record<string, WhyStep[]>>;
34
+ export function testsComment(options: TestsPlanDocumentOptions): Promise<string>;
35
+ export function testsGraph(options: TestsPlanDocumentOptions): Promise<TestGraph>;
36
+ export function testsGraphMermaid(options: TestsPlanDocumentOptions): Promise<string>;
37
+ export function playwrightCheck(options?: PlaywrightOptions): Promise<unknown>;
38
+ export function playwrightEdges(options?: PlaywrightOptions): Promise<unknown>;
39
+ export function playwrightRelated(options: PlaywrightRelatedOptions): Promise<unknown>;
40
+ export function playwrightTests(options?: PlaywrightOptions): Promise<unknown>;
162
41
  export function queues(options?: ProjectOptions): Promise<QueueReport>;
163
42
  export function queueEdges(options?: ProjectOptions): Promise<GraphEdge[]>;
164
43
  export function queueRelated(options: ProjectOptions): Promise<GraphEdge[]>;
package/index.js CHANGED
@@ -22,6 +22,50 @@ async function symbols(options) {
22
22
  return callJson(native.symbolsJson, options);
23
23
  }
24
24
 
25
+ async function fetches(options) {
26
+ return callJson(native.fetchesJson, options);
27
+ }
28
+
29
+ async function check(options) {
30
+ return callJson(native.checkJson, options);
31
+ }
32
+
33
+ async function testsPlan(options) {
34
+ return callJson(native.testsPlanJson, options);
35
+ }
36
+
37
+ async function testsWhy(options) {
38
+ return callJson(native.testsWhyJson, options);
39
+ }
40
+
41
+ async function testsComment(options) {
42
+ return native.testsCommentMarkdown(JSON.stringify(options || {}));
43
+ }
44
+
45
+ async function testsGraph(options) {
46
+ return callJson(native.testsGraphJson, options);
47
+ }
48
+
49
+ async function testsGraphMermaid(options) {
50
+ return native.testsGraphMermaid(JSON.stringify(options || {}));
51
+ }
52
+
53
+ async function playwrightCheck(options) {
54
+ return callJson(native.playwrightCheckJson, options);
55
+ }
56
+
57
+ async function playwrightEdges(options) {
58
+ return callJson(native.playwrightEdgesJson, options);
59
+ }
60
+
61
+ async function playwrightRelated(options) {
62
+ return callJson(native.playwrightRelatedJson, options);
63
+ }
64
+
65
+ async function playwrightTests(options) {
66
+ return callJson(native.playwrightTestsJson, options);
67
+ }
68
+
25
69
  async function queues(options) {
26
70
  return callJson(native.queuesJson, options);
27
71
  }
@@ -62,13 +106,19 @@ async function reactCheck(options) {
62
106
  return callJson(native.reactCheckJson, options);
63
107
  }
64
108
 
65
- function version() {
109
+ async function version() {
66
110
  return native.version();
67
111
  }
68
112
 
69
113
  module.exports = {
114
+ check,
70
115
  dependencies,
71
116
  dependents,
117
+ fetches,
118
+ playwrightCheck,
119
+ playwrightEdges,
120
+ playwrightRelated,
121
+ playwrightTests,
72
122
  queues,
73
123
  queueCheck,
74
124
  queueEdges,
@@ -81,5 +131,10 @@ module.exports = {
81
131
  serverRouteRelated,
82
132
  serverRoutes,
83
133
  symbols,
134
+ testsComment,
135
+ testsGraph,
136
+ testsGraphMermaid,
137
+ testsPlan,
138
+ testsWhy,
84
139
  version,
85
140
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "no-mistakes",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "Static codebase analysis tools for TS/JS dependencies, dependents, and symbols",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -13,7 +13,7 @@
13
13
  },
14
14
  "files": [
15
15
  "bin/",
16
- "index.d.ts",
16
+ "*.d.ts",
17
17
  "index.js",
18
18
  "scripts/install.js",
19
19
  "scripts/install/",
@@ -0,0 +1,73 @@
1
+ export interface PlaywrightOptions {
2
+ root?: string;
3
+ config?: string;
4
+ playwrightConfig?: string[];
5
+ project?: string;
6
+ files?: string[];
7
+ assertConditionalTests?: boolean;
8
+ allowSkippedTests?: boolean;
9
+ assertUniqueTestIds?: boolean;
10
+ assertUniqueHtmlIds?: boolean;
11
+ assertUniqueSelectors?: boolean;
12
+ }
13
+
14
+ export interface PlaywrightRelatedOptions extends PlaywrightOptions {
15
+ files: string[];
16
+ }
17
+
18
+ export interface CheckReport {
19
+ react: ReactViolation[];
20
+ queues: unknown[];
21
+ rules: unknown[];
22
+ integration: unknown[];
23
+ codebase: unknown[];
24
+ }
25
+
26
+ export interface QueueReport {
27
+ producers: unknown[];
28
+ workers: unknown[];
29
+ jobs: unknown[];
30
+ edges: unknown[];
31
+ diagnostics: unknown[];
32
+ check: unknown[];
33
+ }
34
+
35
+ export interface GraphEdge {
36
+ from: string;
37
+ to: string;
38
+ kind: string;
39
+ }
40
+
41
+ export interface ServerRoutesReport {
42
+ summary: {
43
+ totalRoutes: number;
44
+ totalFiles: number;
45
+ dynamicRoutes: number;
46
+ };
47
+ routes: unknown[];
48
+ edges: unknown[];
49
+ diagnostics: unknown[];
50
+ }
51
+
52
+ export interface ReactComponentFacts {
53
+ name: string;
54
+ file: string;
55
+ environment: "server" | "client" | "shared" | "unknown";
56
+ hasState: boolean;
57
+ hasProps: boolean;
58
+ passesProps: boolean;
59
+ usesMemo: boolean;
60
+ usesContextProvider: boolean;
61
+ usesSuspense: boolean;
62
+ fetches: unknown[];
63
+ dependencies: string[];
64
+ children: unknown[];
65
+ inheritedFromChildren?: unknown;
66
+ }
67
+
68
+ export interface ReactViolation {
69
+ component: string;
70
+ file: string;
71
+ rule: string;
72
+ detail?: string;
73
+ }
@@ -0,0 +1,71 @@
1
+ export interface TestsPlanOptions {
2
+ framework?: "vitest" | "playwright";
3
+ root?: string;
4
+ config?: string;
5
+ tsconfig?: string;
6
+ base?: string;
7
+ head?: string;
8
+ changedFiles?: string[];
9
+ changedFilesFile?: string;
10
+ environment?: string;
11
+ limitPercent?: number;
12
+ limitFiles?: number;
13
+ globalConfigFallback?: boolean;
14
+ }
15
+
16
+ export interface TestPlan {
17
+ selected_tests: SelectedTest[];
18
+ groups?: TestPlanGroup[];
19
+ warnings: TestPlanWarning[];
20
+ fallback_triggered: boolean;
21
+ fallback_reason?: string | null;
22
+ }
23
+
24
+ export interface SelectedTest {
25
+ test_file: string;
26
+ confidence: "low" | "medium" | "high";
27
+ reasons: ImpactReason[];
28
+ }
29
+
30
+ export interface ImpactReason {
31
+ changed_file: string;
32
+ path: string[];
33
+ via: string[];
34
+ }
35
+
36
+ export interface TestPlanGroup {
37
+ type: string;
38
+ selected: string[];
39
+ remaining: number;
40
+ limit?: number | null;
41
+ }
42
+
43
+ export interface TestPlanWarning {
44
+ type: string;
45
+ message: string;
46
+ file: string;
47
+ }
48
+
49
+ export interface TestsWhyOptions {
50
+ root?: string;
51
+ config?: string;
52
+ tsconfig?: string;
53
+ test: string;
54
+ changed?: string;
55
+ plan?: string;
56
+ }
57
+
58
+ export interface WhyStep {
59
+ node: string;
60
+ via?: string | null;
61
+ }
62
+
63
+ export interface TestsPlanDocumentOptions {
64
+ plan?: string;
65
+ planJson?: TestPlan | string;
66
+ }
67
+
68
+ export interface TestGraph {
69
+ nodes: Array<{ name: string; type: "changed" | "test" | "intermediate" }>;
70
+ edges: Array<{ from: string; to: string; via: string }>;
71
+ }
@@ -0,0 +1,113 @@
1
+ export type Relationship =
2
+ | "import"
3
+ | "import-static"
4
+ | "import-dynamic"
5
+ | "import-type"
6
+ | "import-require"
7
+ | "workspace"
8
+ | "package"
9
+ | "test"
10
+ | "route"
11
+ | "queue"
12
+ | "md"
13
+ | "ci"
14
+ | "http"
15
+ | "process"
16
+ | "asset"
17
+ | "react"
18
+ | "all";
19
+
20
+ export interface TraverseOptions {
21
+ files: string[];
22
+ root?: string;
23
+ tsconfig?: string;
24
+ depth?: number;
25
+ filters?: string[];
26
+ targetModules?: string[];
27
+ tests?: string[];
28
+ relationships?: Relationship[];
29
+ }
30
+
31
+ export interface DependencyFile {
32
+ path?: string;
33
+ queueFile?: string;
34
+ job?: string;
35
+ module?: string;
36
+ depth: number;
37
+ via?: string[];
38
+ }
39
+
40
+ export interface DependencyResult {
41
+ roots: string[];
42
+ files: DependencyFile[];
43
+ }
44
+
45
+ export type ExportKind =
46
+ | "function"
47
+ | "class"
48
+ | "const"
49
+ | "let"
50
+ | "var"
51
+ | "type"
52
+ | "interface"
53
+ | "enum"
54
+ | "default"
55
+ | "re-export";
56
+
57
+ export interface SymbolsOptions {
58
+ files: string[];
59
+ root?: string;
60
+ tsconfig?: string;
61
+ kinds?: ExportKind[];
62
+ include?: "exports" | "imports" | "both";
63
+ }
64
+
65
+ export interface SymbolExport {
66
+ name: string;
67
+ kind: string;
68
+ line: number;
69
+ reExport?: {
70
+ source: string;
71
+ imported: string;
72
+ resolved?: string;
73
+ };
74
+ }
75
+
76
+ export interface SymbolImport {
77
+ source: string;
78
+ imported: string;
79
+ local: string;
80
+ line: number;
81
+ typeOnly: boolean;
82
+ resolved?: string;
83
+ }
84
+
85
+ export interface SymbolFile {
86
+ path: string;
87
+ exports?: SymbolExport[];
88
+ imports?: SymbolImport[];
89
+ }
90
+
91
+ export interface SymbolsResult {
92
+ roots: string[];
93
+ files: SymbolFile[];
94
+ }
95
+
96
+ export interface ProjectOptions {
97
+ root?: string;
98
+ tsconfig?: string;
99
+ config?: string;
100
+ filters?: string[];
101
+ targets?: string[];
102
+ files?: string[];
103
+ roots?: string[];
104
+ depth?: number;
105
+ assertNoFetch?: boolean;
106
+ direction?: "deps" | "dependents" | "both";
107
+ }
108
+
109
+ export interface FetchesOptions {
110
+ root?: string;
111
+ config?: string;
112
+ targets?: string[];
113
+ }
package/types.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export * from "./traversal-types";
2
+ export * from "./test-types";
3
+ export * from "./report-types";