@llipe.com/dev-tasks 0.6.1
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/CHANGELOG.md +104 -0
- package/README.md +823 -0
- package/bundle-manifest.json +113 -0
- package/dist/adapters/cli/extract-all.d.ts +31 -0
- package/dist/adapters/cli/extract-all.d.ts.map +1 -0
- package/dist/adapters/cli/extract-all.js +374 -0
- package/dist/adapters/cli/extract-all.js.map +1 -0
- package/dist/adapters/cli/extract-asyncapi.d.ts +26 -0
- package/dist/adapters/cli/extract-asyncapi.d.ts.map +1 -0
- package/dist/adapters/cli/extract-asyncapi.js +142 -0
- package/dist/adapters/cli/extract-asyncapi.js.map +1 -0
- package/dist/adapters/cli/extract-component.d.ts +24 -0
- package/dist/adapters/cli/extract-component.d.ts.map +1 -0
- package/dist/adapters/cli/extract-component.js +198 -0
- package/dist/adapters/cli/extract-component.js.map +1 -0
- package/dist/adapters/cli/extract-detect.d.ts +19 -0
- package/dist/adapters/cli/extract-detect.d.ts.map +1 -0
- package/dist/adapters/cli/extract-detect.js +98 -0
- package/dist/adapters/cli/extract-detect.js.map +1 -0
- package/dist/adapters/cli/extract-openapi.d.ts +29 -0
- package/dist/adapters/cli/extract-openapi.d.ts.map +1 -0
- package/dist/adapters/cli/extract-openapi.js +111 -0
- package/dist/adapters/cli/extract-openapi.js.map +1 -0
- package/dist/adapters/cli/extract-schema.d.ts +15 -0
- package/dist/adapters/cli/extract-schema.d.ts.map +1 -0
- package/dist/adapters/cli/extract-schema.js +39 -0
- package/dist/adapters/cli/extract-schema.js.map +1 -0
- package/dist/adapters/cli/index.d.ts +6 -0
- package/dist/adapters/cli/index.d.ts.map +1 -0
- package/dist/adapters/cli/index.js +5 -0
- package/dist/adapters/cli/index.js.map +1 -0
- package/dist/adapters/cli/parse-args.d.ts +22 -0
- package/dist/adapters/cli/parse-args.d.ts.map +1 -0
- package/dist/adapters/cli/parse-args.js +63 -0
- package/dist/adapters/cli/parse-args.js.map +1 -0
- package/dist/adapters/mcp/index.d.ts +5 -0
- package/dist/adapters/mcp/index.d.ts.map +1 -0
- package/dist/adapters/mcp/index.js +2 -0
- package/dist/adapters/mcp/index.js.map +1 -0
- package/dist/bin/dev-tasks.d.ts +7 -0
- package/dist/bin/dev-tasks.d.ts.map +1 -0
- package/dist/bin/dev-tasks.js +275 -0
- package/dist/bin/dev-tasks.js.map +1 -0
- package/dist/bin/dt.d.ts +7 -0
- package/dist/bin/dt.d.ts.map +1 -0
- package/dist/bin/dt.js +159 -0
- package/dist/bin/dt.js.map +1 -0
- package/dist/core/catalog/index.d.ts +5 -0
- package/dist/core/catalog/index.d.ts.map +1 -0
- package/dist/core/catalog/index.js +2 -0
- package/dist/core/catalog/index.js.map +1 -0
- package/dist/core/context/index.d.ts +5 -0
- package/dist/core/context/index.d.ts.map +1 -0
- package/dist/core/context/index.js +2 -0
- package/dist/core/context/index.js.map +1 -0
- package/dist/core/distribution/backup.d.ts +24 -0
- package/dist/core/distribution/backup.d.ts.map +1 -0
- package/dist/core/distribution/backup.js +37 -0
- package/dist/core/distribution/backup.js.map +1 -0
- package/dist/core/distribution/doctor.d.ts +35 -0
- package/dist/core/distribution/doctor.d.ts.map +1 -0
- package/dist/core/distribution/doctor.js +158 -0
- package/dist/core/distribution/doctor.js.map +1 -0
- package/dist/core/distribution/hash.d.ts +14 -0
- package/dist/core/distribution/hash.d.ts.map +1 -0
- package/dist/core/distribution/hash.js +21 -0
- package/dist/core/distribution/hash.js.map +1 -0
- package/dist/core/distribution/index.d.ts +18 -0
- package/dist/core/distribution/index.d.ts.map +1 -0
- package/dist/core/distribution/index.js +12 -0
- package/dist/core/distribution/index.js.map +1 -0
- package/dist/core/distribution/install.d.ts +25 -0
- package/dist/core/distribution/install.d.ts.map +1 -0
- package/dist/core/distribution/install.js +81 -0
- package/dist/core/distribution/install.js.map +1 -0
- package/dist/core/distribution/manifest.d.ts +28 -0
- package/dist/core/distribution/manifest.d.ts.map +1 -0
- package/dist/core/distribution/manifest.js +38 -0
- package/dist/core/distribution/manifest.js.map +1 -0
- package/dist/core/distribution/migrate.d.ts +54 -0
- package/dist/core/distribution/migrate.d.ts.map +1 -0
- package/dist/core/distribution/migrate.js +200 -0
- package/dist/core/distribution/migrate.js.map +1 -0
- package/dist/core/distribution/pin.d.ts +15 -0
- package/dist/core/distribution/pin.d.ts.map +1 -0
- package/dist/core/distribution/pin.js +37 -0
- package/dist/core/distribution/pin.js.map +1 -0
- package/dist/core/distribution/status.d.ts +20 -0
- package/dist/core/distribution/status.d.ts.map +1 -0
- package/dist/core/distribution/status.js +39 -0
- package/dist/core/distribution/status.js.map +1 -0
- package/dist/core/distribution/update.d.ts +41 -0
- package/dist/core/distribution/update.d.ts.map +1 -0
- package/dist/core/distribution/update.js +148 -0
- package/dist/core/distribution/update.js.map +1 -0
- package/dist/core/exit-codes.d.ts +23 -0
- package/dist/core/exit-codes.d.ts.map +1 -0
- package/dist/core/exit-codes.js +22 -0
- package/dist/core/exit-codes.js.map +1 -0
- package/dist/core/extract/asyncapi/index.d.ts +11 -0
- package/dist/core/extract/asyncapi/index.d.ts.map +1 -0
- package/dist/core/extract/asyncapi/index.js +7 -0
- package/dist/core/extract/asyncapi/index.js.map +1 -0
- package/dist/core/extract/asyncapi/payloads.d.ts +20 -0
- package/dist/core/extract/asyncapi/payloads.d.ts.map +1 -0
- package/dist/core/extract/asyncapi/payloads.js +421 -0
- package/dist/core/extract/asyncapi/payloads.js.map +1 -0
- package/dist/core/extract/asyncapi/topics.d.ts +27 -0
- package/dist/core/extract/asyncapi/topics.d.ts.map +1 -0
- package/dist/core/extract/asyncapi/topics.js +368 -0
- package/dist/core/extract/asyncapi/topics.js.map +1 -0
- package/dist/core/extract/asyncapi/types.d.ts +129 -0
- package/dist/core/extract/asyncapi/types.d.ts.map +1 -0
- package/dist/core/extract/asyncapi/types.js +5 -0
- package/dist/core/extract/asyncapi/types.js.map +1 -0
- package/dist/core/extract/asyncapi/validate.d.ts +29 -0
- package/dist/core/extract/asyncapi/validate.d.ts.map +1 -0
- package/dist/core/extract/asyncapi/validate.js +156 -0
- package/dist/core/extract/asyncapi/validate.js.map +1 -0
- package/dist/core/extract/component.d.ts +201 -0
- package/dist/core/extract/component.d.ts.map +1 -0
- package/dist/core/extract/component.js +258 -0
- package/dist/core/extract/component.js.map +1 -0
- package/dist/core/extract/detect.d.ts +35 -0
- package/dist/core/extract/detect.d.ts.map +1 -0
- package/dist/core/extract/detect.js +89 -0
- package/dist/core/extract/detect.js.map +1 -0
- package/dist/core/extract/index.d.ts +12 -0
- package/dist/core/extract/index.d.ts.map +1 -0
- package/dist/core/extract/index.js +6 -0
- package/dist/core/extract/index.js.map +1 -0
- package/dist/core/extract/openapi/index.d.ts +13 -0
- package/dist/core/extract/openapi/index.d.ts.map +1 -0
- package/dist/core/extract/openapi/index.js +9 -0
- package/dist/core/extract/openapi/index.js.map +1 -0
- package/dist/core/extract/openapi/llm-descriptions.d.ts +41 -0
- package/dist/core/extract/openapi/llm-descriptions.d.ts.map +1 -0
- package/dist/core/extract/openapi/llm-descriptions.js +36 -0
- package/dist/core/extract/openapi/llm-descriptions.js.map +1 -0
- package/dist/core/extract/openapi/route1.d.ts +36 -0
- package/dist/core/extract/openapi/route1.d.ts.map +1 -0
- package/dist/core/extract/openapi/route1.js +327 -0
- package/dist/core/extract/openapi/route1.js.map +1 -0
- package/dist/core/extract/openapi/route2.d.ts +46 -0
- package/dist/core/extract/openapi/route2.d.ts.map +1 -0
- package/dist/core/extract/openapi/route2.js +19 -0
- package/dist/core/extract/openapi/route2.js.map +1 -0
- package/dist/core/extract/openapi/route3.d.ts +26 -0
- package/dist/core/extract/openapi/route3.d.ts.map +1 -0
- package/dist/core/extract/openapi/route3.js +737 -0
- package/dist/core/extract/openapi/route3.js.map +1 -0
- package/dist/core/extract/openapi/types.d.ts +125 -0
- package/dist/core/extract/openapi/types.d.ts.map +1 -0
- package/dist/core/extract/openapi/types.js +5 -0
- package/dist/core/extract/openapi/types.js.map +1 -0
- package/dist/core/extract/openapi/validate.d.ts +29 -0
- package/dist/core/extract/openapi/validate.d.ts.map +1 -0
- package/dist/core/extract/openapi/validate.js +200 -0
- package/dist/core/extract/openapi/validate.js.map +1 -0
- package/dist/core/extract/orm/drizzle.d.ts +20 -0
- package/dist/core/extract/orm/drizzle.d.ts.map +1 -0
- package/dist/core/extract/orm/drizzle.js +283 -0
- package/dist/core/extract/orm/drizzle.js.map +1 -0
- package/dist/core/extract/orm/information-schema.d.ts +26 -0
- package/dist/core/extract/orm/information-schema.d.ts.map +1 -0
- package/dist/core/extract/orm/information-schema.js +142 -0
- package/dist/core/extract/orm/information-schema.js.map +1 -0
- package/dist/core/extract/orm/llm-descriptions.d.ts +28 -0
- package/dist/core/extract/orm/llm-descriptions.d.ts.map +1 -0
- package/dist/core/extract/orm/llm-descriptions.js +64 -0
- package/dist/core/extract/orm/llm-descriptions.js.map +1 -0
- package/dist/core/extract/orm/migration-inference.d.ts +25 -0
- package/dist/core/extract/orm/migration-inference.d.ts.map +1 -0
- package/dist/core/extract/orm/migration-inference.js +76 -0
- package/dist/core/extract/orm/migration-inference.js.map +1 -0
- package/dist/core/extract/orm/prisma.d.ts +23 -0
- package/dist/core/extract/orm/prisma.d.ts.map +1 -0
- package/dist/core/extract/orm/prisma.js +234 -0
- package/dist/core/extract/orm/prisma.js.map +1 -0
- package/dist/core/extract/orm/typeorm.d.ts +22 -0
- package/dist/core/extract/orm/typeorm.d.ts.map +1 -0
- package/dist/core/extract/orm/typeorm.js +269 -0
- package/dist/core/extract/orm/typeorm.js.map +1 -0
- package/dist/core/extract/orm/types.d.ts +97 -0
- package/dist/core/extract/orm/types.d.ts.map +1 -0
- package/dist/core/extract/orm/types.js +6 -0
- package/dist/core/extract/orm/types.js.map +1 -0
- package/dist/core/extract/prompt.d.ts +21 -0
- package/dist/core/extract/prompt.d.ts.map +1 -0
- package/dist/core/extract/prompt.js +79 -0
- package/dist/core/extract/prompt.js.map +1 -0
- package/dist/core/extract/provider.d.ts +117 -0
- package/dist/core/extract/provider.d.ts.map +1 -0
- package/dist/core/extract/provider.js +6 -0
- package/dist/core/extract/provider.js.map +1 -0
- package/dist/core/extract/providers/node-ts.d.ts +69 -0
- package/dist/core/extract/providers/node-ts.d.ts.map +1 -0
- package/dist/core/extract/providers/node-ts.js +311 -0
- package/dist/core/extract/providers/node-ts.js.map +1 -0
- package/dist/core/extract/render/schema-md.d.ts +16 -0
- package/dist/core/extract/render/schema-md.d.ts.map +1 -0
- package/dist/core/extract/render/schema-md.js +140 -0
- package/dist/core/extract/render/schema-md.js.map +1 -0
- package/dist/core/extract/report.d.ts +97 -0
- package/dist/core/extract/report.d.ts.map +1 -0
- package/dist/core/extract/report.js +47 -0
- package/dist/core/extract/report.js.map +1 -0
- package/dist/core/extract/schema.d.ts +36 -0
- package/dist/core/extract/schema.d.ts.map +1 -0
- package/dist/core/extract/schema.js +141 -0
- package/dist/core/extract/schema.js.map +1 -0
- package/dist/core/index.d.ts +15 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +14 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/providers/index.d.ts +5 -0
- package/dist/core/providers/index.d.ts.map +1 -0
- package/dist/core/providers/index.js +2 -0
- package/dist/core/providers/index.js.map +1 -0
- package/dist/core/reconcile.d.ts +25 -0
- package/dist/core/reconcile.d.ts.map +1 -0
- package/dist/core/reconcile.js +36 -0
- package/dist/core/reconcile.js.map +1 -0
- package/dist/core/scope/index.d.ts +5 -0
- package/dist/core/scope/index.d.ts.map +1 -0
- package/dist/core/scope/index.js +2 -0
- package/dist/core/scope/index.js.map +1 -0
- package/package.json +77 -0
- package/schemas/.gitkeep +0 -0
- package/skills/.gitkeep +0 -0
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node/TypeScript extraction provider.
|
|
3
|
+
* Inspects package.json deps, directory structure, and config files to detect:
|
|
4
|
+
* - HTTP framework (nestjs, express, fastify, hono)
|
|
5
|
+
* - ORM (prisma, drizzle, typeorm)
|
|
6
|
+
* - Messaging (kafkajs)
|
|
7
|
+
*
|
|
8
|
+
* Reports openapi_strategy per the detection matrix (route 1/2/3)
|
|
9
|
+
* and per-strategy evidence count.
|
|
10
|
+
*
|
|
11
|
+
* Deterministic: pure config/file inspection, no LLM.
|
|
12
|
+
*/
|
|
13
|
+
import { readFileSync, existsSync } from "node:fs";
|
|
14
|
+
import { join } from "node:path";
|
|
15
|
+
/**
|
|
16
|
+
* Read and parse package.json from the given directory.
|
|
17
|
+
* Returns null if not found or invalid JSON.
|
|
18
|
+
*/
|
|
19
|
+
export function readPackageJson(rootDir) {
|
|
20
|
+
const pkgPath = join(rootDir, "package.json");
|
|
21
|
+
if (!existsSync(pkgPath)) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
const raw = readFileSync(pkgPath, "utf-8");
|
|
26
|
+
const pkg = JSON.parse(raw);
|
|
27
|
+
return {
|
|
28
|
+
dependencies: pkg.dependencies ?? {},
|
|
29
|
+
devDependencies: pkg.devDependencies ?? {},
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Check if a dependency exists in either dependencies or devDependencies.
|
|
38
|
+
*/
|
|
39
|
+
export function hasDep(deps, name) {
|
|
40
|
+
return name in deps.dependencies || name in deps.devDependencies;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Check if any dependency matching a prefix exists.
|
|
44
|
+
*/
|
|
45
|
+
export function hasDepPrefix(deps, prefix) {
|
|
46
|
+
const allDeps = { ...deps.dependencies, ...deps.devDependencies };
|
|
47
|
+
return Object.keys(allDeps).some((k) => k.startsWith(prefix));
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Detect HTTP framework from package.json dependencies.
|
|
51
|
+
*/
|
|
52
|
+
export function detectFramework(deps) {
|
|
53
|
+
// Priority order: nestjs > fastify > hono > express
|
|
54
|
+
if (hasDepPrefix(deps, "@nestjs/")) {
|
|
55
|
+
return {
|
|
56
|
+
framework: "nestjs",
|
|
57
|
+
dep: "@nestjs/core",
|
|
58
|
+
location: "package.json",
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
if (hasDep(deps, "fastify")) {
|
|
62
|
+
return {
|
|
63
|
+
framework: "fastify",
|
|
64
|
+
dep: "fastify",
|
|
65
|
+
location: "package.json",
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
if (hasDep(deps, "hono")) {
|
|
69
|
+
return {
|
|
70
|
+
framework: "hono",
|
|
71
|
+
dep: "hono",
|
|
72
|
+
location: "package.json",
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
if (hasDep(deps, "express")) {
|
|
76
|
+
return {
|
|
77
|
+
framework: "express",
|
|
78
|
+
dep: "express",
|
|
79
|
+
location: "package.json",
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Detect ORM from package.json dependencies and config file presence.
|
|
86
|
+
*/
|
|
87
|
+
export function detectOrm(deps, rootDir) {
|
|
88
|
+
// Check Prisma
|
|
89
|
+
if (hasDep(deps, "@prisma/client") || hasDep(deps, "prisma")) {
|
|
90
|
+
const schemaPath = findPrismaSchema(rootDir);
|
|
91
|
+
return {
|
|
92
|
+
kind: "prisma",
|
|
93
|
+
dep: "@prisma/client",
|
|
94
|
+
schemaPath,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
// Check Drizzle
|
|
98
|
+
if (hasDep(deps, "drizzle-orm") || hasDep(deps, "drizzle-kit")) {
|
|
99
|
+
const schemaPath = findDrizzleSchema(rootDir);
|
|
100
|
+
return {
|
|
101
|
+
kind: "drizzle",
|
|
102
|
+
dep: "drizzle-orm",
|
|
103
|
+
schemaPath,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
// Check TypeORM
|
|
107
|
+
if (hasDep(deps, "typeorm")) {
|
|
108
|
+
return {
|
|
109
|
+
kind: "typeorm",
|
|
110
|
+
dep: "typeorm",
|
|
111
|
+
schemaPath: null, // TypeORM uses decorator-based entities
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Find Prisma schema file.
|
|
118
|
+
*/
|
|
119
|
+
function findPrismaSchema(rootDir) {
|
|
120
|
+
const candidates = ["prisma/schema.prisma", "schema.prisma", "src/prisma/schema.prisma"];
|
|
121
|
+
for (const candidate of candidates) {
|
|
122
|
+
if (existsSync(join(rootDir, candidate))) {
|
|
123
|
+
return candidate;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Find Drizzle schema path from config or conventions.
|
|
130
|
+
*/
|
|
131
|
+
function findDrizzleSchema(rootDir) {
|
|
132
|
+
// Check drizzle.config.ts/js existence
|
|
133
|
+
const configCandidates = ["drizzle.config.ts", "drizzle.config.js", "drizzle.config.mjs"];
|
|
134
|
+
for (const candidate of configCandidates) {
|
|
135
|
+
if (existsSync(join(rootDir, candidate))) {
|
|
136
|
+
return candidate;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
// Check common schema locations
|
|
140
|
+
const schemaCandidates = ["src/db/schema.ts", "src/schema.ts", "db/schema.ts"];
|
|
141
|
+
for (const candidate of schemaCandidates) {
|
|
142
|
+
if (existsSync(join(rootDir, candidate))) {
|
|
143
|
+
return candidate;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Detect messaging client from package.json dependencies.
|
|
150
|
+
*/
|
|
151
|
+
export function detectMessaging(deps) {
|
|
152
|
+
if (hasDep(deps, "kafkajs")) {
|
|
153
|
+
return { client: "kafkajs", dep: "kafkajs" };
|
|
154
|
+
}
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
// --- OpenAPI strategy detection ---
|
|
158
|
+
/**
|
|
159
|
+
* Determine OpenAPI strategy based on framework detection and available signals.
|
|
160
|
+
*/
|
|
161
|
+
export function detectOpenApiStrategy(framework, deps, rootDir) {
|
|
162
|
+
const counts = { route1: 0, route2: 0, route3: 0 };
|
|
163
|
+
const evidence = [];
|
|
164
|
+
// Route 1: check for on-disk OpenAPI spec
|
|
165
|
+
const openapiFiles = [
|
|
166
|
+
"openapi.yaml",
|
|
167
|
+
"openapi.yml",
|
|
168
|
+
"openapi.json",
|
|
169
|
+
"swagger.yaml",
|
|
170
|
+
"swagger.yml",
|
|
171
|
+
"swagger.json",
|
|
172
|
+
"docs/openapi.yaml",
|
|
173
|
+
"docs/openapi.yml",
|
|
174
|
+
"docs/openapi.json",
|
|
175
|
+
];
|
|
176
|
+
for (const file of openapiFiles) {
|
|
177
|
+
if (existsSync(join(rootDir, file))) {
|
|
178
|
+
counts.route1++;
|
|
179
|
+
evidence.push({
|
|
180
|
+
signal: "openapi_spec_file",
|
|
181
|
+
location: file,
|
|
182
|
+
detail: "On-disk OpenAPI specification found",
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
// Route 1 also: NestJS + @nestjs/swagger → can generate spec at build time
|
|
187
|
+
if (framework === "nestjs" && hasDep(deps, "@nestjs/swagger")) {
|
|
188
|
+
counts.route1++;
|
|
189
|
+
evidence.push({
|
|
190
|
+
signal: "@nestjs/swagger",
|
|
191
|
+
location: "package.json",
|
|
192
|
+
detail: "NestJS Swagger module — spec available at runtime/build",
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
// Route 3: AST-based route discovery (always available for known frameworks)
|
|
196
|
+
if (framework) {
|
|
197
|
+
counts.route3++;
|
|
198
|
+
evidence.push({
|
|
199
|
+
signal: `${framework}_routes`,
|
|
200
|
+
location: "source files",
|
|
201
|
+
detail: `AST route discovery available for ${framework}`,
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
// Determine primary strategy
|
|
205
|
+
let strategy;
|
|
206
|
+
if (counts.route1 > 0) {
|
|
207
|
+
strategy = "route1";
|
|
208
|
+
}
|
|
209
|
+
else if (counts.route3 > 0) {
|
|
210
|
+
strategy = "route3";
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
strategy = "route3"; // Default for known frameworks
|
|
214
|
+
}
|
|
215
|
+
return { strategy, counts, evidence };
|
|
216
|
+
}
|
|
217
|
+
// --- Provider implementation ---
|
|
218
|
+
/**
|
|
219
|
+
* Node/TypeScript extraction provider.
|
|
220
|
+
*/
|
|
221
|
+
export const nodeTsProvider = {
|
|
222
|
+
id: "node-ts",
|
|
223
|
+
capabilities: [
|
|
224
|
+
"openapi_native",
|
|
225
|
+
"openapi_ast",
|
|
226
|
+
"orm_ast",
|
|
227
|
+
"topic_ast",
|
|
228
|
+
"payload_typed",
|
|
229
|
+
],
|
|
230
|
+
detect(repo) {
|
|
231
|
+
const deps = readPackageJson(repo.rootDir);
|
|
232
|
+
if (!deps) {
|
|
233
|
+
return null;
|
|
234
|
+
}
|
|
235
|
+
// Must have TypeScript or be a Node project
|
|
236
|
+
const isNode = hasDep(deps, "typescript") ||
|
|
237
|
+
hasDepPrefix(deps, "@types/") ||
|
|
238
|
+
Object.keys(deps.dependencies).length > 0 ||
|
|
239
|
+
Object.keys(deps.devDependencies).length > 0;
|
|
240
|
+
if (!isNode) {
|
|
241
|
+
return null;
|
|
242
|
+
}
|
|
243
|
+
// Detect stack components
|
|
244
|
+
const frameworkSignal = detectFramework(deps);
|
|
245
|
+
const ormSignal = detectOrm(deps, repo.rootDir);
|
|
246
|
+
const messagingSignal = detectMessaging(deps);
|
|
247
|
+
// If no framework, ORM, or messaging, this is a plain Node project — still valid
|
|
248
|
+
const stack = ["node"];
|
|
249
|
+
if (hasDep(deps, "typescript") || hasDepPrefix(deps, "@types/")) {
|
|
250
|
+
stack.push("typescript");
|
|
251
|
+
}
|
|
252
|
+
// Build detection sections
|
|
253
|
+
let http = null;
|
|
254
|
+
if (frameworkSignal) {
|
|
255
|
+
stack.push(frameworkSignal.framework);
|
|
256
|
+
const openApiDetection = detectOpenApiStrategy(frameworkSignal.framework, deps, repo.rootDir);
|
|
257
|
+
http = {
|
|
258
|
+
framework: frameworkSignal.framework,
|
|
259
|
+
openapi_strategy: openApiDetection.strategy,
|
|
260
|
+
strategy_counts: openApiDetection.counts,
|
|
261
|
+
evidence: [
|
|
262
|
+
{
|
|
263
|
+
signal: frameworkSignal.dep,
|
|
264
|
+
location: frameworkSignal.location,
|
|
265
|
+
},
|
|
266
|
+
...openApiDetection.evidence,
|
|
267
|
+
],
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
let orm = null;
|
|
271
|
+
if (ormSignal) {
|
|
272
|
+
stack.push(ormSignal.kind);
|
|
273
|
+
orm = {
|
|
274
|
+
kind: ormSignal.kind,
|
|
275
|
+
schema_path: ormSignal.schemaPath,
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
let messaging = null;
|
|
279
|
+
if (messagingSignal) {
|
|
280
|
+
stack.push(messagingSignal.client);
|
|
281
|
+
messaging = {
|
|
282
|
+
client: messagingSignal.client,
|
|
283
|
+
evidence: [
|
|
284
|
+
{
|
|
285
|
+
signal: messagingSignal.dep,
|
|
286
|
+
location: "package.json",
|
|
287
|
+
},
|
|
288
|
+
],
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
// Build type_hint
|
|
292
|
+
const hintParts = ["node"];
|
|
293
|
+
if (frameworkSignal)
|
|
294
|
+
hintParts.push(frameworkSignal.framework);
|
|
295
|
+
if (ormSignal)
|
|
296
|
+
hintParts.push(ormSignal.kind);
|
|
297
|
+
if (messagingSignal)
|
|
298
|
+
hintParts.push(messagingSignal.client);
|
|
299
|
+
if (hintParts.length === 1)
|
|
300
|
+
hintParts.push("ts-no-framework");
|
|
301
|
+
const type_hint = hintParts.join("-");
|
|
302
|
+
return {
|
|
303
|
+
stack,
|
|
304
|
+
http,
|
|
305
|
+
orm,
|
|
306
|
+
messaging,
|
|
307
|
+
type_hint,
|
|
308
|
+
};
|
|
309
|
+
},
|
|
310
|
+
};
|
|
311
|
+
//# sourceMappingURL=node-ts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-ts.js","sourceRoot":"","sources":["../../../../core/extract/providers/node-ts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAoBjC;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,OAAe;IAC7C,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IAC9C,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC3C,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAA4B,CAAC;QACvD,OAAO;YACL,YAAY,EAAG,GAAG,CAAC,YAAuC,IAAI,EAAE;YAChE,eAAe,EAAG,GAAG,CAAC,eAA0C,IAAI,EAAE;SACvE,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,MAAM,CAAC,IAAiB,EAAE,IAAY;IACpD,OAAO,IAAI,IAAI,IAAI,CAAC,YAAY,IAAI,IAAI,IAAI,IAAI,CAAC,eAAe,CAAC;AACnE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,IAAiB,EAAE,MAAc;IAC5D,MAAM,OAAO,GAAG,EAAE,GAAG,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CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* schema.md renderer.
|
|
3
|
+
* Renders extracted schema as a Markdown document with:
|
|
4
|
+
* - Table listings with columns (type + nullability + constraints)
|
|
5
|
+
* - PK/FK indicators
|
|
6
|
+
* - Indexes
|
|
7
|
+
* - Mermaid ER diagram
|
|
8
|
+
* - Enums
|
|
9
|
+
* - Provenance metadata
|
|
10
|
+
*/
|
|
11
|
+
import type { SchemaExtractionResult } from "../orm/types.js";
|
|
12
|
+
/**
|
|
13
|
+
* Render a schema extraction result as a Markdown document.
|
|
14
|
+
*/
|
|
15
|
+
export declare function renderSchemaMd(schema: SchemaExtractionResult): string;
|
|
16
|
+
//# sourceMappingURL=schema-md.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-md.d.ts","sourceRoot":"","sources":["../../../../core/extract/render/schema-md.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAA+B,MAAM,iBAAiB,CAAC;AAE3F;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,sBAAsB,GAAG,MAAM,CAmCrE"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* schema.md renderer.
|
|
3
|
+
* Renders extracted schema as a Markdown document with:
|
|
4
|
+
* - Table listings with columns (type + nullability + constraints)
|
|
5
|
+
* - PK/FK indicators
|
|
6
|
+
* - Indexes
|
|
7
|
+
* - Mermaid ER diagram
|
|
8
|
+
* - Enums
|
|
9
|
+
* - Provenance metadata
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Render a schema extraction result as a Markdown document.
|
|
13
|
+
*/
|
|
14
|
+
export function renderSchemaMd(schema) {
|
|
15
|
+
const lines = [];
|
|
16
|
+
lines.push("# Database Schema");
|
|
17
|
+
lines.push("");
|
|
18
|
+
lines.push(`> Source: \`${schema.source}\` | ORM: \`${schema.orm}\` | Confidence: \`${schema.confidence}\``);
|
|
19
|
+
lines.push("");
|
|
20
|
+
// Mermaid ER diagram
|
|
21
|
+
lines.push("## Entity Relationship Diagram");
|
|
22
|
+
lines.push("");
|
|
23
|
+
lines.push(renderMermaidDiagram(schema));
|
|
24
|
+
lines.push("");
|
|
25
|
+
// Tables
|
|
26
|
+
for (const table of schema.tables) {
|
|
27
|
+
lines.push(renderTable(table));
|
|
28
|
+
lines.push("");
|
|
29
|
+
}
|
|
30
|
+
// Enums
|
|
31
|
+
if (schema.enums.length > 0) {
|
|
32
|
+
lines.push("## Enums");
|
|
33
|
+
lines.push("");
|
|
34
|
+
for (const enumDef of schema.enums) {
|
|
35
|
+
lines.push(`### ${enumDef.name}`);
|
|
36
|
+
lines.push("");
|
|
37
|
+
lines.push(`Values: \`${enumDef.values.join("`, `")}\``);
|
|
38
|
+
lines.push("");
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return lines.join("\n");
|
|
42
|
+
}
|
|
43
|
+
// --- Table rendering ---
|
|
44
|
+
function renderTable(table) {
|
|
45
|
+
const lines = [];
|
|
46
|
+
lines.push(`## ${table.name}`);
|
|
47
|
+
lines.push("");
|
|
48
|
+
if (table.description) {
|
|
49
|
+
lines.push(table.description);
|
|
50
|
+
lines.push("");
|
|
51
|
+
}
|
|
52
|
+
// Columns table
|
|
53
|
+
lines.push("| Column | Type | Nullable | Key | Default |");
|
|
54
|
+
lines.push("|--------|------|----------|-----|---------|");
|
|
55
|
+
for (const col of table.columns) {
|
|
56
|
+
const key = getKeyIndicator(col.name, col.primaryKey, col.unique, table.relations);
|
|
57
|
+
const nullable = col.nullable ? "YES" : "NO";
|
|
58
|
+
const defaultVal = col.defaultValue ?? "";
|
|
59
|
+
lines.push(`| ${col.name} | ${col.type} | ${nullable} | ${key} | ${defaultVal} |`);
|
|
60
|
+
}
|
|
61
|
+
lines.push("");
|
|
62
|
+
// Relations
|
|
63
|
+
if (table.relations.length > 0) {
|
|
64
|
+
lines.push("**Relations:**");
|
|
65
|
+
lines.push("");
|
|
66
|
+
for (const rel of table.relations) {
|
|
67
|
+
const fields = rel.sourceFields.length > 0
|
|
68
|
+
? ` (${rel.sourceFields.join(", ")} → ${rel.target}.${rel.targetFields.join(", ")})`
|
|
69
|
+
: ` → ${rel.target}`;
|
|
70
|
+
lines.push(`- \`${rel.name}\`: ${rel.type}${fields}`);
|
|
71
|
+
}
|
|
72
|
+
lines.push("");
|
|
73
|
+
}
|
|
74
|
+
// Indexes
|
|
75
|
+
if (table.indexes.length > 0) {
|
|
76
|
+
lines.push("**Indexes:**");
|
|
77
|
+
lines.push("");
|
|
78
|
+
for (const idx of table.indexes) {
|
|
79
|
+
const uniqueLabel = idx.unique ? " (unique)" : "";
|
|
80
|
+
const name = idx.name ? `\`${idx.name}\`` : "";
|
|
81
|
+
lines.push(`- ${name} [${idx.columns.join(", ")}]${uniqueLabel}`);
|
|
82
|
+
}
|
|
83
|
+
lines.push("");
|
|
84
|
+
}
|
|
85
|
+
return lines.join("\n");
|
|
86
|
+
}
|
|
87
|
+
function getKeyIndicator(colName, isPk, isUnique, relations) {
|
|
88
|
+
const parts = [];
|
|
89
|
+
if (isPk)
|
|
90
|
+
parts.push("PK");
|
|
91
|
+
// Check if this column is a FK source
|
|
92
|
+
const isFk = relations.some((r) => r.sourceFields.includes(colName));
|
|
93
|
+
if (isFk)
|
|
94
|
+
parts.push("FK");
|
|
95
|
+
if (isUnique && !isPk)
|
|
96
|
+
parts.push("UQ");
|
|
97
|
+
return parts.join(", ");
|
|
98
|
+
}
|
|
99
|
+
// --- Mermaid diagram ---
|
|
100
|
+
function renderMermaidDiagram(schema) {
|
|
101
|
+
const lines = [];
|
|
102
|
+
lines.push("```mermaid");
|
|
103
|
+
lines.push("erDiagram");
|
|
104
|
+
// Render tables with their columns
|
|
105
|
+
for (const table of schema.tables) {
|
|
106
|
+
lines.push(` ${sanitizeMermaidName(table.name)} {`);
|
|
107
|
+
for (const col of table.columns) {
|
|
108
|
+
const pk = col.primaryKey ? " PK" : "";
|
|
109
|
+
const fk = table.relations.some((r) => r.sourceFields.includes(col.name)) ? " FK" : "";
|
|
110
|
+
lines.push(` ${col.type} ${col.name}${pk}${fk}`);
|
|
111
|
+
}
|
|
112
|
+
lines.push(" }");
|
|
113
|
+
}
|
|
114
|
+
// Render relationships
|
|
115
|
+
for (const table of schema.tables) {
|
|
116
|
+
for (const rel of table.relations) {
|
|
117
|
+
const mermaidRel = getMermaidRelation(rel.type);
|
|
118
|
+
lines.push(` ${sanitizeMermaidName(table.name)} ${mermaidRel} ${sanitizeMermaidName(rel.target)} : "${rel.name}"`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
lines.push("```");
|
|
122
|
+
return lines.join("\n");
|
|
123
|
+
}
|
|
124
|
+
function getMermaidRelation(type) {
|
|
125
|
+
switch (type) {
|
|
126
|
+
case "one-to-one":
|
|
127
|
+
return "||--||";
|
|
128
|
+
case "one-to-many":
|
|
129
|
+
return "||--o{";
|
|
130
|
+
case "many-to-one":
|
|
131
|
+
return "}o--||";
|
|
132
|
+
case "many-to-many":
|
|
133
|
+
return "}o--o{";
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
function sanitizeMermaidName(name) {
|
|
137
|
+
// Mermaid doesn't like special characters in entity names
|
|
138
|
+
return name.replace(/[^a-zA-Z0-9_]/g, "_");
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=schema-md.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-md.js","sourceRoot":"","sources":["../../../../core/extract/render/schema-md.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,MAA8B;IAC3D,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IAChC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK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G,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;QAC1D,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACtB,CAAC;IAED,uBAAuB;IACvB,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAClC,KAAK,MAAM,GAAG,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;YAClC,MAAM,UAAU,GAAG,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAChD,KAAK,CAAC,IAAI,CACR,OAAO,mBAAmB,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,UAAU,IAAI,mBAAmB,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,GAAG,CAAC,IAAI,GAAG,CAC1G,CAAC;QACJ,CAAC;IACH,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAElB,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,SAAS,kBAAkB,CAAC,IAA4B;IACtD,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,YAAY;YACf,OAAO,QAAQ,CAAC;QAClB,KAAK,aAAa;YAChB,OAAO,QAAQ,CAAC;QAClB,KAAK,aAAa;YAChB,OAAO,QAAQ,CAAC;QAClB,KAAK,cAAc;YACjB,OAAO,QAAQ,CAAC;IACpB,CAAC;AACH,CAAC;AAED,SAAS,mBAAmB,CAAC,IAAY;IACvC,0DAA0D;IAC1D,OAAO,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extraction report generation.
|
|
3
|
+
* Produces extraction_report.json alongside component.yaml.
|
|
4
|
+
*
|
|
5
|
+
* Reports: strategies used, coverage (endpoints/topics/tables resolved vs unresolved),
|
|
6
|
+
* confidence counts, unresolved[] with location + reason, requires_human[].
|
|
7
|
+
*/
|
|
8
|
+
import type { Confidence } from "./component.js";
|
|
9
|
+
/**
|
|
10
|
+
* Strategy info for the report.
|
|
11
|
+
*/
|
|
12
|
+
export interface StrategyEntry {
|
|
13
|
+
stage: string;
|
|
14
|
+
strategy: string;
|
|
15
|
+
source: string;
|
|
16
|
+
confidence: Confidence;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Coverage metrics for the report.
|
|
20
|
+
*/
|
|
21
|
+
export interface CoverageMetrics {
|
|
22
|
+
endpoints: {
|
|
23
|
+
resolved: number;
|
|
24
|
+
unresolved: number;
|
|
25
|
+
total: number;
|
|
26
|
+
};
|
|
27
|
+
topics: {
|
|
28
|
+
resolved: number;
|
|
29
|
+
unresolved: number;
|
|
30
|
+
total: number;
|
|
31
|
+
};
|
|
32
|
+
tables: {
|
|
33
|
+
resolved: number;
|
|
34
|
+
unresolved: number;
|
|
35
|
+
total: number;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Unresolved item in the report.
|
|
40
|
+
*/
|
|
41
|
+
export interface UnresolvedItem {
|
|
42
|
+
stage: string;
|
|
43
|
+
type: string;
|
|
44
|
+
location: string;
|
|
45
|
+
reason: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Entry requiring human input.
|
|
49
|
+
*/
|
|
50
|
+
export interface RequiresHumanItem {
|
|
51
|
+
field: string;
|
|
52
|
+
reason: string;
|
|
53
|
+
category: "non-derivable" | "unconfirmed-inference" | "missing-capability";
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Confidence distribution.
|
|
57
|
+
*/
|
|
58
|
+
export interface ConfidenceCounts {
|
|
59
|
+
high: number;
|
|
60
|
+
medium: number;
|
|
61
|
+
low: number;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* The full extraction report.
|
|
65
|
+
*/
|
|
66
|
+
export interface ExtractionReport {
|
|
67
|
+
generated_at: string;
|
|
68
|
+
strategies: StrategyEntry[];
|
|
69
|
+
coverage: CoverageMetrics;
|
|
70
|
+
confidence_counts: ConfidenceCounts;
|
|
71
|
+
unresolved: UnresolvedItem[];
|
|
72
|
+
requires_human: RequiresHumanItem[];
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Inputs for building the extraction report.
|
|
76
|
+
*/
|
|
77
|
+
export interface ReportInputs {
|
|
78
|
+
strategies: StrategyEntry[];
|
|
79
|
+
endpointsResolved: number;
|
|
80
|
+
endpointsUnresolved: number;
|
|
81
|
+
topicsResolved: number;
|
|
82
|
+
topicsUnresolved: number;
|
|
83
|
+
tablesResolved: number;
|
|
84
|
+
tablesUnresolved: number;
|
|
85
|
+
unresolved: UnresolvedItem[];
|
|
86
|
+
requiresHuman: RequiresHumanItem[];
|
|
87
|
+
confidenceEntries: Confidence[];
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Build an extraction report from inputs.
|
|
91
|
+
*/
|
|
92
|
+
export declare function buildExtractionReport(inputs: ReportInputs): ExtractionReport;
|
|
93
|
+
/**
|
|
94
|
+
* Serialize the report to JSON string.
|
|
95
|
+
*/
|
|
96
|
+
export declare function serializeReport(report: ExtractionReport): string;
|
|
97
|
+
//# sourceMappingURL=report.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../../core/extract/report.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,UAAU,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE;QAAE,QAAQ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gB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,cAAc,EAAE,CAAC;IAC7B,aAAa,EAAE,iBAAiB,EAAE,CAAC;IACnC,iBAAiB,EAAE,UAAU,EAAE,CAAC;CACjC;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,YAAY,GAAG,gBAAgB,CA+B5E;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAEhE"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extraction report generation.
|
|
3
|
+
* Produces extraction_report.json alongside component.yaml.
|
|
4
|
+
*
|
|
5
|
+
* Reports: strategies used, coverage (endpoints/topics/tables resolved vs unresolved),
|
|
6
|
+
* confidence counts, unresolved[] with location + reason, requires_human[].
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Build an extraction report from inputs.
|
|
10
|
+
*/
|
|
11
|
+
export function buildExtractionReport(inputs) {
|
|
12
|
+
const confidenceCounts = { high: 0, medium: 0, low: 0 };
|
|
13
|
+
for (const c of inputs.confidenceEntries) {
|
|
14
|
+
confidenceCounts[c]++;
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
generated_at: new Date().toISOString(),
|
|
18
|
+
strategies: inputs.strategies,
|
|
19
|
+
coverage: {
|
|
20
|
+
endpoints: {
|
|
21
|
+
resolved: inputs.endpointsResolved,
|
|
22
|
+
unresolved: inputs.endpointsUnresolved,
|
|
23
|
+
total: inputs.endpointsResolved + inputs.endpointsUnresolved,
|
|
24
|
+
},
|
|
25
|
+
topics: {
|
|
26
|
+
resolved: inputs.topicsResolved,
|
|
27
|
+
unresolved: inputs.topicsUnresolved,
|
|
28
|
+
total: inputs.topicsResolved + inputs.topicsUnresolved,
|
|
29
|
+
},
|
|
30
|
+
tables: {
|
|
31
|
+
resolved: inputs.tablesResolved,
|
|
32
|
+
unresolved: inputs.tablesUnresolved,
|
|
33
|
+
total: inputs.tablesResolved + inputs.tablesUnresolved,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
confidence_counts: confidenceCounts,
|
|
37
|
+
unresolved: inputs.unresolved,
|
|
38
|
+
requires_human: inputs.requiresHuman,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Serialize the report to JSON string.
|
|
43
|
+
*/
|
|
44
|
+
export function serializeReport(report) {
|
|
45
|
+
return JSON.stringify(report, null, 2);
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=report.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report.js","sourceRoot":"","sources":["../../../core/extract/report.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA+EH;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAoB;IACxD,MAAM,gBAAgB,GAAqB,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;IAE1E,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,iBAAiB,EAAE,CAAC;QACzC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;IACxB,CAAC;IAED,OAAO;QACL,YAAY,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACtC,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,QAAQ,EAAE;YACR,SAAS,EAAE;gBACT,QAAQ,EAAE,MAAM,CAAC,iBAAiB;gBAClC,UAAU,EAAE,MAAM,CAAC,mBAAmB;gBACtC,KAAK,EAAE,MAAM,CAAC,iBAAiB,GAAG,MAAM,CAAC,mBAAmB;aAC7D;YACD,MAAM,EAAE;gBACN,QAAQ,EAAE,MAAM,CAAC,cAAc;gBAC/B,UAAU,EAAE,MAAM,CAAC,gBAAgB;gBACnC,KAAK,EAAE,MAAM,CAAC,c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