no-mistakes 0.23.1 → 0.25.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
@@ -56,7 +56,7 @@ const {
56
56
  });
57
57
  const plan = await testsPlan({
58
58
  root: process.cwd(),
59
- framework: "vitest",
59
+ framework: "vitest", // also supports "playwright" and "swift"
60
60
  changedFiles: ["src/utils.mts"],
61
61
  });
62
62
  const projectCheck = await check({
package/ci-types.d.ts ADDED
@@ -0,0 +1,107 @@
1
+ // Types for the `ci` and `impacted-checks` commands. Option interfaces use
2
+ // camelCase (deserialized with rename_all = "camelCase"); report interfaces use
3
+ // snake_case to match the serde-serialized output.
4
+
5
+ export interface CiImpactOptions {
6
+ root?: string;
7
+ config?: string;
8
+ /** Changed file paths (relative to root or absolute). */
9
+ files: string[];
10
+ }
11
+
12
+ export interface CiEnvOptions {
13
+ root?: string;
14
+ config?: string;
15
+ /** Environment variable name (case-sensitive). */
16
+ var: string;
17
+ }
18
+
19
+ export interface ImpactedChecksOptions {
20
+ root?: string;
21
+ config?: string;
22
+ tsconfig?: string;
23
+ base?: string;
24
+ head?: string;
25
+ changedFiles?: string[];
26
+ changedFilesFile?: string;
27
+ diff?: string;
28
+ }
29
+
30
+ export type TriggerMatch = "matched" | "always" | "not-matched" | "no-path-events";
31
+ export type PermissionLevel = "read" | "write" | "none";
32
+ export type PermissionSource = "job" | "workflow" | "default";
33
+
34
+ export interface ResolvedPermissions {
35
+ source: PermissionSource;
36
+ scopes: Record<string, PermissionLevel>;
37
+ assumed_default: boolean;
38
+ }
39
+
40
+ export interface CiWarning {
41
+ path: string;
42
+ message: string;
43
+ }
44
+
45
+ export interface MatchedFilter {
46
+ event: string;
47
+ pattern: string;
48
+ }
49
+
50
+ export interface ImpactedJob {
51
+ id: string;
52
+ name?: string;
53
+ uses?: string;
54
+ permissions: ResolvedPermissions;
55
+ }
56
+
57
+ export interface ImpactedWorkflow {
58
+ path: string;
59
+ name?: string;
60
+ trigger: TriggerMatch;
61
+ reusable: boolean;
62
+ matched_filters: MatchedFilter[];
63
+ jobs: ImpactedJob[];
64
+ }
65
+
66
+ export interface CiImpactReport {
67
+ changed_files: string[];
68
+ workflows: ImpactedWorkflow[];
69
+ warnings: CiWarning[];
70
+ }
71
+
72
+ export type EnvLocationKind = "definition" | "reference";
73
+ export type EnvScope = "workflow" | "job" | "step";
74
+
75
+ export interface CiEnvLocation {
76
+ kind: EnvLocationKind;
77
+ scope: EnvScope;
78
+ job?: string;
79
+ value?: string;
80
+ }
81
+
82
+ export interface CiEnvFile {
83
+ path: string;
84
+ locations: CiEnvLocation[];
85
+ }
86
+
87
+ export interface CiEnvReport {
88
+ variable: string;
89
+ files: CiEnvFile[];
90
+ warnings: CiWarning[];
91
+ }
92
+
93
+ export type CheckKind = "test" | "generic";
94
+
95
+ export interface CheckCommand {
96
+ name: string;
97
+ kind: CheckKind;
98
+ command: string[];
99
+ files?: string[];
100
+ }
101
+
102
+ export interface ImpactedChecksReport {
103
+ changed_files: string[];
104
+ checks: CheckCommand[];
105
+ warnings: Array<{ type: string; message: string; file: string }>;
106
+ fallback_triggered: boolean;
107
+ }
package/index.d.ts CHANGED
@@ -2,11 +2,37 @@ import type {
2
2
  CheckReport,
3
3
  AnalyzeProjectOptions,
4
4
  AnalyzeProjectResult,
5
+ CiEnvOptions,
6
+ CiEnvReport,
7
+ CiImpactOptions,
8
+ CiImpactReport,
9
+ CallSitesOptions,
10
+ CallSitesResult,
11
+ DataPwOptions,
12
+ DataPwReport,
13
+ DeadExportsOptions,
14
+ DeadExportsResult,
15
+ EffectsOptions,
16
+ EffectsReport,
17
+ RscCallersOptions,
18
+ RscCallersReport,
19
+ RegistryExtensionOptions,
20
+ RegistryExtensionReport,
5
21
  DependencyResult,
22
+ ExportsOfOptions,
23
+ ExportsOfResult,
6
24
  FetchesOptions,
25
+ ImpactedChecksOptions,
26
+ ImpactedChecksReport,
27
+ ImportersOptions,
28
+ ImportersResult,
29
+ ResolveCheckOptions,
30
+ ResolveCheckResult,
7
31
  GraphEdge,
32
+ InfraOptions,
8
33
  LockfileDiffEntry,
9
34
  LockfileDiffOptions,
35
+ ModuleOutputsResult,
10
36
  PlaywrightOptions,
11
37
  PlaywrightRelatedOptions,
12
38
  ProjectOptions,
@@ -14,8 +40,13 @@ import type {
14
40
  ReactComponentFacts,
15
41
  ReactUsagesReport,
16
42
  ReactViolation,
43
+ ResourceRefRow,
17
44
  ServerRoutesReport,
18
45
  SignatureImpactResult,
46
+ SwiftImporterRow,
47
+ SwiftOptions,
48
+ SwiftTestTargetRow,
49
+ TestForRow,
19
50
  SymbolsListOptions,
20
51
  SymbolsOptions,
21
52
  SymbolsResult,
@@ -39,6 +70,11 @@ export function analyzeProject(options: AnalyzeProjectOptions): Promise<AnalyzeP
39
70
  export function symbols(options: SymbolsSignatureImpactOptions): Promise<SignatureImpactResult>;
40
71
  export function symbols(options: SymbolsListOptions): Promise<SymbolsResult>;
41
72
  export function symbols(options: SymbolsOptions): Promise<SymbolsResult | SignatureImpactResult>;
73
+ export function importers(options: ImportersOptions): Promise<ImportersResult>;
74
+ export function exportsOf(options: ExportsOfOptions): Promise<ExportsOfResult>;
75
+ export function deadExports(options: DeadExportsOptions): Promise<DeadExportsResult>;
76
+ export function callSites(options: CallSitesOptions): Promise<CallSitesResult>;
77
+ export function resolveCheck(options: ResolveCheckOptions): Promise<ResolveCheckResult>;
42
78
  export function fetches(options?: FetchesOptions): Promise<unknown>;
43
79
  export function check(options?: ProjectOptions): Promise<CheckReport>;
44
80
  export function testsPlan(options: TestsPlanOptions): Promise<TestPlan>;
@@ -65,4 +101,26 @@ export function reactUsages(
65
101
  options: ProjectOptions & { target: string },
66
102
  ): Promise<ReactUsagesReport>;
67
103
  export function lockfileDiff(options: LockfileDiffOptions): Promise<LockfileDiffEntry[]>;
104
+ export function ciImpact(options: CiImpactOptions): Promise<CiImpactReport>;
105
+ export function ciEnv(options: CiEnvOptions): Promise<CiEnvReport>;
106
+ export function impactedChecks(options: ImpactedChecksOptions): Promise<ImpactedChecksReport>;
107
+ export function dataPw(options: DataPwOptions): Promise<DataPwReport>;
108
+ export function effects(options: EffectsOptions): Promise<EffectsReport>;
109
+ export function rscCallers(options: RscCallersOptions): Promise<RscCallersReport>;
110
+ export function registryExtension(
111
+ options: RegistryExtensionOptions,
112
+ ): Promise<RegistryExtensionReport>;
113
+ export function infraResourceRefs(
114
+ options: InfraOptions & { address: string },
115
+ ): Promise<ResourceRefRow[]>;
116
+ export function infraOutputs(
117
+ options: InfraOptions & { moduleDir: string },
118
+ ): Promise<ModuleOutputsResult>;
119
+ export function infraTestFor(options: InfraOptions & { tfFile: string }): Promise<TestForRow[]>;
120
+ export function swiftImporters(
121
+ options: SwiftOptions & { file: string },
122
+ ): Promise<SwiftImporterRow[]>;
123
+ export function swiftTestTargets(
124
+ options: SwiftOptions & { file: string },
125
+ ): Promise<SwiftTestTargetRow[]>;
68
126
  export function version(): Promise<string>;
package/index.js CHANGED
@@ -26,6 +26,26 @@ async function symbols(options) {
26
26
  return callJson(native.symbolsJson, options);
27
27
  }
28
28
 
29
+ async function importers(options) {
30
+ return callJson(native.importersJson, options);
31
+ }
32
+
33
+ async function exportsOf(options) {
34
+ return callJson(native.exportsOfJson, options);
35
+ }
36
+
37
+ async function deadExports(options) {
38
+ return callJson(native.deadExportsJson, options);
39
+ }
40
+
41
+ async function callSites(options) {
42
+ return callJson(native.callSitesJson, options);
43
+ }
44
+
45
+ async function resolveCheck(options) {
46
+ return callJson(native.resolveCheckJson, options);
47
+ }
48
+
29
49
  async function fetches(options) {
30
50
  return callJson(native.fetchesJson, options);
31
51
  }
@@ -118,20 +138,80 @@ async function reactUsages(options) {
118
138
  return callJson(native.reactUsagesJson, options);
119
139
  }
120
140
 
141
+ async function dataPw(options) {
142
+ return callJson(native.dataPwJson, options);
143
+ }
144
+
145
+ async function effects(options) {
146
+ return callJson(native.effectsJson, options);
147
+ }
148
+
149
+ async function rscCallers(options) {
150
+ return callJson(native.rscCallersJson, options);
151
+ }
152
+
153
+ async function registryExtension(options) {
154
+ return callJson(native.registryExtensionJson, options);
155
+ }
156
+
121
157
  async function lockfileDiff(options) {
122
158
  return callJson(native.lockfileDiffJson, options);
123
159
  }
124
160
 
161
+ async function ciImpact(options) {
162
+ return callJson(native.ciImpactJson, options);
163
+ }
164
+
165
+ async function ciEnv(options) {
166
+ return callJson(native.ciEnvJson, options);
167
+ }
168
+
169
+ async function impactedChecks(options) {
170
+ return callJson(native.impactedChecksJson, options);
171
+ }
172
+
173
+ async function infraResourceRefs(options) {
174
+ return callJson(native.infraResourceRefsJson, options);
175
+ }
176
+
177
+ async function infraOutputs(options) {
178
+ return callJson(native.infraOutputsJson, options);
179
+ }
180
+
181
+ async function infraTestFor(options) {
182
+ return callJson(native.infraTestForJson, options);
183
+ }
184
+
185
+ async function swiftImporters(options) {
186
+ return callJson(native.swiftImportersJson, options);
187
+ }
188
+
189
+ async function swiftTestTargets(options) {
190
+ return callJson(native.swiftTestTargetsJson, options);
191
+ }
192
+
125
193
  async function version() {
126
194
  return native.version();
127
195
  }
128
196
 
129
197
  module.exports = {
130
198
  analyzeProject,
199
+ callSites,
131
200
  check,
201
+ ciEnv,
202
+ ciImpact,
203
+ dataPw,
204
+ deadExports,
132
205
  dependencies,
133
206
  dependents,
207
+ effects,
208
+ exportsOf,
134
209
  fetches,
210
+ impactedChecks,
211
+ importers,
212
+ infraOutputs,
213
+ infraResourceRefs,
214
+ infraTestFor,
135
215
  lockfileDiff,
136
216
  playwrightCheck,
137
217
  playwrightEdges,
@@ -144,11 +224,16 @@ module.exports = {
144
224
  reactAnalyze,
145
225
  reactCheck,
146
226
  reactUsages,
227
+ registryExtension,
147
228
  related,
229
+ resolveCheck,
230
+ rscCallers,
148
231
  serverRouteEdges,
149
232
  serverRouteList,
150
233
  serverRouteRelated,
151
234
  serverRoutes,
235
+ swiftImporters,
236
+ swiftTestTargets,
152
237
  symbols,
153
238
  testsComment,
154
239
  testsGraph,
@@ -0,0 +1,110 @@
1
+ // Named query modes (issue #419): data-pw, effects, rsc-callers, registry-extension.
2
+
3
+ export interface DataPwOptions {
4
+ root?: string;
5
+ config?: string;
6
+ /** The selector-attribute value to find (e.g. `search-bar`). */
7
+ value: string;
8
+ /** Attribute names to scan instead of the configured `testIds`. */
9
+ attributes?: string[];
10
+ /** Source path prefixes to scan instead of the configured `selectorRoots`. */
11
+ scan?: string[];
12
+ /** Comma-separated subset of `source,test` (default: both). */
13
+ include?: string;
14
+ }
15
+
16
+ export interface DataPwHit {
17
+ file: string;
18
+ line: number;
19
+ attribute: string;
20
+ }
21
+
22
+ export interface DataPwReport {
23
+ value: string;
24
+ attributes: string[];
25
+ /** Source-file matches. Omitted when `--include test`. */
26
+ source?: DataPwHit[];
27
+ /** Test-file matches. Omitted when `--include source`. */
28
+ test?: DataPwHit[];
29
+ }
30
+
31
+ export interface EffectsOptions {
32
+ root?: string;
33
+ tsconfig?: string;
34
+ config?: string;
35
+ /** Effect kind to resolve (a key under `effects:` in config). */
36
+ kind: string;
37
+ /** Entry file whose transitive imports are scanned. */
38
+ entry: string;
39
+ /** Restrict to one or more configured categories. */
40
+ categories?: string[];
41
+ /** Maximum traversal depth (default: unlimited). */
42
+ depth?: number;
43
+ }
44
+
45
+ export interface EffectCallSite {
46
+ file: string;
47
+ line: number;
48
+ callee: string;
49
+ category?: string;
50
+ caller?: string;
51
+ depth: number;
52
+ }
53
+
54
+ export interface EffectsReport {
55
+ kind: string;
56
+ entry: string;
57
+ callSites: EffectCallSite[];
58
+ byCategory: Record<string, number>;
59
+ }
60
+
61
+ export interface RscCallersOptions {
62
+ root?: string;
63
+ tsconfig?: string;
64
+ config?: string;
65
+ /** Component file to find RSC callers of. */
66
+ component: string;
67
+ /** Maximum traversal depth (default: unlimited). */
68
+ depth?: number;
69
+ }
70
+
71
+ export interface RscCaller {
72
+ file: string;
73
+ kind: "page" | "component";
74
+ environment: "server" | "client" | "unknown";
75
+ depth: number;
76
+ }
77
+
78
+ export interface RscCallersReport {
79
+ component: string;
80
+ callers: RscCaller[];
81
+ }
82
+
83
+ export interface RegistryExtensionOptions {
84
+ root?: string;
85
+ /** Registry file to summarize the entry pattern of. */
86
+ registryFile: string;
87
+ }
88
+
89
+ export interface RegistryEntryImport {
90
+ specifier: string;
91
+ symbol?: string;
92
+ local: string;
93
+ kind: string;
94
+ }
95
+
96
+ export interface RegistryEntry {
97
+ line: number;
98
+ import?: RegistryEntryImport;
99
+ callShape: string;
100
+ }
101
+
102
+ export interface RegistryExtensionReport {
103
+ registryFile: string;
104
+ patternKind: string;
105
+ registrant?: string;
106
+ confidence: string;
107
+ entries: RegistryEntry[];
108
+ template?: string;
109
+ notes: string[];
110
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "no-mistakes",
3
- "version": "0.23.1",
3
+ "version": "0.25.0",
4
4
  "description": "Static codebase analysis tools for TS/JS dependencies, dependents, and symbols",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -0,0 +1,116 @@
1
+ // Lightweight single-file query commands (issue #417).
2
+
3
+ export interface QueryFileOptions {
4
+ /** The TS/JS file to query (relative to `root` or absolute). */
5
+ file: string;
6
+ /** Project root. Defaults to the current working directory. */
7
+ root?: string;
8
+ /** Path to tsconfig.json for alias resolution. Searched upward if omitted. */
9
+ tsconfig?: string;
10
+ }
11
+
12
+ export interface ImportersOptions extends QueryFileOptions {
13
+ /** Also compute the transitive impacted-test set (builds the dependency graph). */
14
+ tests?: boolean;
15
+ }
16
+
17
+ export interface ImportersTestImpact {
18
+ tests: string[];
19
+ count: number;
20
+ }
21
+
22
+ export interface ImportersResult {
23
+ file: string;
24
+ directImporters: string[];
25
+ dependentsCount: number;
26
+ testImpact?: ImportersTestImpact;
27
+ }
28
+
29
+ export interface ExportsOfOptions extends QueryFileOptions {
30
+ /** Skip the reverse import scan; only list exports. */
31
+ noImporters?: boolean;
32
+ }
33
+
34
+ export interface ExportRowResult {
35
+ name: string;
36
+ kind: string;
37
+ line: number;
38
+ /** Resolved re-export target, root-relative. Only present for re-exports. */
39
+ resolved?: string;
40
+ importers: string[];
41
+ }
42
+
43
+ export interface ExportsOfResult {
44
+ file: string;
45
+ exports: ExportRowResult[];
46
+ }
47
+
48
+ export interface DeadExportsOptions extends QueryFileOptions {
49
+ /** Specific export names to check. Defaults to every export of the file. */
50
+ names?: string[];
51
+ }
52
+
53
+ export interface DeadExportResult {
54
+ name: string;
55
+ referenced: boolean;
56
+ importerCount: number;
57
+ }
58
+
59
+ export interface DeadExportsResult {
60
+ file: string;
61
+ results: DeadExportResult[];
62
+ anyDead: boolean;
63
+ }
64
+
65
+ export interface CallSitesOptions extends QueryFileOptions {
66
+ /** The exported function name to find call sites for. */
67
+ exportName: string;
68
+ }
69
+
70
+ export type ArgShape =
71
+ | "string"
72
+ | "number"
73
+ | "boolean"
74
+ | "null"
75
+ | "identifier"
76
+ | "object"
77
+ | "array"
78
+ | "arrow"
79
+ | "call"
80
+ | "spread"
81
+ | "other";
82
+
83
+ export interface CallSite {
84
+ file: string;
85
+ line: number;
86
+ /** Enclosing named function, when determinable. */
87
+ caller?: string;
88
+ argCount: number;
89
+ hasSpread: boolean;
90
+ args: ArgShape[];
91
+ }
92
+
93
+ export interface CallSitesResult {
94
+ file: string;
95
+ export: string;
96
+ callSites: CallSite[];
97
+ }
98
+
99
+ export type ResolveCheckOptions = QueryFileOptions;
100
+
101
+ export type ImportResolutionStatus = "resolved" | "unresolved" | "external";
102
+
103
+ export interface ResolveCheckImport {
104
+ specifier: string;
105
+ kind: "static" | "type" | "dynamic" | "require";
106
+ status: ImportResolutionStatus;
107
+ /** Root-relative resolved target, when the import resolves locally. */
108
+ resolved?: string;
109
+ }
110
+
111
+ export interface ResolveCheckResult {
112
+ file: string;
113
+ allResolve: boolean;
114
+ imports: ResolveCheckImport[];
115
+ unresolved: string[];
116
+ }
package/report-types.d.ts CHANGED
@@ -39,6 +39,63 @@ export interface GraphEdge {
39
39
  kind: string;
40
40
  }
41
41
 
42
+ export interface InfraOptions {
43
+ root?: string;
44
+ config?: string;
45
+ /** `infraResourceRefs` address (`<type>.<name>`). */
46
+ address?: string;
47
+ /** `infraOutputs` module directory (relative to root). */
48
+ moduleDir?: string;
49
+ /** `infraTestFor` `.tf` file (relative to root). */
50
+ tfFile?: string;
51
+ }
52
+
53
+ export interface ResourceRefRow {
54
+ /** The referencing block's address. */
55
+ address: string;
56
+ /** The referencing file, relative to the root. */
57
+ file: string;
58
+ }
59
+
60
+ export interface ModuleOutput {
61
+ name: string;
62
+ references: string[];
63
+ }
64
+
65
+ export interface OutputConsumer {
66
+ output: string;
67
+ from: string;
68
+ file: string;
69
+ }
70
+
71
+ export interface ModuleOutputsResult {
72
+ module: string;
73
+ exports: ModuleOutput[];
74
+ consumers: OutputConsumer[];
75
+ }
76
+
77
+ export interface TestForRow {
78
+ test_file: string;
79
+ }
80
+
81
+ export interface SwiftOptions {
82
+ root?: string;
83
+ config?: string;
84
+ /** The Swift source file to query (relative to root). */
85
+ file?: string;
86
+ }
87
+
88
+ export interface SwiftImporterRow {
89
+ file: string;
90
+ depth: number;
91
+ }
92
+
93
+ export interface SwiftTestTargetRow {
94
+ target: string;
95
+ package: string;
96
+ command: string;
97
+ }
98
+
42
99
  export interface ServerRoutesReport {
43
100
  summary: {
44
101
  totalRoutes: number;
package/test-types.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { SymbolEntrypoint } from "./traversal-types";
2
2
 
3
3
  export interface TestsPlanOptions {
4
- framework?: "vitest" | "playwright";
4
+ framework?: "vitest" | "playwright" | "swift";
5
5
  root?: string;
6
6
  config?: string;
7
7
  tsconfig?: string;
@@ -47,7 +47,7 @@ export interface SelectedTest {
47
47
  }
48
48
 
49
49
  export interface TestExecutionTarget {
50
- runner: "vitest" | "playwright";
50
+ runner: "vitest" | "playwright" | "swift";
51
51
  config?: string | null;
52
52
  project?: string | null;
53
53
  base_command: string[];
@@ -17,6 +17,8 @@ export type Relationship =
17
17
  | "process"
18
18
  | "asset"
19
19
  | "react"
20
+ | "swift"
21
+ | "terraform"
20
22
  | "all";
21
23
 
22
24
  export interface TraverseOptions {
package/types.d.ts CHANGED
@@ -1,3 +1,6 @@
1
1
  export * from "./traversal-types";
2
2
  export * from "./test-types";
3
3
  export * from "./report-types";
4
+ export * from "./ci-types";
5
+ export * from "./query-types";
6
+ export * from "./named-query-types";