@topogram/cli 0.3.77 → 0.3.78
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/package.json +1 -1
- package/src/import/core/shared/files.js +21 -2
- package/src/import/core/shared.js +2 -1
- package/src/import/enrichers/django-rest.js +4 -4
- package/src/import/enrichers/rails-controllers.js +3 -3
- package/src/import/enrichers/rails-models.js +3 -3
- package/src/import/extractors/api/aspnet-core.js +5 -5
- package/src/import/extractors/api/django-routes.js +5 -5
- package/src/import/extractors/api/express.js +4 -4
- package/src/import/extractors/api/fastify.js +7 -7
- package/src/import/extractors/api/flutter-dio.js +4 -4
- package/src/import/extractors/api/generic-route-fallback.js +2 -2
- package/src/import/extractors/api/graphql-code-first.js +3 -3
- package/src/import/extractors/api/graphql-sdl.js +5 -5
- package/src/import/extractors/api/jaxrs.js +3 -3
- package/src/import/extractors/api/micronaut.js +3 -3
- package/src/import/extractors/api/openapi-code.js +4 -4
- package/src/import/extractors/api/openapi.js +3 -3
- package/src/import/extractors/api/rails-routes.js +3 -3
- package/src/import/extractors/api/react-native-repository.js +3 -3
- package/src/import/extractors/api/retrofit.js +3 -3
- package/src/import/extractors/api/spring-web.js +3 -3
- package/src/import/extractors/api/swift-webapi.js +3 -3
- package/src/import/extractors/api/trpc.js +4 -4
- package/src/import/extractors/cli/generic.js +3 -3
- package/src/import/extractors/db/django-models.js +4 -4
- package/src/import/extractors/db/dotnet-models.js +4 -4
- package/src/import/extractors/db/drizzle.js +9 -7
- package/src/import/extractors/db/ef-core.js +5 -5
- package/src/import/extractors/db/flutter-entities.js +3 -3
- package/src/import/extractors/db/jpa.js +3 -3
- package/src/import/extractors/db/liquibase.js +3 -3
- package/src/import/extractors/db/maintained-seams.js +4 -4
- package/src/import/extractors/db/mybatis-xml.js +4 -4
- package/src/import/extractors/db/prisma.js +3 -3
- package/src/import/extractors/db/rails-schema.js +3 -3
- package/src/import/extractors/db/react-native-entities.js +3 -3
- package/src/import/extractors/db/room.js +5 -5
- package/src/import/extractors/db/snapshot.js +3 -3
- package/src/import/extractors/db/sql.js +3 -3
- package/src/import/extractors/db/swiftdata.js +3 -3
- package/src/import/extractors/ui/android-compose.js +4 -4
- package/src/import/extractors/ui/backend-only.js +3 -3
- package/src/import/extractors/ui/blazor.js +3 -3
- package/src/import/extractors/ui/flutter-screens.js +3 -3
- package/src/import/extractors/ui/maui-xaml.js +4 -4
- package/src/import/extractors/ui/next-pages-router.js +3 -3
- package/src/import/extractors/ui/razor-pages.js +3 -3
- package/src/import/extractors/ui/react-native-screens.js +4 -4
- package/src/import/extractors/ui/swiftui.js +3 -3
- package/src/import/extractors/ui/uikit.js +3 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
canonicalCandidateTerm,
|
|
3
3
|
dedupeCandidateRecords,
|
|
4
|
-
|
|
4
|
+
findPrimaryImportFiles,
|
|
5
5
|
idHintify,
|
|
6
6
|
makeCandidateRecord,
|
|
7
7
|
relativeTo,
|
|
@@ -78,7 +78,7 @@ export const swiftWebApiExtractor = {
|
|
|
78
78
|
id: "api.swift-webapi",
|
|
79
79
|
track: "api",
|
|
80
80
|
detect(context) {
|
|
81
|
-
const files =
|
|
81
|
+
const files = findPrimaryImportFiles(context.paths, (filePath) => /WebRepository\.swift$/i.test(filePath) || /WebAPI\/.+\.swift$/i.test(filePath));
|
|
82
82
|
const score = files.some((filePath) => /APICall|URLSession/.test(context.helpers.readTextIfExists(filePath) || "")) ? 85 : 0;
|
|
83
83
|
return {
|
|
84
84
|
score,
|
|
@@ -86,7 +86,7 @@ export const swiftWebApiExtractor = {
|
|
|
86
86
|
};
|
|
87
87
|
},
|
|
88
88
|
extract(context) {
|
|
89
|
-
const files =
|
|
89
|
+
const files = findPrimaryImportFiles(context.paths, (filePath) => /WebAPI\/.+\.swift$/i.test(filePath))
|
|
90
90
|
.filter((filePath) => /struct\s+Real/.test(context.helpers.readTextIfExists(filePath) || ""));
|
|
91
91
|
const capabilities = [];
|
|
92
92
|
for (const filePath of files) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
dedupeCandidateRecords,
|
|
3
|
-
|
|
3
|
+
findPrimaryImportFiles,
|
|
4
4
|
inferApiEntityIdFromPath,
|
|
5
5
|
makeCandidateRecord,
|
|
6
6
|
pluralizeCandidateTerm,
|
|
@@ -156,15 +156,15 @@ export const trpcExtractor = {
|
|
|
156
156
|
id: "api.trpc",
|
|
157
157
|
track: "api",
|
|
158
158
|
detect(context) {
|
|
159
|
-
const routerFiles =
|
|
160
|
-
const trpcHandler =
|
|
159
|
+
const routerFiles = findPrimaryImportFiles(context.paths, (filePath) => /src\/server\/routers\/.+\.(ts|tsx|js|jsx)$/i.test(filePath));
|
|
160
|
+
const trpcHandler = findPrimaryImportFiles(context.paths, (filePath) => /src\/pages\/api\/trpc\/\[trpc\]\.(ts|tsx|js|jsx)$/i.test(filePath));
|
|
161
161
|
return {
|
|
162
162
|
score: routerFiles.length > 0 && trpcHandler.length > 0 ? 88 : 0,
|
|
163
163
|
reasons: routerFiles.length > 0 && trpcHandler.length > 0 ? ["Found tRPC router modules and Next.js tRPC handler"] : []
|
|
164
164
|
};
|
|
165
165
|
},
|
|
166
166
|
extract(context) {
|
|
167
|
-
const routerFiles =
|
|
167
|
+
const routerFiles = findPrimaryImportFiles(context.paths, (filePath) => /src\/server\/routers\/.+\.(ts|tsx|js|jsx)$/i.test(filePath))
|
|
168
168
|
.filter((filePath) => !/\/_app\.(ts|tsx|js|jsx)$/i.test(filePath) && !/\.test\./i.test(filePath));
|
|
169
169
|
const procedures = routerFiles.flatMap((filePath) => parseRouterProcedures(filePath, context.helpers.readTextIfExists(filePath) || ""));
|
|
170
170
|
const findings = [];
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
|
-
|
|
6
|
+
findPrimaryImportFiles,
|
|
7
7
|
idHintify,
|
|
8
8
|
isPrimaryImportSource,
|
|
9
9
|
makeCandidateRecord,
|
|
@@ -251,9 +251,9 @@ function inspectPackageCliMetadata(context, packageFiles) {
|
|
|
251
251
|
* @returns {{ packageFiles: string[], sourceFiles: string[], binNames: Set<string>, findings: any[], provenance: string[] }}
|
|
252
252
|
*/
|
|
253
253
|
function discoverCliSources(context) {
|
|
254
|
-
const packageFiles =
|
|
254
|
+
const packageFiles = findPrimaryImportFiles(context.paths, (/** @type {string} */ filePath) => /package\.json$/i.test(filePath));
|
|
255
255
|
const packageMetadata = inspectPackageCliMetadata(context, packageFiles);
|
|
256
|
-
const sourceFiles =
|
|
256
|
+
const sourceFiles = findPrimaryImportFiles(context.paths, (/** @type {string} */ filePath) => {
|
|
257
257
|
const normalized = normalizePath(filePath);
|
|
258
258
|
if (!isAuthoritativeCliSource(context.paths, filePath)) {
|
|
259
259
|
return false;
|
|
@@ -3,7 +3,7 @@ import path from "node:path";
|
|
|
3
3
|
import {
|
|
4
4
|
canonicalCandidateTerm,
|
|
5
5
|
dedupeCandidateRecords,
|
|
6
|
-
|
|
6
|
+
findPrimaryImportFiles,
|
|
7
7
|
idHintify,
|
|
8
8
|
makeCandidateRecord,
|
|
9
9
|
relativeTo,
|
|
@@ -169,8 +169,8 @@ export const djangoModelsExtractor = {
|
|
|
169
169
|
id: "db.django-models",
|
|
170
170
|
track: "db",
|
|
171
171
|
detect(context) {
|
|
172
|
-
const modelFiles =
|
|
173
|
-
const manageFiles =
|
|
172
|
+
const modelFiles = findPrimaryImportFiles(context.paths, (filePath) => /\/models\.py$/i.test(filePath));
|
|
173
|
+
const manageFiles = findPrimaryImportFiles(context.paths, (filePath) => /\/manage\.py$/i.test(filePath));
|
|
174
174
|
const score = modelFiles.length > 0 && manageFiles.length > 0 ? 91 : 0;
|
|
175
175
|
return {
|
|
176
176
|
score,
|
|
@@ -178,7 +178,7 @@ export const djangoModelsExtractor = {
|
|
|
178
178
|
};
|
|
179
179
|
},
|
|
180
180
|
extract(context) {
|
|
181
|
-
const modelFiles =
|
|
181
|
+
const modelFiles = findPrimaryImportFiles(context.paths, (filePath) => /\/models\.py$/i.test(filePath));
|
|
182
182
|
const findings = [];
|
|
183
183
|
const candidates = { entities: [], enums: [], relations: [], indexes: [] };
|
|
184
184
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
canonicalCandidateTerm,
|
|
3
3
|
dedupeCandidateRecords,
|
|
4
|
-
|
|
4
|
+
findPrimaryImportFiles,
|
|
5
5
|
idHintify,
|
|
6
6
|
makeCandidateRecord,
|
|
7
7
|
relativeTo,
|
|
@@ -61,8 +61,8 @@ export const dotnetModelsExtractor = {
|
|
|
61
61
|
id: "db.dotnet-models",
|
|
62
62
|
track: "db",
|
|
63
63
|
detect(context) {
|
|
64
|
-
const modelFiles =
|
|
65
|
-
const csprojFiles =
|
|
64
|
+
const modelFiles = findPrimaryImportFiles(context.paths, (filePath) => /\/Models\/.+\.cs$/i.test(filePath));
|
|
65
|
+
const csprojFiles = findPrimaryImportFiles(context.paths, (filePath) => /\.csproj$/i.test(filePath));
|
|
66
66
|
const score = modelFiles.length > 0 && csprojFiles.length > 0 ? 78 : 0;
|
|
67
67
|
return {
|
|
68
68
|
score,
|
|
@@ -70,7 +70,7 @@ export const dotnetModelsExtractor = {
|
|
|
70
70
|
};
|
|
71
71
|
},
|
|
72
72
|
extract(context) {
|
|
73
|
-
const modelFiles =
|
|
73
|
+
const modelFiles = findPrimaryImportFiles(context.paths, (filePath) => /\/Models\/.+\.cs$/i.test(filePath));
|
|
74
74
|
const findings = [];
|
|
75
75
|
const entities = [];
|
|
76
76
|
for (const filePath of modelFiles) {
|
|
@@ -3,7 +3,7 @@ import path from "node:path";
|
|
|
3
3
|
import {
|
|
4
4
|
canonicalCandidateTerm,
|
|
5
5
|
dedupeCandidateRecords,
|
|
6
|
-
|
|
6
|
+
findPrimaryImportFiles,
|
|
7
7
|
idHintify,
|
|
8
8
|
isPrimaryImportSource,
|
|
9
9
|
makeCandidateRecord,
|
|
@@ -168,7 +168,7 @@ function parseDrizzleTables(schemaText) {
|
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
function drizzleConfigFiles(context) {
|
|
171
|
-
return
|
|
171
|
+
return findPrimaryImportFiles(context.paths, (filePath) =>
|
|
172
172
|
/drizzle\.config\.(ts|js|mjs|cjs)$/i.test(path.basename(filePath)) &&
|
|
173
173
|
isPrimaryImportSource(context.paths, filePath)
|
|
174
174
|
);
|
|
@@ -180,7 +180,10 @@ function configuredSchemaFiles(context, configFiles) {
|
|
|
180
180
|
const configText = context.helpers.readTextIfExists(configFile) || "";
|
|
181
181
|
for (const match of configText.matchAll(/\bschema\s*:\s*["'`]([^"'`*]+)["'`]/g)) {
|
|
182
182
|
const absoluteSchemaPath = path.resolve(path.dirname(configFile), match[1]);
|
|
183
|
-
if (
|
|
183
|
+
if (
|
|
184
|
+
context.helpers.readTextIfExists(absoluteSchemaPath) !== null &&
|
|
185
|
+
isPrimaryImportSource(context.paths, absoluteSchemaPath)
|
|
186
|
+
) {
|
|
184
187
|
files.push(absoluteSchemaPath);
|
|
185
188
|
}
|
|
186
189
|
}
|
|
@@ -195,7 +198,7 @@ function isDrizzleSchemaSource(context, filePath) {
|
|
|
195
198
|
|
|
196
199
|
function findDrizzleSchemaFiles(context) {
|
|
197
200
|
const configFiles = drizzleConfigFiles(context);
|
|
198
|
-
const conventionalSchemaFiles =
|
|
201
|
+
const conventionalSchemaFiles = findPrimaryImportFiles(context.paths, (filePath) =>
|
|
199
202
|
/(?:^|\/)(?:src\/db\/schema|src\/schema|db\/schema|schema)\.(ts|js|mjs|cjs)$/i.test(relativeTo(context.paths.workspaceRoot, filePath).replaceAll(path.sep, "/")) &&
|
|
200
203
|
isPrimaryImportSource(context.paths, filePath)
|
|
201
204
|
);
|
|
@@ -209,11 +212,10 @@ export const drizzleExtractor = {
|
|
|
209
212
|
id: "db.drizzle",
|
|
210
213
|
track: "db",
|
|
211
214
|
detect(context) {
|
|
212
|
-
const hasConfig = drizzleConfigFiles(context).length > 0;
|
|
213
215
|
const hasSchema = findDrizzleSchemaFiles(context).length > 0;
|
|
214
216
|
return {
|
|
215
|
-
score:
|
|
216
|
-
reasons:
|
|
217
|
+
score: hasSchema ? 95 : 0,
|
|
218
|
+
reasons: hasSchema ? ["Found Drizzle schema source"] : []
|
|
217
219
|
};
|
|
218
220
|
},
|
|
219
221
|
extract(context) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
canonicalCandidateTerm,
|
|
3
3
|
dedupeCandidateRecords,
|
|
4
|
-
|
|
4
|
+
findPrimaryImportFiles,
|
|
5
5
|
makeCandidateRecord,
|
|
6
6
|
readTextIfExists,
|
|
7
7
|
relativeTo,
|
|
@@ -155,8 +155,8 @@ export const efCoreExtractor = {
|
|
|
155
155
|
id: "db.ef-core",
|
|
156
156
|
track: "db",
|
|
157
157
|
detect(context) {
|
|
158
|
-
const csprojFiles =
|
|
159
|
-
const dbContextFiles =
|
|
158
|
+
const csprojFiles = findPrimaryImportFiles(context.paths, (filePath) => /\.csproj$/i.test(filePath));
|
|
159
|
+
const dbContextFiles = findPrimaryImportFiles(context.paths, (filePath) => /DbContext|Context\.cs$/i.test(filePath));
|
|
160
160
|
const score = csprojFiles.length > 0 && dbContextFiles.some((filePath) => /DbContext/.test(readTextIfExists(filePath) || "")) ? 89 : 0;
|
|
161
161
|
return {
|
|
162
162
|
score,
|
|
@@ -164,8 +164,8 @@ export const efCoreExtractor = {
|
|
|
164
164
|
};
|
|
165
165
|
},
|
|
166
166
|
extract(context) {
|
|
167
|
-
const dbContextFiles =
|
|
168
|
-
const domainFiles =
|
|
167
|
+
const dbContextFiles = findPrimaryImportFiles(context.paths, (filePath) => /DbContext|Context\.cs$/i.test(filePath));
|
|
168
|
+
const domainFiles = findPrimaryImportFiles(context.paths, (filePath) => /\/Domain\/.+\.cs$/i.test(filePath));
|
|
169
169
|
const findings = [];
|
|
170
170
|
const candidates = { entities: [], enums: [], relations: [], indexes: [] };
|
|
171
171
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
canonicalCandidateTerm,
|
|
3
3
|
dedupeCandidateRecords,
|
|
4
|
-
|
|
4
|
+
findPrimaryImportFiles,
|
|
5
5
|
idHintify,
|
|
6
6
|
makeCandidateRecord,
|
|
7
7
|
relativeTo,
|
|
@@ -82,7 +82,7 @@ export const flutterEntitiesExtractor = {
|
|
|
82
82
|
id: "db.flutter-entities",
|
|
83
83
|
track: "db",
|
|
84
84
|
detect(context) {
|
|
85
|
-
const entityFiles =
|
|
85
|
+
const entityFiles = findPrimaryImportFiles(
|
|
86
86
|
context.paths,
|
|
87
87
|
(filePath) => /\/lib\/features\/.+\/domain\/entities\/.+_entity\.dart$/i.test(filePath)
|
|
88
88
|
);
|
|
@@ -93,7 +93,7 @@ export const flutterEntitiesExtractor = {
|
|
|
93
93
|
};
|
|
94
94
|
},
|
|
95
95
|
extract(context) {
|
|
96
|
-
const entityFiles =
|
|
96
|
+
const entityFiles = findPrimaryImportFiles(
|
|
97
97
|
context.paths,
|
|
98
98
|
(filePath) => /\/lib\/features\/.+\/domain\/entities\/.+_entity\.dart$/i.test(filePath)
|
|
99
99
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { canonicalCandidateTerm, dedupeCandidateRecords,
|
|
1
|
+
import { canonicalCandidateTerm, dedupeCandidateRecords, findPrimaryImportFiles, makeCandidateRecord, relativeTo, slugify, titleCase } from "../../core/shared.js";
|
|
2
2
|
|
|
3
3
|
function extractAnnotatedFields(text) {
|
|
4
4
|
const fields = [];
|
|
@@ -44,7 +44,7 @@ export const jpaExtractor = {
|
|
|
44
44
|
id: "db.jpa",
|
|
45
45
|
track: "db",
|
|
46
46
|
detect(context) {
|
|
47
|
-
const entityFiles =
|
|
47
|
+
const entityFiles = findPrimaryImportFiles(context.paths, (filePath) => /\.java$/i.test(filePath));
|
|
48
48
|
const count = entityFiles.filter((filePath) => /@Entity\b/.test(context.helpers.readTextIfExists(filePath) || "")).length;
|
|
49
49
|
return {
|
|
50
50
|
score: count > 0 ? 87 : 0,
|
|
@@ -52,7 +52,7 @@ export const jpaExtractor = {
|
|
|
52
52
|
};
|
|
53
53
|
},
|
|
54
54
|
extract(context) {
|
|
55
|
-
const files =
|
|
55
|
+
const files = findPrimaryImportFiles(context.paths, (filePath) => /\.java$/i.test(filePath));
|
|
56
56
|
const findings = [];
|
|
57
57
|
const candidates = { entities: [], enums: [], relations: [], indexes: [] };
|
|
58
58
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
canonicalCandidateTerm,
|
|
3
3
|
dedupeCandidateRecords,
|
|
4
|
-
|
|
4
|
+
findPrimaryImportFiles,
|
|
5
5
|
idHintify,
|
|
6
6
|
makeCandidateRecord,
|
|
7
7
|
relativeTo,
|
|
@@ -109,14 +109,14 @@ export const liquibaseExtractor = {
|
|
|
109
109
|
id: "db.liquibase",
|
|
110
110
|
track: "db",
|
|
111
111
|
detect(context) {
|
|
112
|
-
const files =
|
|
112
|
+
const files = findPrimaryImportFiles(context.paths, (filePath) => /db\/changelog\/.+\.(xml|ya?ml)$/i.test(filePath));
|
|
113
113
|
return {
|
|
114
114
|
score: files.length > 0 ? 88 : 0,
|
|
115
115
|
reasons: files.length > 0 ? ["Found Liquibase changelog files"] : []
|
|
116
116
|
};
|
|
117
117
|
},
|
|
118
118
|
extract(context) {
|
|
119
|
-
const changelogFiles =
|
|
119
|
+
const changelogFiles = findPrimaryImportFiles(context.paths, (filePath) => /db\/changelog\/.+\.xml$/i.test(filePath));
|
|
120
120
|
const findings = [];
|
|
121
121
|
const candidates = { entities: [], enums: [], relations: [], indexes: [] };
|
|
122
122
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { findPrimaryImportFiles, isPrimaryImportSource, makeCandidateRecord, relativeTo } from "../../core/shared.js";
|
|
6
6
|
|
|
7
7
|
/** @param {string} value @returns {string} */
|
|
8
8
|
function toPosix(value) {
|
|
@@ -139,7 +139,7 @@ export function inferPrismaMaintainedDbSeams(context, prismaFiles) {
|
|
|
139
139
|
return [];
|
|
140
140
|
}
|
|
141
141
|
const schemaPath = appRelativePath(context, prismaFiles[0]);
|
|
142
|
-
const migrationFiles = /** @type {string[]} */ (
|
|
142
|
+
const migrationFiles = /** @type {string[]} */ (findPrimaryImportFiles(context.paths, /** @param {string} filePath */ (filePath) =>
|
|
143
143
|
toPosix(filePath).includes("/prisma/migrations/") &&
|
|
144
144
|
isPrimaryImportSource(context.paths, filePath)
|
|
145
145
|
));
|
|
@@ -167,11 +167,11 @@ export function inferDrizzleMaintainedDbSeams(context, schemaFiles) {
|
|
|
167
167
|
if (!schemaFiles.length) {
|
|
168
168
|
return [];
|
|
169
169
|
}
|
|
170
|
-
const configFiles = /** @type {string[]} */ (
|
|
170
|
+
const configFiles = /** @type {string[]} */ (findPrimaryImportFiles(context.paths, /** @param {string} filePath */ (filePath) =>
|
|
171
171
|
/drizzle\.config\.(ts|js|mjs|cjs)$/i.test(path.basename(filePath)) &&
|
|
172
172
|
isPrimaryImportSource(context.paths, filePath)
|
|
173
173
|
));
|
|
174
|
-
const drizzleFiles = /** @type {string[]} */ (
|
|
174
|
+
const drizzleFiles = /** @type {string[]} */ (findPrimaryImportFiles(context.paths, /** @param {string} filePath */ (filePath) =>
|
|
175
175
|
appRelativePath(context, filePath).startsWith("drizzle/") &&
|
|
176
176
|
isPrimaryImportSource(context.paths, filePath)
|
|
177
177
|
));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { dedupeCandidateRecords,
|
|
1
|
+
import { dedupeCandidateRecords, findPrimaryImportFiles, makeCandidateRecord, relativeTo, selectPreferredImportFiles, slugify, titleCase, idHintify, canonicalCandidateTerm } from "../../core/shared.js";
|
|
2
2
|
import { parseSqlSchema } from "./sql.js";
|
|
3
3
|
|
|
4
4
|
function classifyNoiseEntity(tableName, fields) {
|
|
@@ -36,15 +36,15 @@ export const myBatisXmlExtractor = {
|
|
|
36
36
|
id: "db.mybatis-xml",
|
|
37
37
|
track: "db",
|
|
38
38
|
detect(context) {
|
|
39
|
-
const mapperFiles =
|
|
39
|
+
const mapperFiles = findPrimaryImportFiles(context.paths, (filePath) => /\/mapper\/.+\.xml$/i.test(filePath));
|
|
40
40
|
return {
|
|
41
41
|
score: mapperFiles.length > 0 ? 86 : 0,
|
|
42
42
|
reasons: mapperFiles.length > 0 ? ["Found MyBatis mapper XML files"] : []
|
|
43
43
|
};
|
|
44
44
|
},
|
|
45
45
|
extract(context) {
|
|
46
|
-
const mapperFiles =
|
|
47
|
-
const allSqlFiles =
|
|
46
|
+
const mapperFiles = findPrimaryImportFiles(context.paths, (filePath) => /\/mapper\/.+\.xml$/i.test(filePath));
|
|
47
|
+
const allSqlFiles = findPrimaryImportFiles(context.paths, (filePath) => filePath.endsWith(".sql"));
|
|
48
48
|
const schemaSqlFiles = allSqlFiles.filter((filePath) => !/\/src\/test\//i.test(filePath));
|
|
49
49
|
const sqlFiles = selectPreferredImportFiles(context.paths, schemaSqlFiles, "sql");
|
|
50
50
|
const findings = [];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
findPrimaryImportFiles,
|
|
3
3
|
isPrimaryImportSource,
|
|
4
4
|
makeCandidateRecord,
|
|
5
5
|
normalizePrismaType,
|
|
@@ -114,7 +114,7 @@ export const prismaExtractor = {
|
|
|
114
114
|
id: "db.prisma",
|
|
115
115
|
track: "db",
|
|
116
116
|
detect(context) {
|
|
117
|
-
const files =
|
|
117
|
+
const files = findPrimaryImportFiles(context.paths, (filePath) =>
|
|
118
118
|
(filePath.endsWith("/prisma/schema.prisma") || filePath.endsWith("prisma/schema.prisma")) &&
|
|
119
119
|
isPrimaryImportSource(context.paths, filePath)
|
|
120
120
|
);
|
|
@@ -126,7 +126,7 @@ export const prismaExtractor = {
|
|
|
126
126
|
extract(context) {
|
|
127
127
|
const prismaFiles = selectPreferredImportFiles(
|
|
128
128
|
context.paths,
|
|
129
|
-
|
|
129
|
+
findPrimaryImportFiles(context.paths, (filePath) =>
|
|
130
130
|
(filePath.endsWith("/prisma/schema.prisma") || filePath.endsWith("prisma/schema.prisma")) &&
|
|
131
131
|
isPrimaryImportSource(context.paths, filePath)
|
|
132
132
|
),
|
|
@@ -3,7 +3,7 @@ import path from "node:path";
|
|
|
3
3
|
import {
|
|
4
4
|
canonicalCandidateTerm,
|
|
5
5
|
dedupeCandidateRecords,
|
|
6
|
-
|
|
6
|
+
findPrimaryImportFiles,
|
|
7
7
|
idHintify,
|
|
8
8
|
makeCandidateRecord,
|
|
9
9
|
relativeTo,
|
|
@@ -107,14 +107,14 @@ export const railsSchemaExtractor = {
|
|
|
107
107
|
id: "db.rails-schema",
|
|
108
108
|
track: "db",
|
|
109
109
|
detect(context) {
|
|
110
|
-
const schemaFiles =
|
|
110
|
+
const schemaFiles = findPrimaryImportFiles(context.paths, (filePath) => /db\/schema\.rb$/i.test(filePath));
|
|
111
111
|
return {
|
|
112
112
|
score: schemaFiles.length > 0 ? 92 : 0,
|
|
113
113
|
reasons: schemaFiles.length > 0 ? ["Found Rails schema.rb"] : []
|
|
114
114
|
};
|
|
115
115
|
},
|
|
116
116
|
extract(context) {
|
|
117
|
-
const schemaFiles =
|
|
117
|
+
const schemaFiles = findPrimaryImportFiles(context.paths, (filePath) => /db\/schema\.rb$/i.test(filePath));
|
|
118
118
|
const findings = [];
|
|
119
119
|
const candidates = { entities: [], enums: [], relations: [], indexes: [] };
|
|
120
120
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
canonicalCandidateTerm,
|
|
3
3
|
dedupeCandidateRecords,
|
|
4
|
-
|
|
4
|
+
findPrimaryImportFiles,
|
|
5
5
|
idHintify,
|
|
6
6
|
makeCandidateRecord,
|
|
7
7
|
relativeTo,
|
|
@@ -60,7 +60,7 @@ export const reactNativeEntitiesExtractor = {
|
|
|
60
60
|
id: "db.react-native-entities",
|
|
61
61
|
track: "db",
|
|
62
62
|
detect(context) {
|
|
63
|
-
const entityFiles =
|
|
63
|
+
const entityFiles = findPrimaryImportFiles(
|
|
64
64
|
context.paths,
|
|
65
65
|
(filePath) => /\/src\/.+\/domain\/entities\/.+Entity\.ts$/i.test(filePath)
|
|
66
66
|
);
|
|
@@ -71,7 +71,7 @@ export const reactNativeEntitiesExtractor = {
|
|
|
71
71
|
};
|
|
72
72
|
},
|
|
73
73
|
extract(context) {
|
|
74
|
-
const entityFiles =
|
|
74
|
+
const entityFiles = findPrimaryImportFiles(
|
|
75
75
|
context.paths,
|
|
76
76
|
(filePath) => /\/src\/.+\/domain\/entities\/.+Entity\.ts$/i.test(filePath)
|
|
77
77
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
canonicalCandidateTerm,
|
|
3
3
|
dedupeCandidateRecords,
|
|
4
|
-
|
|
4
|
+
findPrimaryImportFiles,
|
|
5
5
|
idHintify,
|
|
6
6
|
makeCandidateRecord,
|
|
7
7
|
relativeTo,
|
|
@@ -151,8 +151,8 @@ export const roomExtractor = {
|
|
|
151
151
|
id: "db.room",
|
|
152
152
|
track: "db",
|
|
153
153
|
detect(context) {
|
|
154
|
-
const entityFiles =
|
|
155
|
-
const daoFiles =
|
|
154
|
+
const entityFiles = findPrimaryImportFiles(context.paths, (filePath) => /Entity\.kt$/i.test(filePath) || /\/entitiy\/.+\.kt$/i.test(filePath) || /\/entity\/.+\.kt$/i.test(filePath));
|
|
155
|
+
const daoFiles = findPrimaryImportFiles(context.paths, (filePath) => /Dao\.kt$/i.test(filePath));
|
|
156
156
|
const score = entityFiles.length > 0 && daoFiles.length > 0 ? 89 : 0;
|
|
157
157
|
return {
|
|
158
158
|
score,
|
|
@@ -160,8 +160,8 @@ export const roomExtractor = {
|
|
|
160
160
|
};
|
|
161
161
|
},
|
|
162
162
|
extract(context) {
|
|
163
|
-
const entityFiles =
|
|
164
|
-
const daoFiles =
|
|
163
|
+
const entityFiles = findPrimaryImportFiles(context.paths, (filePath) => /Entity\.kt$/i.test(filePath) || /\/entitiy\/.+\.kt$/i.test(filePath) || /\/entity\/.+\.kt$/i.test(filePath));
|
|
164
|
+
const daoFiles = findPrimaryImportFiles(context.paths, (filePath) => /Dao\.kt$/i.test(filePath));
|
|
165
165
|
const findings = [];
|
|
166
166
|
const candidates = { entities: [], enums: [], relations: [], indexes: [] };
|
|
167
167
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { findPrimaryImportFiles, makeCandidateRecord, relativeTo, slugify, titleCase, idHintify } from "../../core/shared.js";
|
|
2
2
|
|
|
3
3
|
function parseDbSchemaSnapshot(snapshot) {
|
|
4
4
|
return {
|
|
@@ -42,14 +42,14 @@ export const snapshotExtractor = {
|
|
|
42
42
|
id: "db.snapshot",
|
|
43
43
|
track: "db",
|
|
44
44
|
detect(context) {
|
|
45
|
-
const files =
|
|
45
|
+
const files = findPrimaryImportFiles(context.paths, (filePath) => filePath.endsWith(".db-schema-snapshot.json"));
|
|
46
46
|
return {
|
|
47
47
|
score: files.length > 0 ? 40 : 0,
|
|
48
48
|
reasons: files.length > 0 ? ["Found DB schema snapshot artifacts"] : []
|
|
49
49
|
};
|
|
50
50
|
},
|
|
51
51
|
extract(context) {
|
|
52
|
-
const snapshotFiles =
|
|
52
|
+
const snapshotFiles = findPrimaryImportFiles(context.paths, (filePath) => filePath.endsWith(".db-schema-snapshot.json"));
|
|
53
53
|
const findings = [];
|
|
54
54
|
const candidates = { entities: [], enums: [], relations: [], indexes: [] };
|
|
55
55
|
for (const filePath of snapshotFiles) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { canonicalCandidateTerm,
|
|
1
|
+
import { canonicalCandidateTerm, findPrimaryImportFiles, isPrimaryImportSource, makeCandidateRecord, relativeTo, selectPreferredImportFiles, slugify, titleCase, idHintify } from "../../core/shared.js";
|
|
2
2
|
import { inferSqlMaintainedDbSeams } from "./maintained-seams.js";
|
|
3
3
|
|
|
4
4
|
function parseTableConstraint(line, tableName) {
|
|
@@ -105,14 +105,14 @@ export const sqlExtractor = {
|
|
|
105
105
|
id: "db.sql",
|
|
106
106
|
track: "db",
|
|
107
107
|
detect(context) {
|
|
108
|
-
const files =
|
|
108
|
+
const files = findPrimaryImportFiles(context.paths, (filePath) => filePath.endsWith(".sql") && isPrimaryImportSource(context.paths, filePath));
|
|
109
109
|
return {
|
|
110
110
|
score: files.length > 0 ? 80 : 0,
|
|
111
111
|
reasons: files.length > 0 ? ["Found SQL schema or migration files"] : []
|
|
112
112
|
};
|
|
113
113
|
},
|
|
114
114
|
extract(context) {
|
|
115
|
-
const allSqlFiles =
|
|
115
|
+
const allSqlFiles = findPrimaryImportFiles(context.paths, (filePath) => filePath.endsWith(".sql") && isPrimaryImportSource(context.paths, filePath));
|
|
116
116
|
const schemaSqlFiles = allSqlFiles.filter((filePath) => !/migration/i.test(filePath) && !/\/src\/test\//i.test(filePath));
|
|
117
117
|
const migrationSqlFiles = allSqlFiles.filter((filePath) => /migration/i.test(filePath));
|
|
118
118
|
const sqlFiles =
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
canonicalCandidateTerm,
|
|
3
3
|
dedupeCandidateRecords,
|
|
4
|
-
|
|
4
|
+
findPrimaryImportFiles,
|
|
5
5
|
idHintify,
|
|
6
6
|
makeCandidateRecord,
|
|
7
7
|
relativeTo,
|
|
@@ -106,7 +106,7 @@ export const swiftDataExtractor = {
|
|
|
106
106
|
id: "db.swiftdata",
|
|
107
107
|
track: "db",
|
|
108
108
|
detect(context) {
|
|
109
|
-
const files =
|
|
109
|
+
const files = findPrimaryImportFiles(context.paths, (filePath) => /\.swift$/i.test(filePath))
|
|
110
110
|
.filter((filePath) => /@Model/.test(context.helpers.readTextIfExists(filePath) || ""));
|
|
111
111
|
return {
|
|
112
112
|
score: files.length > 0 ? 86 : 0,
|
|
@@ -114,7 +114,7 @@ export const swiftDataExtractor = {
|
|
|
114
114
|
};
|
|
115
115
|
},
|
|
116
116
|
extract(context) {
|
|
117
|
-
const files =
|
|
117
|
+
const files = findPrimaryImportFiles(context.paths, (filePath) => /\.swift$/i.test(filePath))
|
|
118
118
|
.filter((filePath) => /@Model/.test(context.helpers.readTextIfExists(filePath) || ""));
|
|
119
119
|
const findings = [];
|
|
120
120
|
const candidates = { entities: [], enums: [], relations: [], indexes: [] };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
canonicalCandidateTerm,
|
|
3
3
|
dedupeCandidateRecords,
|
|
4
|
-
|
|
4
|
+
findPrimaryImportFiles,
|
|
5
5
|
idHintify,
|
|
6
6
|
makeCandidateRecord,
|
|
7
7
|
relativeTo,
|
|
@@ -85,7 +85,7 @@ export const androidComposeUiExtractor = {
|
|
|
85
85
|
id: "ui.android-compose",
|
|
86
86
|
track: "ui",
|
|
87
87
|
detect(context) {
|
|
88
|
-
const composeFiles =
|
|
88
|
+
const composeFiles = findPrimaryImportFiles(context.paths, (filePath) => /\.kt$/i.test(filePath))
|
|
89
89
|
.filter((filePath) => /@Composable/.test(context.helpers.readTextIfExists(filePath) || ""));
|
|
90
90
|
const score = composeFiles.length > 0 ? 84 : 0;
|
|
91
91
|
return {
|
|
@@ -94,8 +94,8 @@ export const androidComposeUiExtractor = {
|
|
|
94
94
|
};
|
|
95
95
|
},
|
|
96
96
|
extract(context) {
|
|
97
|
-
const navFiles =
|
|
98
|
-
const composeFiles =
|
|
97
|
+
const navFiles = findPrimaryImportFiles(context.paths, (filePath) => /NavHost\.kt$/i.test(filePath) || /navigation\/.+\.kt$/i.test(filePath));
|
|
98
|
+
const composeFiles = findPrimaryImportFiles(context.paths, (filePath) => /\.kt$/i.test(filePath))
|
|
99
99
|
.filter((filePath) => /@Composable/.test(context.helpers.readTextIfExists(filePath) || ""));
|
|
100
100
|
const findings = [];
|
|
101
101
|
const candidates = { screens: [], routes: [], actions: [], stacks: [] };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { findPrimaryImportFiles, relativeTo } from "../../core/shared.js";
|
|
4
4
|
|
|
5
5
|
function readPackageJson(context) {
|
|
6
|
-
const packageFile =
|
|
6
|
+
const packageFile = findPrimaryImportFiles(context.paths, (filePath) => /package\.json$/i.test(filePath))[0];
|
|
7
7
|
if (!packageFile) return null;
|
|
8
8
|
try {
|
|
9
9
|
return {
|
|
@@ -24,7 +24,7 @@ function hasFrontendSignals(context) {
|
|
|
24
24
|
if (deps.react || deps.next || deps["@remix-run/react"] || deps["@sveltejs/kit"] || deps.svelte || deps.vue || deps.nuxt) {
|
|
25
25
|
return true;
|
|
26
26
|
}
|
|
27
|
-
const uiFiles =
|
|
27
|
+
const uiFiles = findPrimaryImportFiles(
|
|
28
28
|
context.paths,
|
|
29
29
|
(filePath) =>
|
|
30
30
|
/(app\/.+\/page\.(tsx|ts|jsx|js|mdx)|src\/App\.tsx|src\/routes\/.+\.(svelte|tsx|jsx)|pages\/.+\.(tsx|ts|jsx|js))$/i.test(filePath)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
canonicalCandidateTerm,
|
|
3
3
|
dedupeCandidateRecords,
|
|
4
|
-
|
|
4
|
+
findPrimaryImportFiles,
|
|
5
5
|
idHintify,
|
|
6
6
|
makeCandidateRecord,
|
|
7
7
|
relativeTo,
|
|
@@ -98,7 +98,7 @@ export const blazorUiExtractor = {
|
|
|
98
98
|
id: "ui.blazor",
|
|
99
99
|
track: "ui",
|
|
100
100
|
detect(context) {
|
|
101
|
-
const razorFiles =
|
|
101
|
+
const razorFiles = findPrimaryImportFiles(context.paths, (filePath) => /\.razor$/i.test(filePath))
|
|
102
102
|
.filter((filePath) => !shouldIgnoreFile(filePath));
|
|
103
103
|
const score = razorFiles.length > 0 ? 86 : 0;
|
|
104
104
|
return {
|
|
@@ -107,7 +107,7 @@ export const blazorUiExtractor = {
|
|
|
107
107
|
};
|
|
108
108
|
},
|
|
109
109
|
extract(context) {
|
|
110
|
-
const razorFiles =
|
|
110
|
+
const razorFiles = findPrimaryImportFiles(context.paths, (filePath) => /\.razor$/i.test(filePath))
|
|
111
111
|
.filter((filePath) => !shouldIgnoreFile(filePath));
|
|
112
112
|
const findings = [];
|
|
113
113
|
const candidates = { screens: [], routes: [], actions: [], stacks: [] };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
canonicalCandidateTerm,
|
|
3
3
|
dedupeCandidateRecords,
|
|
4
|
-
|
|
4
|
+
findPrimaryImportFiles,
|
|
5
5
|
idHintify,
|
|
6
6
|
makeCandidateRecord,
|
|
7
7
|
relativeTo,
|
|
@@ -110,7 +110,7 @@ export const flutterScreensUiExtractor = {
|
|
|
110
110
|
id: "ui.flutter-screens",
|
|
111
111
|
track: "ui",
|
|
112
112
|
detect(context) {
|
|
113
|
-
const files =
|
|
113
|
+
const files = findPrimaryImportFiles(
|
|
114
114
|
context.paths,
|
|
115
115
|
(filePath) => /\/lib\/features\/.+\/presentation\/screens\/.+_screen\.dart$/i.test(filePath)
|
|
116
116
|
);
|
|
@@ -121,7 +121,7 @@ export const flutterScreensUiExtractor = {
|
|
|
121
121
|
};
|
|
122
122
|
},
|
|
123
123
|
extract(context) {
|
|
124
|
-
const files =
|
|
124
|
+
const files = findPrimaryImportFiles(
|
|
125
125
|
context.paths,
|
|
126
126
|
(filePath) => /\/lib\/features\/.+\/presentation\/screens\/.+_screen\.dart$/i.test(filePath)
|
|
127
127
|
);
|