@llipe.com/dev-tasks 0.8.0 → 0.9.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/.claude/agents/developer.md +16 -11
- package/.claude/agents/qa-engineer.md +104 -0
- package/.claude/agents/verifier.md +1 -1
- package/.claude/commands/developer.md +14 -10
- package/.claude/commands/planner.md +10 -8
- package/.claude/commands/qa-engineer.md +23 -0
- package/.claude/skills/activity-coverage-gap-analysis/SKILL.md +107 -0
- package/.claude/skills/activity-test-implementation/SKILL.md +109 -0
- package/.claude/skills/activity-test-standards/SKILL.md +122 -0
- package/.claude/skills/implement/SKILL.md +14 -12
- package/.github/agents/developer.agent.md +16 -11
- package/.github/agents/planner.agent.md +10 -8
- package/.github/agents/qa-engineer.agent.md +104 -0
- package/.github/agents/verifier.agent.md +1 -1
- package/.github/instructions/implement.instructions.md +14 -12
- package/.github/prompts/qa-engineer.prompt.md +23 -0
- package/.github/skills/activity-coverage-gap-analysis/SKILL.md +107 -0
- package/.github/skills/activity-test-implementation/SKILL.md +109 -0
- package/.github/skills/activity-test-standards/SKILL.md +122 -0
- package/.kiro/agents/developer.md +16 -11
- package/.kiro/agents/planner.md +10 -8
- package/.kiro/agents/qa-engineer.md +108 -0
- package/.kiro/agents/verifier.md +1 -1
- package/.kiro/skills/activity-coverage-gap-analysis/SKILL.md +107 -0
- package/.kiro/skills/activity-test-implementation/SKILL.md +109 -0
- package/.kiro/skills/activity-test-standards/SKILL.md +122 -0
- package/.kiro/steering/implement.md +14 -12
- package/AGENTS.md +50 -23
- package/CHANGELOG.md +56 -0
- package/CLAUDE.md +6 -3
- package/README.md +108 -112
- package/TESTING.md +183 -0
- package/bundle-manifest.json +1 -0
- package/dist/core/distribution/install.d.ts.map +1 -1
- package/dist/core/distribution/install.js +25 -2
- package/dist/core/distribution/install.js.map +1 -1
- package/dist/core/distribution/profiles.d.ts +21 -0
- package/dist/core/distribution/profiles.d.ts.map +1 -1
- package/dist/core/distribution/profiles.js +21 -0
- package/dist/core/distribution/profiles.js.map +1 -1
- package/dist/core/distribution/update.d.ts +3 -0
- package/dist/core/distribution/update.d.ts.map +1 -1
- package/dist/core/distribution/update.js +141 -15
- package/dist/core/distribution/update.js.map +1 -1
- package/dist/core/extract/asyncapi/declared.d.ts +19 -0
- package/dist/core/extract/asyncapi/declared.d.ts.map +1 -0
- package/dist/core/extract/asyncapi/declared.js +168 -0
- package/dist/core/extract/asyncapi/declared.js.map +1 -0
- package/dist/core/extract/asyncapi/index.d.ts +1 -0
- package/dist/core/extract/asyncapi/index.d.ts.map +1 -1
- package/dist/core/extract/asyncapi/index.js +1 -0
- package/dist/core/extract/asyncapi/index.js.map +1 -1
- package/dist/core/extract/asyncapi/types.d.ts +1 -1
- package/dist/core/extract/asyncapi/types.d.ts.map +1 -1
- package/dist/core/extract/ladder.d.ts +79 -0
- package/dist/core/extract/ladder.d.ts.map +1 -0
- package/dist/core/extract/ladder.js +70 -0
- package/dist/core/extract/ladder.js.map +1 -0
- package/dist/core/extract/openapi/index.d.ts +35 -5
- package/dist/core/extract/openapi/index.d.ts.map +1 -1
- package/dist/core/extract/openapi/index.js +136 -3
- package/dist/core/extract/openapi/index.js.map +1 -1
- package/dist/core/extract/openapi/route2-introspect.d.ts +18 -0
- package/dist/core/extract/openapi/route2-introspect.d.ts.map +1 -0
- package/dist/core/extract/openapi/route2-introspect.js +249 -0
- package/dist/core/extract/openapi/route2-introspect.js.map +1 -0
- package/dist/core/extract/openapi/route2.d.ts +40 -17
- package/dist/core/extract/openapi/route2.d.ts.map +1 -1
- package/dist/core/extract/openapi/route2.js +202 -10
- package/dist/core/extract/openapi/route2.js.map +1 -1
- package/dist/core/extract/openapi/types.d.ts +3 -3
- package/dist/core/extract/openapi/types.d.ts.map +1 -1
- package/dist/core/extract/provider.d.ts +4 -0
- package/dist/core/extract/provider.d.ts.map +1 -1
- package/dist/core/extract/report.d.ts +29 -1
- package/dist/core/extract/report.d.ts.map +1 -1
- package/dist/core/extract/report.js +7 -2
- package/dist/core/extract/report.js.map +1 -1
- package/dist/core/extract/schema.d.ts +16 -18
- package/dist/core/extract/schema.d.ts.map +1 -1
- package/dist/core/extract/schema.js +48 -43
- package/dist/core/extract/schema.js.map +1 -1
- package/dist/core/extract/workspaces.d.ts +33 -0
- package/dist/core/extract/workspaces.d.ts.map +1 -0
- package/dist/core/extract/workspaces.js +193 -0
- package/dist/core/extract/workspaces.js.map +1 -0
- package/package.json +11 -2
- package/dist/core/extract/openapi/llm-descriptions.d.ts +0 -41
- package/dist/core/extract/openapi/llm-descriptions.d.ts.map +0 -1
- package/dist/core/extract/openapi/llm-descriptions.js +0 -36
- package/dist/core/extract/openapi/llm-descriptions.js.map +0 -1
- package/dist/core/extract/orm/llm-descriptions.d.ts +0 -28
- package/dist/core/extract/orm/llm-descriptions.d.ts.map +0 -1
- package/dist/core/extract/orm/llm-descriptions.js +0 -64
- package/dist/core/extract/orm/llm-descriptions.js.map +0 -1
- package/dist/core/extract/orm/migration-inference.d.ts +0 -25
- package/dist/core/extract/orm/migration-inference.d.ts.map +0 -1
- package/dist/core/extract/orm/migration-inference.js +0 -76
- package/dist/core/extract/orm/migration-inference.js.map +0 -1
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace-aware component discovery.
|
|
3
|
+
*
|
|
4
|
+
* Discovers workspace packages in monorepos (pnpm, npm/yarn workspaces)
|
|
5
|
+
* and returns them as component roots for per-package extraction.
|
|
6
|
+
*
|
|
7
|
+
* Falls back to treating the repository root as a single component
|
|
8
|
+
* when no workspace configuration is found.
|
|
9
|
+
*/
|
|
10
|
+
import { readFileSync, existsSync, readdirSync, statSync } from "node:fs";
|
|
11
|
+
import { resolve, join, relative } from "node:path";
|
|
12
|
+
/**
|
|
13
|
+
* Discover components (workspace packages) in a repository.
|
|
14
|
+
*
|
|
15
|
+
* Resolution order:
|
|
16
|
+
* 1. pnpm-workspace.yaml globs
|
|
17
|
+
* 2. package.json `workspaces` field (npm/yarn)
|
|
18
|
+
* 3. Fallback: single component at rootDir
|
|
19
|
+
*
|
|
20
|
+
* Deterministic ordering: alphabetical by resolved path.
|
|
21
|
+
* Workspace root is excluded when it declares no runtime dependencies.
|
|
22
|
+
*/
|
|
23
|
+
export function discoverComponents(rootDir) {
|
|
24
|
+
// Try pnpm workspace first
|
|
25
|
+
const pnpmWorkspaces = discoverPnpmWorkspaces(rootDir);
|
|
26
|
+
if (pnpmWorkspaces.length > 0) {
|
|
27
|
+
return filterAndSort(rootDir, pnpmWorkspaces);
|
|
28
|
+
}
|
|
29
|
+
// Try npm/yarn workspaces
|
|
30
|
+
const npmWorkspaces = discoverNpmWorkspaces(rootDir);
|
|
31
|
+
if (npmWorkspaces.length > 0) {
|
|
32
|
+
return filterAndSort(rootDir, npmWorkspaces);
|
|
33
|
+
}
|
|
34
|
+
// Fallback: single package at root
|
|
35
|
+
const rootPkg = readPackageJson(rootDir);
|
|
36
|
+
if (rootPkg) {
|
|
37
|
+
return [
|
|
38
|
+
{
|
|
39
|
+
path: rootDir,
|
|
40
|
+
name: rootPkg.name || relative(resolve(rootDir, ".."), rootDir),
|
|
41
|
+
packageJson: rootPkg,
|
|
42
|
+
},
|
|
43
|
+
];
|
|
44
|
+
}
|
|
45
|
+
return [{ path: rootDir, name: "unknown", packageJson: {} }];
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Discover packages from pnpm-workspace.yaml.
|
|
49
|
+
*/
|
|
50
|
+
function discoverPnpmWorkspaces(rootDir) {
|
|
51
|
+
const workspaceFile = join(rootDir, "pnpm-workspace.yaml");
|
|
52
|
+
if (!existsSync(workspaceFile))
|
|
53
|
+
return [];
|
|
54
|
+
const content = readFileSync(workspaceFile, "utf-8");
|
|
55
|
+
// Simple YAML parsing for the packages field
|
|
56
|
+
// Handles: packages:\n - "glob"\n - 'glob'\n - glob
|
|
57
|
+
const packagesMatch = content.match(/packages:\s*\n((?:\s+-\s+.+\n?)*)/);
|
|
58
|
+
if (!packagesMatch)
|
|
59
|
+
return [];
|
|
60
|
+
const globs = [];
|
|
61
|
+
const lines = packagesMatch[1].split("\n");
|
|
62
|
+
for (const line of lines) {
|
|
63
|
+
const match = line.match(/^\s+-\s+["']?([^"'\n]+?)["']?\s*$/);
|
|
64
|
+
if (match) {
|
|
65
|
+
globs.push(match[1]);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return resolveGlobs(rootDir, globs);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Discover packages from package.json workspaces field.
|
|
72
|
+
*/
|
|
73
|
+
function discoverNpmWorkspaces(rootDir) {
|
|
74
|
+
const pkg = readPackageJson(rootDir);
|
|
75
|
+
if (!pkg)
|
|
76
|
+
return [];
|
|
77
|
+
const workspaces = pkg.workspaces;
|
|
78
|
+
if (!workspaces)
|
|
79
|
+
return [];
|
|
80
|
+
// workspaces can be an array of globs or an object with packages array
|
|
81
|
+
let globs;
|
|
82
|
+
if (Array.isArray(workspaces)) {
|
|
83
|
+
globs = workspaces;
|
|
84
|
+
}
|
|
85
|
+
else if (typeof workspaces === "object" &&
|
|
86
|
+
Array.isArray(workspaces.packages)) {
|
|
87
|
+
globs = workspaces.packages;
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
return [];
|
|
91
|
+
}
|
|
92
|
+
return resolveGlobs(rootDir, globs);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Resolve workspace globs to actual package directories.
|
|
96
|
+
* Supports simple `dir/*` globs (one level of wildcard).
|
|
97
|
+
* Does not recurse into node_modules.
|
|
98
|
+
*/
|
|
99
|
+
function resolveGlobs(rootDir, globs) {
|
|
100
|
+
const components = [];
|
|
101
|
+
for (const glob of globs) {
|
|
102
|
+
if (glob.endsWith("/*") || glob.endsWith("/**")) {
|
|
103
|
+
// Directory wildcard: resolve all subdirectories
|
|
104
|
+
const baseDir = glob.replace(/\/\*\*?$/, "");
|
|
105
|
+
const resolvedBase = resolve(rootDir, baseDir);
|
|
106
|
+
if (!existsSync(resolvedBase))
|
|
107
|
+
continue;
|
|
108
|
+
let entries;
|
|
109
|
+
try {
|
|
110
|
+
entries = readdirSync(resolvedBase);
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
for (const entry of entries) {
|
|
116
|
+
if (entry === "node_modules" || entry.startsWith("."))
|
|
117
|
+
continue;
|
|
118
|
+
const entryPath = join(resolvedBase, entry);
|
|
119
|
+
try {
|
|
120
|
+
if (!statSync(entryPath).isDirectory())
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
catch {
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
const pkg = readPackageJson(entryPath);
|
|
127
|
+
if (pkg) {
|
|
128
|
+
components.push({
|
|
129
|
+
path: entryPath,
|
|
130
|
+
name: pkg.name || entry,
|
|
131
|
+
packageJson: pkg,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
// Exact path
|
|
138
|
+
const resolvedPath = resolve(rootDir, glob);
|
|
139
|
+
if (!existsSync(resolvedPath))
|
|
140
|
+
continue;
|
|
141
|
+
const pkg = readPackageJson(resolvedPath);
|
|
142
|
+
if (pkg) {
|
|
143
|
+
components.push({
|
|
144
|
+
path: resolvedPath,
|
|
145
|
+
name: pkg.name || glob,
|
|
146
|
+
packageJson: pkg,
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return components;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Filter out workspace root (if no runtime deps) and sort alphabetically by path.
|
|
155
|
+
*/
|
|
156
|
+
function filterAndSort(rootDir, components) {
|
|
157
|
+
// Include workspace root only if it has runtime dependencies
|
|
158
|
+
const rootPkg = readPackageJson(rootDir);
|
|
159
|
+
if (rootPkg && hasRuntimeDeps(rootPkg)) {
|
|
160
|
+
const rootAlreadyIncluded = components.some((c) => c.path === rootDir);
|
|
161
|
+
if (!rootAlreadyIncluded) {
|
|
162
|
+
components.push({
|
|
163
|
+
path: rootDir,
|
|
164
|
+
name: rootPkg.name || "root",
|
|
165
|
+
packageJson: rootPkg,
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
// Sort alphabetically by path
|
|
170
|
+
return components.sort((a, b) => a.path.localeCompare(b.path));
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Check if a package.json has runtime dependencies.
|
|
174
|
+
*/
|
|
175
|
+
function hasRuntimeDeps(pkg) {
|
|
176
|
+
const deps = pkg.dependencies;
|
|
177
|
+
return !!deps && Object.keys(deps).length > 0;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Read and parse a package.json from a directory. Returns null on failure.
|
|
181
|
+
*/
|
|
182
|
+
function readPackageJson(dir) {
|
|
183
|
+
const pkgPath = join(dir, "package.json");
|
|
184
|
+
if (!existsSync(pkgPath))
|
|
185
|
+
return null;
|
|
186
|
+
try {
|
|
187
|
+
return JSON.parse(readFileSync(pkgPath, "utf-8"));
|
|
188
|
+
}
|
|
189
|
+
catch {
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
//# sourceMappingURL=workspaces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspaces.js","sourceRoot":"","sources":["../../../core/extract/workspaces.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAcpD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAe;IAChD,2BAA2B;IAC3B,MAAM,cAAc,GAAG,sBAAsB,CAAC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CAAC,UAAU,CAAC,OAAO,CAAC;QAAE,OAAO,IAAI,CAAC;IACtC,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAA4B,CAAC;IAC/E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@llipe.com/dev-tasks",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "Multi-repo context tooling for dev-tasks",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"imports": {
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
".kiro/hooks/",
|
|
31
31
|
"AGENTS.md",
|
|
32
32
|
"CLAUDE.md",
|
|
33
|
+
"TESTING.md",
|
|
33
34
|
"bundle-manifest.json",
|
|
34
35
|
"README.md",
|
|
35
36
|
"CHANGELOG.md"
|
|
@@ -73,12 +74,14 @@
|
|
|
73
74
|
"license": "ISC",
|
|
74
75
|
"packageManager": "pnpm@10.11.0",
|
|
75
76
|
"devDependencies": {
|
|
77
|
+
"@types/express": "^5.0.6",
|
|
76
78
|
"@types/node": "22.15.18",
|
|
77
79
|
"@typescript-eslint/eslint-plugin": "8.32.1",
|
|
78
80
|
"@typescript-eslint/parser": "8.32.1",
|
|
79
81
|
"eslint": "9.27.0",
|
|
80
82
|
"eslint-config-prettier": "10.1.5",
|
|
81
83
|
"eslint-plugin-import-x": "4.12.2",
|
|
84
|
+
"express": "^5.2.1",
|
|
82
85
|
"globals": "16.1.0",
|
|
83
86
|
"prettier": "3.5.3",
|
|
84
87
|
"tsx": "4.19.4",
|
|
@@ -92,7 +95,13 @@
|
|
|
92
95
|
"yaml": "2.8.3"
|
|
93
96
|
},
|
|
94
97
|
"peerDependencies": {
|
|
95
|
-
"typescript": ">=5.0.0"
|
|
98
|
+
"typescript": ">=5.0.0",
|
|
99
|
+
"pg": ">=8.0.0"
|
|
100
|
+
},
|
|
101
|
+
"peerDependenciesMeta": {
|
|
102
|
+
"pg": {
|
|
103
|
+
"optional": true
|
|
104
|
+
}
|
|
96
105
|
},
|
|
97
106
|
"pnpm": {
|
|
98
107
|
"overrides": {
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* LLM description pass for OpenAPI endpoints.
|
|
3
|
-
* Writes only `summary`, `description`, `tags` per endpoint.
|
|
4
|
-
* Does NOT modify structural information (paths, methods, params, schemas).
|
|
5
|
-
*/
|
|
6
|
-
import type { OpenApiExtractionResult } from "./types.js";
|
|
7
|
-
/**
|
|
8
|
-
* LLM provider interface for OpenAPI description generation.
|
|
9
|
-
* Consumers provide an implementation; tests use stubs.
|
|
10
|
-
*/
|
|
11
|
-
export interface OpenApiLlmProvider {
|
|
12
|
-
/**
|
|
13
|
-
* Generate summary, description, and tags for a set of endpoints.
|
|
14
|
-
* Must NOT modify structural fields (method, path, parameters, requestBody, responses).
|
|
15
|
-
*/
|
|
16
|
-
describeEndpoints(endpoints: EndpointDescriptionInput[]): Promise<EndpointDescriptionOutput[]>;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Input to the LLM for describing an endpoint.
|
|
20
|
-
*/
|
|
21
|
-
export interface EndpointDescriptionInput {
|
|
22
|
-
method: string;
|
|
23
|
-
path: string;
|
|
24
|
-
parameters: string[];
|
|
25
|
-
hasBody: boolean;
|
|
26
|
-
responseType: string | null;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* LLM output: only descriptive fields.
|
|
30
|
-
*/
|
|
31
|
-
export interface EndpointDescriptionOutput {
|
|
32
|
-
summary: string;
|
|
33
|
-
description: string;
|
|
34
|
-
tags: string[];
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Apply LLM-generated descriptions to an extraction result.
|
|
38
|
-
* Only writes summary, description, and tags — nothing structural.
|
|
39
|
-
*/
|
|
40
|
-
export declare function applyLlmDescriptions(result: OpenApiExtractionResult, llm: OpenApiLlmProvider): Promise<OpenApiExtractionResult>;
|
|
41
|
-
//# sourceMappingURL=llm-descriptions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"llm-descriptions.d.ts","sourceRoot":"","sources":["../../../../core/extract/openapi/llm-descriptions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAqB,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAE7E;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,iBAAiB,CAAC,SAAS,EAAE,wBAAwB,EAAE,GAAG,OAAO,CAAC,yBAAyB,EAAE,CAAC,CAAC;CAChG;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED;;;GAGG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,uBAAuB,EAC/B,GAAG,EAAE,kBAAkB,GACtB,OAAO,CAAC,uBAAuB,CAAC,CA2BlC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* LLM description pass for OpenAPI endpoints.
|
|
3
|
-
* Writes only `summary`, `description`, `tags` per endpoint.
|
|
4
|
-
* Does NOT modify structural information (paths, methods, params, schemas).
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Apply LLM-generated descriptions to an extraction result.
|
|
8
|
-
* Only writes summary, description, and tags — nothing structural.
|
|
9
|
-
*/
|
|
10
|
-
export async function applyLlmDescriptions(result, llm) {
|
|
11
|
-
const inputs = result.endpoints.map((ep) => ({
|
|
12
|
-
method: ep.method,
|
|
13
|
-
path: ep.path,
|
|
14
|
-
parameters: ep.parameters.map((p) => `${p.name} (${p.in})`),
|
|
15
|
-
hasBody: !!ep.requestBody,
|
|
16
|
-
responseType: ep.responses[0]?.schema ? "typed" : null,
|
|
17
|
-
}));
|
|
18
|
-
const descriptions = await llm.describeEndpoints(inputs);
|
|
19
|
-
// Apply descriptions to endpoints (do not modify structural fields)
|
|
20
|
-
const updatedEndpoints = result.endpoints.map((ep, i) => {
|
|
21
|
-
const desc = descriptions[i];
|
|
22
|
-
if (!desc)
|
|
23
|
-
return ep;
|
|
24
|
-
return {
|
|
25
|
-
...ep,
|
|
26
|
-
summary: desc.summary,
|
|
27
|
-
description: desc.description,
|
|
28
|
-
tags: desc.tags,
|
|
29
|
-
};
|
|
30
|
-
});
|
|
31
|
-
return {
|
|
32
|
-
...result,
|
|
33
|
-
endpoints: updatedEndpoints,
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=llm-descriptions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"llm-descriptions.js","sourceRoot":"","sources":["../../../../core/extract/openapi/llm-descriptions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAoCH;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,MAA+B,EAC/B,GAAuB;IAEvB,MAAM,MAAM,GAA+B,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;QACvE,MAAM,EAAE,EAAE,CAAC,MAAM;QACjB,IAAI,EAAE,EAAE,CAAC,IAAI;QACb,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC;QAC3D,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,WAAW;QACzB,YAAY,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI;KACvD,CAAC,CAAC,CAAC;IAEJ,MAAM,YAAY,GAAG,MAAM,GAAG,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAEzD,oEAAoE;IACpE,MAAM,gBAAgB,GAAwB,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE;QAC3E,MAAM,IAAI,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;QAC7B,IAAI,CAAC,IAAI;YAAE,OAAO,EAAE,CAAC;QACrB,OAAO;YACL,GAAG,EAAE;YACL,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,GAAG,MAAM;QACT,SAAS,EAAE,gBAAgB;KAC5B,CAAC;AACJ,CAAC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* LLM description pass for schema extraction.
|
|
3
|
-
* Adds semantic table/column descriptions over the extracted structure.
|
|
4
|
-
*
|
|
5
|
-
* IMPORTANT: This pass NEVER invents columns or modifies the schema structure.
|
|
6
|
-
* It only adds `description` fields to existing tables.
|
|
7
|
-
*/
|
|
8
|
-
import type { SchemaExtractionResult } from "./types.js";
|
|
9
|
-
import type { LlmProvider } from "../schema.js";
|
|
10
|
-
/**
|
|
11
|
-
* Add semantic descriptions to an extracted schema using an LLM provider.
|
|
12
|
-
* Returns a new result with descriptions added — does not mutate the input.
|
|
13
|
-
*
|
|
14
|
-
* The LLM is given the table/column structure and asked to describe
|
|
15
|
-
* each table's purpose. It must NOT invent columns or alter the schema.
|
|
16
|
-
*/
|
|
17
|
-
export declare function addSchemaDescriptions(schema: SchemaExtractionResult, llm: LlmProvider): Promise<SchemaExtractionResult>;
|
|
18
|
-
/**
|
|
19
|
-
* Build a prompt context for the LLM to describe tables.
|
|
20
|
-
* Exported for testing the prompt structure.
|
|
21
|
-
*/
|
|
22
|
-
export declare function buildDescriptionPrompt(schema: SchemaExtractionResult): string;
|
|
23
|
-
/**
|
|
24
|
-
* Stub LLM provider that generates simple descriptions based on table/column names.
|
|
25
|
-
* Used in tests and as a fallback when no real LLM is configured.
|
|
26
|
-
*/
|
|
27
|
-
export declare const stubDescriptionProvider: LlmProvider;
|
|
28
|
-
//# sourceMappingURL=llm-descriptions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"llm-descriptions.d.ts","sourceRoot":"","sources":["../../../../core/extract/orm/llm-descriptions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD;;;;;;GAMG;AACH,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,sBAAsB,EAC9B,GAAG,EAAE,WAAW,GACf,OAAO,CAAC,sBAAsB,CAAC,CAEjC;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,sBAAsB,GAAG,MAAM,CA4B7E;AAED;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,WAoBrC,CAAC"}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* LLM description pass for schema extraction.
|
|
3
|
-
* Adds semantic table/column descriptions over the extracted structure.
|
|
4
|
-
*
|
|
5
|
-
* IMPORTANT: This pass NEVER invents columns or modifies the schema structure.
|
|
6
|
-
* It only adds `description` fields to existing tables.
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Add semantic descriptions to an extracted schema using an LLM provider.
|
|
10
|
-
* Returns a new result with descriptions added — does not mutate the input.
|
|
11
|
-
*
|
|
12
|
-
* The LLM is given the table/column structure and asked to describe
|
|
13
|
-
* each table's purpose. It must NOT invent columns or alter the schema.
|
|
14
|
-
*/
|
|
15
|
-
export async function addSchemaDescriptions(schema, llm) {
|
|
16
|
-
return llm.describeSchema(schema);
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Build a prompt context for the LLM to describe tables.
|
|
20
|
-
* Exported for testing the prompt structure.
|
|
21
|
-
*/
|
|
22
|
-
export function buildDescriptionPrompt(schema) {
|
|
23
|
-
const lines = [];
|
|
24
|
-
lines.push("Given the following database schema, provide a brief semantic description for each table.");
|
|
25
|
-
lines.push("Do NOT invent new columns or modify the structure. Only add descriptions.");
|
|
26
|
-
lines.push("");
|
|
27
|
-
lines.push("Schema:");
|
|
28
|
-
lines.push("");
|
|
29
|
-
for (const table of schema.tables) {
|
|
30
|
-
lines.push(`Table: ${table.name}`);
|
|
31
|
-
lines.push(` Columns: ${table.columns.map((c) => `${c.name} (${c.type}${c.nullable ? ", nullable" : ""})`).join(", ")}`);
|
|
32
|
-
if (table.relations.length > 0) {
|
|
33
|
-
lines.push(` Relations: ${table.relations.map((r) => `${r.name} → ${r.target}`).join(", ")}`);
|
|
34
|
-
}
|
|
35
|
-
lines.push("");
|
|
36
|
-
}
|
|
37
|
-
lines.push("Respond with a JSON object mapping table names to descriptions:");
|
|
38
|
-
lines.push('{ "table_name": "description", ... }');
|
|
39
|
-
return lines.join("\n");
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Stub LLM provider that generates simple descriptions based on table/column names.
|
|
43
|
-
* Used in tests and as a fallback when no real LLM is configured.
|
|
44
|
-
*/
|
|
45
|
-
export const stubDescriptionProvider = {
|
|
46
|
-
async inferSchemaFromMigrations(_content) {
|
|
47
|
-
return {
|
|
48
|
-
tables: [],
|
|
49
|
-
enums: [],
|
|
50
|
-
source: "inferred",
|
|
51
|
-
confidence: "low",
|
|
52
|
-
orm: "migration_inference",
|
|
53
|
-
};
|
|
54
|
-
},
|
|
55
|
-
async describeSchema(schema) {
|
|
56
|
-
// Simple heuristic descriptions based on table name
|
|
57
|
-
const tables = schema.tables.map((table) => ({
|
|
58
|
-
...table,
|
|
59
|
-
description: table.description ?? `Stores ${table.name} data`,
|
|
60
|
-
}));
|
|
61
|
-
return { ...schema, tables };
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
//# sourceMappingURL=llm-descriptions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"llm-descriptions.js","sourceRoot":"","sources":["../../../../core/extract/orm/llm-descriptions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,MAA8B,EAC9B,GAAgB;IAEhB,OAAO,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;AACpC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAA8B;IACnE,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,KAAK,CAAC,IAAI,CACR,2FAA2F,CAC5F,CAAC;IACF,KAAK,CAAC,IAAI,CAAC,2EAA2E,CAAC,CAAC;IACxF,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACtB,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEf,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAClC,KAAK,CAAC,IAAI,CAAC,UAAU,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;QACnC,KAAK,CAAC,IAAI,CACR,cAAc,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC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,MAAM,EAAE,CAAC;IAC/B,CAAC;CACF,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Migration-based schema inference fallback.
|
|
3
|
-
* When no ORM and no --db-url is available, but SQL migrations exist,
|
|
4
|
-
* uses an LLM provider to infer schema from migration SQL content.
|
|
5
|
-
*
|
|
6
|
-
* Marks results as: source: "inferred", confidence: "low"
|
|
7
|
-
*/
|
|
8
|
-
import type { SchemaExtractionResult } from "./types.js";
|
|
9
|
-
import type { LlmProvider } from "../schema.js";
|
|
10
|
-
/**
|
|
11
|
-
* Find SQL migration files in known migration directories.
|
|
12
|
-
* Returns concatenated SQL content or null if no migrations found.
|
|
13
|
-
*/
|
|
14
|
-
export declare function findMigrationSql(rootDir: string): string | null;
|
|
15
|
-
/**
|
|
16
|
-
* Infer schema from SQL migrations using an LLM provider.
|
|
17
|
-
* Returns the inferred schema or null if migrations weren't found.
|
|
18
|
-
*/
|
|
19
|
-
export declare function inferSchemaFromMigrations(rootDir: string, llm: LlmProvider): Promise<SchemaExtractionResult | null>;
|
|
20
|
-
/**
|
|
21
|
-
* Default/stub LLM provider for migration inference.
|
|
22
|
-
* Returns an empty schema — actual implementations should override this.
|
|
23
|
-
*/
|
|
24
|
-
export declare const stubLlmProvider: LlmProvider;
|
|
25
|
-
//# sourceMappingURL=migration-inference.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"migration-inference.d.ts","sourceRoot":"","sources":["../../../../core/extract/orm/migration-inference.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA4B/D;AAED;;;GAGG;AACH,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,WAAW,GACf,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC,CAaxC;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,WAc7B,CAAC"}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Migration-based schema inference fallback.
|
|
3
|
-
* When no ORM and no --db-url is available, but SQL migrations exist,
|
|
4
|
-
* uses an LLM provider to infer schema from migration SQL content.
|
|
5
|
-
*
|
|
6
|
-
* Marks results as: source: "inferred", confidence: "low"
|
|
7
|
-
*/
|
|
8
|
-
import { readdirSync, readFileSync } from "node:fs";
|
|
9
|
-
import { join, extname } from "node:path";
|
|
10
|
-
/**
|
|
11
|
-
* Find SQL migration files in known migration directories.
|
|
12
|
-
* Returns concatenated SQL content or null if no migrations found.
|
|
13
|
-
*/
|
|
14
|
-
export function findMigrationSql(rootDir) {
|
|
15
|
-
const migrationDirs = [
|
|
16
|
-
"migrations",
|
|
17
|
-
"src/migrations",
|
|
18
|
-
"db/migrations",
|
|
19
|
-
"prisma/migrations",
|
|
20
|
-
"drizzle",
|
|
21
|
-
"database/migrations",
|
|
22
|
-
];
|
|
23
|
-
for (const dir of migrationDirs) {
|
|
24
|
-
const fullPath = join(rootDir, dir);
|
|
25
|
-
try {
|
|
26
|
-
const files = readdirSync(fullPath, { recursive: true });
|
|
27
|
-
const sqlFiles = files.filter((f) => extname(String(f)) === ".sql");
|
|
28
|
-
if (sqlFiles.length > 0) {
|
|
29
|
-
const contents = sqlFiles
|
|
30
|
-
.map((f) => readFileSync(join(fullPath, String(f)), "utf-8"))
|
|
31
|
-
.join("\n\n-- Next migration --\n\n");
|
|
32
|
-
return contents;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
catch {
|
|
36
|
-
// Directory doesn't exist, continue
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Infer schema from SQL migrations using an LLM provider.
|
|
43
|
-
* Returns the inferred schema or null if migrations weren't found.
|
|
44
|
-
*/
|
|
45
|
-
export async function inferSchemaFromMigrations(rootDir, llm) {
|
|
46
|
-
const migrationSql = findMigrationSql(rootDir);
|
|
47
|
-
if (!migrationSql)
|
|
48
|
-
return null;
|
|
49
|
-
const result = await llm.inferSchemaFromMigrations(migrationSql);
|
|
50
|
-
// Ensure source/confidence are correct regardless of what LLM returns
|
|
51
|
-
return {
|
|
52
|
-
...result,
|
|
53
|
-
source: "inferred",
|
|
54
|
-
confidence: "low",
|
|
55
|
-
orm: "migration_inference",
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Default/stub LLM provider for migration inference.
|
|
60
|
-
* Returns an empty schema — actual implementations should override this.
|
|
61
|
-
*/
|
|
62
|
-
export const stubLlmProvider = {
|
|
63
|
-
async inferSchemaFromMigrations(_migrationContent) {
|
|
64
|
-
return {
|
|
65
|
-
tables: [],
|
|
66
|
-
enums: [],
|
|
67
|
-
source: "inferred",
|
|
68
|
-
confidence: "low",
|
|
69
|
-
orm: "migration_inference",
|
|
70
|
-
};
|
|
71
|
-
},
|
|
72
|
-
async describeSchema(schema) {
|
|
73
|
-
return schema;
|
|
74
|
-
},
|
|
75
|
-
};
|
|
76
|
-
//# sourceMappingURL=migration-inference.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"migration-inference.js","sourceRoot":"","sources":["../../../../core/extract/orm/migration-inference.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAI1C;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC9C,MAAM,aAAa,GAAG;QACpB,YAAY;QACZ,gBAAgB;QAChB,eAAe;QACf,mBAAmB;QACn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