db-scalability-guardian 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +165 -0
  2. package/dist/analyzers/postgres/migrations.d.ts +4 -0
  3. package/dist/analyzers/postgres/migrations.d.ts.map +1 -0
  4. package/dist/analyzers/postgres/migrations.js +96 -0
  5. package/dist/analyzers/postgres/migrations.js.map +1 -0
  6. package/dist/cli/index.d.ts +3 -0
  7. package/dist/cli/index.d.ts.map +1 -0
  8. package/dist/cli/index.js +125 -0
  9. package/dist/cli/index.js.map +1 -0
  10. package/dist/collectors/git.d.ts +6 -0
  11. package/dist/collectors/git.d.ts.map +1 -0
  12. package/dist/collectors/git.js +51 -0
  13. package/dist/collectors/git.js.map +1 -0
  14. package/dist/collectors/prisma.d.ts +8 -0
  15. package/dist/collectors/prisma.d.ts.map +1 -0
  16. package/dist/collectors/prisma.js +29 -0
  17. package/dist/collectors/prisma.js.map +1 -0
  18. package/dist/config/defaults.d.ts +24 -0
  19. package/dist/config/defaults.d.ts.map +1 -0
  20. package/dist/config/defaults.js +56 -0
  21. package/dist/config/defaults.js.map +1 -0
  22. package/dist/config/loader.d.ts +3 -0
  23. package/dist/config/loader.d.ts.map +1 -0
  24. package/dist/config/loader.js +69 -0
  25. package/dist/config/loader.js.map +1 -0
  26. package/dist/config/schema.d.ts +3 -0
  27. package/dist/config/schema.d.ts.map +1 -0
  28. package/dist/config/schema.js +51 -0
  29. package/dist/config/schema.js.map +1 -0
  30. package/dist/gate/gate.d.ts +6 -0
  31. package/dist/gate/gate.d.ts.map +1 -0
  32. package/dist/gate/gate.js +11 -0
  33. package/dist/gate/gate.js.map +1 -0
  34. package/dist/index.d.ts +12 -0
  35. package/dist/index.d.ts.map +1 -0
  36. package/dist/index.js +40 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/llm/mistral.d.ts +6 -0
  39. package/dist/llm/mistral.d.ts.map +1 -0
  40. package/dist/llm/mistral.js +34 -0
  41. package/dist/llm/mistral.js.map +1 -0
  42. package/dist/llm/prompts.d.ts +6 -0
  43. package/dist/llm/prompts.d.ts.map +1 -0
  44. package/dist/llm/prompts.js +50 -0
  45. package/dist/llm/prompts.js.map +1 -0
  46. package/dist/reporters/json.d.ts +3 -0
  47. package/dist/reporters/json.d.ts.map +1 -0
  48. package/dist/reporters/json.js +7 -0
  49. package/dist/reporters/json.js.map +1 -0
  50. package/dist/reporters/markdown.d.ts +3 -0
  51. package/dist/reporters/markdown.d.ts.map +1 -0
  52. package/dist/reporters/markdown.js +38 -0
  53. package/dist/reporters/markdown.js.map +1 -0
  54. package/dist/types/config.d.ts +21 -0
  55. package/dist/types/config.d.ts.map +1 -0
  56. package/dist/types/config.js +3 -0
  57. package/dist/types/config.js.map +1 -0
  58. package/dist/types/report.d.ts +37 -0
  59. package/dist/types/report.d.ts.map +1 -0
  60. package/dist/types/report.js +3 -0
  61. package/dist/types/report.js.map +1 -0
  62. package/package.json +41 -0
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.loadConfig = loadConfig;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const defaults_js_1 = require("./defaults.js");
10
+ const schema_js_1 = require("./schema.js");
11
+ function loadConfig(cwd = process.cwd()) {
12
+ const configPath = path_1.default.join(cwd, "guardian.config.ts");
13
+ const configPathJs = path_1.default.join(cwd, "guardian.config.js");
14
+ const configPathJson = path_1.default.join(cwd, "guardian.config.json");
15
+ let userConfig = {};
16
+ // Try to load config file
17
+ if (fs_1.default.existsSync(configPath)) {
18
+ try {
19
+ // For TypeScript config, we'd need to compile it first
20
+ // For now, we'll support JS and JSON only
21
+ console.warn("TypeScript config files not yet supported. Use .js or .json");
22
+ }
23
+ catch (error) {
24
+ console.warn(`Failed to load ${configPath}:`, error);
25
+ }
26
+ }
27
+ if (fs_1.default.existsSync(configPathJs)) {
28
+ try {
29
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
30
+ const loaded = require(configPathJs);
31
+ const exported = loaded.default || loaded;
32
+ userConfig = (0, schema_js_1.validateConfig)(exported);
33
+ }
34
+ catch (error) {
35
+ console.warn(`Failed to load ${configPathJs}:`, error);
36
+ }
37
+ }
38
+ if (fs_1.default.existsSync(configPathJson)) {
39
+ try {
40
+ const content = fs_1.default.readFileSync(configPathJson, "utf-8");
41
+ const parsed = JSON.parse(content);
42
+ userConfig = (0, schema_js_1.validateConfig)(parsed);
43
+ }
44
+ catch (error) {
45
+ console.warn(`Failed to load ${configPathJson}:`, error);
46
+ }
47
+ }
48
+ // Merge with defaults - all fields are guaranteed by DEFAULT_CONFIG
49
+ return {
50
+ baseBranch: userConfig.baseBranch ?? defaults_js_1.DEFAULT_CONFIG.baseBranch,
51
+ headBranch: userConfig.headBranch ?? defaults_js_1.DEFAULT_CONFIG.headBranch,
52
+ database: {
53
+ engine: userConfig.database?.engine ?? defaults_js_1.DEFAULT_CONFIG.database.engine,
54
+ orm: userConfig.database?.orm ?? defaults_js_1.DEFAULT_CONFIG.database.orm,
55
+ migrationsPath: userConfig.database?.migrationsPath ?? defaults_js_1.DEFAULT_CONFIG.database.migrationsPath,
56
+ },
57
+ futureConstraints: userConfig.futureConstraints ?? defaults_js_1.DEFAULT_CONFIG.futureConstraints,
58
+ llm: {
59
+ provider: userConfig.llm?.provider ?? defaults_js_1.DEFAULT_CONFIG.llm.provider,
60
+ model: userConfig.llm?.model ?? defaults_js_1.DEFAULT_CONFIG.llm.model,
61
+ optional: userConfig.llm?.optional ?? defaults_js_1.DEFAULT_CONFIG.llm.optional,
62
+ apiKey: userConfig.llm?.apiKey ?? process.env.MISTRAL_API_KEY ?? defaults_js_1.DEFAULT_CONFIG.llm.apiKey,
63
+ },
64
+ gate: {
65
+ failOn: userConfig.gate?.failOn ?? defaults_js_1.DEFAULT_CONFIG.gate.failOn,
66
+ },
67
+ };
68
+ }
69
+ //# sourceMappingURL=loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/config/loader.ts"],"names":[],"mappings":";;;;;AAMA,gCA2DC;AAjED,4CAAoB;AACpB,gDAAwB;AACxB,+CAA+C;AAC/C,2CAA6C;AAG7C,SAAgB,UAAU,CAAC,MAAc,OAAO,CAAC,GAAG,EAAE;IACpD,MAAM,UAAU,GAAG,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,oBAAoB,CAAC,CAAC;IACxD,MAAM,YAAY,GAAG,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,oBAAoB,CAAC,CAAC;IAC1D,MAAM,cAAc,GAAG,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,sBAAsB,CAAC,CAAC;IAE9D,IAAI,UAAU,GAAmB,EAAE,CAAC;IAEpC,0BAA0B;IAC1B,IAAI,YAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC9B,IAAI,CAAC;YACH,uDAAuD;YACvD,0CAA0C;YAC1C,OAAO,CAAC,IAAI,CAAC,6DAA6D,CAAC,CAAC;QAC9E,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,IAAI,CAAC,kBAAkB,UAAU,GAAG,EAAE,KAAK,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;IAED,IAAI,YAAE,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QAChC,IAAI,CAAC;YACH,iEAAiE;YACjE,MAAM,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;YACrC,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC;YAC1C,UAAU,GAAG,IAAA,0BAAc,EAAC,QAAQ,CAAC,CAAC;QACxC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,IAAI,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AQ,IAAI,4BAAc,CAAC,GAAG,CAAC,QAAQ;YACjE,MAAM,EAAE,UAAU,CAAC,GAAG,EAAE,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,4BAAc,CAAC,GAAG,CAAC,MAAM;SAC3F;QACD,IAAI,EAAE;YACJ,MAAM,EAAE,UAAU,CAAC,IAAI,EAAE,MAAM,IAAI,4BAAc,CAAC,IAAI,CAAC,MAAM;SAC9D;KAC0B,CAAC;AAChC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { GuardianConfig } from "../types/config.js";
2
+ export declare function validateConfig(config: unknown): GuardianConfig;
3
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,cAAc,CAkD9D"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateConfig = validateConfig;
4
+ function validateConfig(config) {
5
+ if (typeof config !== "object" || config === null) {
6
+ throw new Error("Config must be an object");
7
+ }
8
+ const validated = {};
9
+ const obj = config;
10
+ if ("baseBranch" in obj && typeof obj.baseBranch === "string") {
11
+ validated.baseBranch = obj.baseBranch;
12
+ }
13
+ if ("headBranch" in obj && typeof obj.headBranch === "string") {
14
+ validated.headBranch = obj.headBranch;
15
+ }
16
+ if ("database" in obj && typeof obj.database === "object" && obj.database !== null) {
17
+ const db = obj.database;
18
+ validated.database = {};
19
+ if (typeof db.engine === "string")
20
+ validated.database.engine = db.engine;
21
+ if (typeof db.orm === "string")
22
+ validated.database.orm = db.orm;
23
+ if (typeof db.migrationsPath === "string")
24
+ validated.database.migrationsPath = db.migrationsPath;
25
+ }
26
+ if ("futureConstraints" in obj && Array.isArray(obj.futureConstraints)) {
27
+ validated.futureConstraints = obj.futureConstraints.filter((c) => typeof c === "string");
28
+ }
29
+ if ("llm" in obj && typeof obj.llm === "object" && obj.llm !== null) {
30
+ const llm = obj.llm;
31
+ validated.llm = {};
32
+ if (llm.provider === "mistral")
33
+ validated.llm.provider = "mistral";
34
+ if (typeof llm.model === "string")
35
+ validated.llm.model = llm.model;
36
+ if (typeof llm.optional === "boolean")
37
+ validated.llm.optional = llm.optional;
38
+ if (typeof llm.apiKey === "string")
39
+ validated.llm.apiKey = llm.apiKey;
40
+ }
41
+ if ("gate" in obj && typeof obj.gate === "object" && obj.gate !== null) {
42
+ const gate = obj.gate;
43
+ validated.gate = {};
44
+ if (Array.isArray(gate.failOn)) {
45
+ const severities = ["LOW", "MEDIUM", "HIGH", "CRITICAL"];
46
+ validated.gate.failOn = gate.failOn.filter((s) => typeof s === "string" && severities.includes(s));
47
+ }
48
+ }
49
+ return validated;
50
+ }
51
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":";;AAEA,wCAkDC;AAlDD,SAAgB,cAAc,CAAC,MAAe;IAC5C,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QAClD,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;IAC9C,CAAC;IAED,MAAM,SAAS,GAAmB,EAAE,CAAC;IAErC,MAAM,GAAG,GAAG,MAAiC,CAAC;IAE9C,IAAI,YAAY,IAAI,GAAG,IAAI,OAAO,GAAG,CAAC,UAAU,KAAK,QAAQ,EAAE,CAAC;QAC9D,SAAS,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU,CAAC;IACxC,CAAC;IAED,IAAI,YAAY,IAAI,GAAG,IAAI,OAAO,GAAG,CAAC,UAAU,KAAK,QAAQ,EAAE,CAAC;QAC9D,SAAS,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU,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AAC,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;QACnE,IAAI,OAAO,GAAG,CAAC,QAAQ,KAAK,SAAS;YAAE,SAAS,CAAC,GAAG,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;QAC7E,IAAI,OAAO,GAAG,CAAC,MAAM,KAAK,QAAQ;YAAE,SAAS,CAAC,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;IACxE,CAAC;IAED,IAAI,MAAM,IAAI,GAAG,IAAI,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;QACvE,MAAM,IAAI,GAAG,GAAG,CAAC,IAA+B,CAAC;QACjD,SAAS,CAAC,IAAI,GAAG,EAAE,CAAC;QACpB,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;YAC/B,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAU,CAAC;YAClE,SAAS,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAkC,EAAE,CAC/E,OAAO,CAAC,KAAK,QAAQ,IAAI,UAAU,CAAC,QAAQ,CAAC,CAA8B,CAAC,CAC7E,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { Finding, Severity } from "../types/report.js";
2
+ export declare function checkGate(findings: Finding[], failOn: Severity[]): {
3
+ passed: boolean;
4
+ blocking: Finding[];
5
+ };
6
+ //# sourceMappingURL=gate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../../src/gate/gate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEvD,wBAAgB,SAAS,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,OAAO,EAAE,CAAA;CAAE,CAM3G"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.checkGate = checkGate;
4
+ function checkGate(findings, failOn) {
5
+ const blocking = findings.filter((f) => failOn.includes(f.severity));
6
+ return {
7
+ passed: blocking.length === 0,
8
+ blocking,
9
+ };
10
+ }
11
+ //# sourceMappingURL=gate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gate.js","sourceRoot":"","sources":["../../src/gate/gate.ts"],"names":[],"mappings":";;AAEA,8BAMC;AAND,SAAgB,SAAS,CAAC,QAAmB,EAAE,MAAkB;IAC/D,MAAM,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;IACrE,OAAO;QACL,MAAM,EAAE,QAAQ,CAAC,MAAM,KAAK,CAAC;QAC7B,QAAQ;KACT,CAAC;AACJ,CAAC"}
@@ -0,0 +1,12 @@
1
+ export * from "./types/report.js";
2
+ export * from "./types/config.js";
3
+ export { loadConfig } from "./config/loader.js";
4
+ export { diffFiles } from "./collectors/git.js";
5
+ export { collectPrismaContext, loadMigrationSQL } from "./collectors/prisma.js";
6
+ export { analyzeMigrations } from "./analyzers/postgres/migrations.js";
7
+ export { renderMarkdown } from "./reporters/markdown.js";
8
+ export { renderJSON } from "./reporters/json.js";
9
+ export { checkGate } from "./gate/gate.js";
10
+ export { buildLLMPrompt } from "./llm/prompts.js";
11
+ export { callMistral } from "./llm/mistral.js";
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.callMistral = exports.buildLLMPrompt = exports.checkGate = exports.renderJSON = exports.renderMarkdown = exports.analyzeMigrations = exports.loadMigrationSQL = exports.collectPrismaContext = exports.diffFiles = exports.loadConfig = void 0;
18
+ // Public API exports
19
+ __exportStar(require("./types/report.js"), exports);
20
+ __exportStar(require("./types/config.js"), exports);
21
+ var loader_js_1 = require("./config/loader.js");
22
+ Object.defineProperty(exports, "loadConfig", { enumerable: true, get: function () { return loader_js_1.loadConfig; } });
23
+ var git_js_1 = require("./collectors/git.js");
24
+ Object.defineProperty(exports, "diffFiles", { enumerable: true, get: function () { return git_js_1.diffFiles; } });
25
+ var prisma_js_1 = require("./collectors/prisma.js");
26
+ Object.defineProperty(exports, "collectPrismaContext", { enumerable: true, get: function () { return prisma_js_1.collectPrismaContext; } });
27
+ Object.defineProperty(exports, "loadMigrationSQL", { enumerable: true, get: function () { return prisma_js_1.loadMigrationSQL; } });
28
+ var migrations_js_1 = require("./analyzers/postgres/migrations.js");
29
+ Object.defineProperty(exports, "analyzeMigrations", { enumerable: true, get: function () { return migrations_js_1.analyzeMigrations; } });
30
+ var markdown_js_1 = require("./reporters/markdown.js");
31
+ Object.defineProperty(exports, "renderMarkdown", { enumerable: true, get: function () { return markdown_js_1.renderMarkdown; } });
32
+ var json_js_1 = require("./reporters/json.js");
33
+ Object.defineProperty(exports, "renderJSON", { enumerable: true, get: function () { return json_js_1.renderJSON; } });
34
+ var gate_js_1 = require("./gate/gate.js");
35
+ Object.defineProperty(exports, "checkGate", { enumerable: true, get: function () { return gate_js_1.checkGate; } });
36
+ var prompts_js_1 = require("./llm/prompts.js");
37
+ Object.defineProperty(exports, "buildLLMPrompt", { enumerable: true, get: function () { return prompts_js_1.buildLLMPrompt; } });
38
+ var mistral_js_1 = require("./llm/mistral.js");
39
+ Object.defineProperty(exports, "callMistral", { enumerable: true, get: function () { return mistral_js_1.callMistral; } });
40
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qBAAqB;AACrB,oDAAkC;AAClC,oDAAkC;AAClC,gDAAgD;AAAvC,uGAAA,UAAU,OAAA;AACnB,8CAAgD;AAAvC,mGAAA,SAAS,OAAA;AAClB,oDAAgF;AAAvE,iHAAA,oBAAoB,OAAA;AAAE,6GAAA,gBAAgB,OAAA;AAC/C,oEAAuE;AAA9D,kHAAA,iBAAiB,OAAA;AAC1B,uDAAyD;AAAhD,6GAAA,cAAc,OAAA;AACvB,+CAAiD;AAAxC,qGAAA,UAAU,OAAA;AACnB,0CAA2C;AAAlC,oGAAA,SAAS,OAAA;AAClB,+CAAkD;AAAzC,4GAAA,cAAc,OAAA;AACvB,+CAA+C;AAAtC,yGAAA,WAAW,OAAA"}
@@ -0,0 +1,6 @@
1
+ export interface MistralConfig {
2
+ apiKey: string;
3
+ model?: string;
4
+ }
5
+ export declare function callMistral(config: MistralConfig, systemPrompt: string, userPrompt: string): Promise<string>;
6
+ //# sourceMappingURL=mistral.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mistral.d.ts","sourceRoot":"","sources":["../../src/llm/mistral.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAsB,WAAW,CAC/B,MAAM,EAAE,aAAa,EACrB,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC,CA8BjB"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.callMistral = callMistral;
4
+ const mistralai_1 = require("@mistralai/mistralai");
5
+ async function callMistral(config, systemPrompt, userPrompt) {
6
+ const client = new mistralai_1.Mistral({
7
+ apiKey: config.apiKey,
8
+ });
9
+ const response = await client.chat.complete({
10
+ model: config.model || "mistral-medium-2508",
11
+ temperature: 0.1,
12
+ messages: [
13
+ { role: "system", content: systemPrompt },
14
+ { role: "user", content: userPrompt },
15
+ ],
16
+ });
17
+ const content = response.choices[0].message.content;
18
+ if (typeof content === "string") {
19
+ return content;
20
+ }
21
+ if (Array.isArray(content)) {
22
+ return content
23
+ .map((c) => {
24
+ if (typeof c === "string")
25
+ return c;
26
+ if (c.type === "text" && "text" in c)
27
+ return c.text;
28
+ return "";
29
+ })
30
+ .join("");
31
+ }
32
+ return "";
33
+ }
34
+ //# sourceMappingURL=mistral.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mistral.js","sourceRoot":"","sources":["../../src/llm/mistral.ts"],"names":[],"mappings":";;AAOA,kCAkCC;AAzCD,oDAA+C;AAOxC,KAAK,UAAU,WAAW,CAC/B,MAAqB,EACrB,YAAoB,EACpB,UAAkB;IAElB,MAAM,MAAM,GAAG,IAAI,mBAAO,CAAC;QACzB,MAAM,EAAE,MAAM,CAAC,MAAM;KACtB,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC;QAC1C,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,qBAAqB;QAC5C,WAAW,EAAE,GAAG;QAChB,QAAQ,EAAE;YACR,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE;YACzC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE;SACtC;KACF,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IACpD,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChC,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3B,OAAO,OAAO;aACX,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;YACT,IAAI,OAAO,CAAC,KAAK,QAAQ;gBAAE,OAAO,CAAC,CAAC;YACpC,IAAI,CAAC,CAAC,IAAI,KAAK,MAAM,IAAI,MAAM,IAAI,CAAC;gBAAE,OAAO,CAAC,CAAC,IAAI,CAAC;YACpD,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC;aACD,IAAI,CAAC,EAAE,CAAC,CAAC;IACd,CAAC;IAED,OAAO,EAAE,CAAC;AACZ,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { Context } from "../types/report.js";
2
+ export declare function buildLLMPrompt(context: Context, migrationReport: string, dbRules?: string, futureConstraints?: string, systemPrompt?: string, analysisPrompt?: string): {
3
+ system: string;
4
+ user: string;
5
+ };
6
+ //# sourceMappingURL=prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/llm/prompts.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,wBAAgB,cAAc,CAC5B,OAAO,EAAE,OAAO,EAChB,eAAe,EAAE,MAAM,EACvB,OAAO,CAAC,EAAE,MAAM,EAChB,iBAAiB,CAAC,EAAE,MAAM,EAC1B,YAAY,CAAC,EAAE,MAAM,EACrB,cAAc,CAAC,EAAE,MAAM,GACtB;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CA+ClC"}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildLLMPrompt = buildLLMPrompt;
4
+ const defaults_js_1 = require("../config/defaults.js");
5
+ function buildLLMPrompt(context, migrationReport, dbRules, futureConstraints, systemPrompt, analysisPrompt) {
6
+ const rules = dbRules || defaults_js_1.DEFAULT_DB_RULES;
7
+ const future = futureConstraints || defaults_js_1.DEFAULT_FUTURE_CONSTRAINTS;
8
+ const system = systemPrompt || defaults_js_1.DEFAULT_SYSTEM_PROMPT;
9
+ const analysis = analysisPrompt || defaults_js_1.DEFAULT_ANALYSIS_PROMPT;
10
+ const userPrompt = `
11
+ You are given:
12
+ - A deterministic migration risk report
13
+ - The DB architecture rules
14
+ - Known future constraints
15
+ - Repository context (JSON)
16
+
17
+ Task:
18
+ - Interpret the findings from an architectural perspective.
19
+ - Identify future feature blockers.
20
+ - Reclassify severity if needed (never downgrade CRITICAL/HIGH).
21
+ - Provide a concise, actionable architectural summary.
22
+
23
+ Output format (Markdown):
24
+ # Architectural Interpretation
25
+ ## Executive Summary
26
+ ## Future Feature Blockers
27
+ ## Architectural Risks
28
+ ## Recommended Mitigations
29
+ `;
30
+ const userContent = `
31
+ === DB RULES ===
32
+ ${rules}
33
+
34
+ === FUTURE CONSTRAINTS ===
35
+ ${future}
36
+
37
+ === CONTEXT (JSON) ===
38
+ ${JSON.stringify(context, null, 2)}
39
+
40
+ === MIGRATION REPORT ===
41
+ ${migrationReport}
42
+
43
+ ${userPrompt}
44
+ `.trim();
45
+ return {
46
+ system,
47
+ user: userContent,
48
+ };
49
+ }
50
+ //# sourceMappingURL=prompts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../src/llm/prompts.ts"],"names":[],"mappings":";;AAQA,wCAsDC;AA9DD,uDAK+B;AAG/B,SAAgB,cAAc,CAC5B,OAAgB,EAChB,eAAuB,EACvB,OAAgB,EAChB,iBAA0B,EAC1B,YAAqB,EACrB,cAAuB;IAEvB,MAAM,KAAK,GAAG,OAAO,IAAI,8BAAgB,CAAC;IAC1C,MAAM,MAAM,GAAG,iBAAiB,IAAI,wCAA0B,CAAC;IAC/D,MAAM,MAAM,GAAG,YAAY,IAAI,mCAAqB,CAAC;IACrD,MAAM,QAAQ,GAAG,cAAc,IAAI,qCAAuB,CAAC;IAE3D,MAAM,UAAU,GAAG;;;;;;;;;;;;;;;;;;;CAmBpB,CAAC;IAEA,MAAM,WAAW,GAAG;;EAEpB,KAAK;;;EAGL,MAAM;;;EAGN,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;;;EAGhC,eAAe;;EAEf,UAAU;GACT,CAAC,IAAI,EAAE,CAAC;IAET,OAAO;QACL,MAAM;QACN,IAAI,EAAE,WAAW;KAClB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { MigrationReport } from "../types/report.js";
2
+ export declare function renderJSON(report: MigrationReport): string;
3
+ //# sourceMappingURL=json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/reporters/json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,wBAAgB,UAAU,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAE1D"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.renderJSON = renderJSON;
4
+ function renderJSON(report) {
5
+ return JSON.stringify(report, null, 2);
6
+ }
7
+ //# sourceMappingURL=json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.js","sourceRoot":"","sources":["../../src/reporters/json.ts"],"names":[],"mappings":";;AAEA,gCAEC;AAFD,SAAgB,UAAU,CAAC,MAAuB;IAChD,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACzC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Finding, ReportMeta } from "../types/report.js";
2
+ export declare function renderMarkdown(findings: Finding[], meta: ReportMeta): string;
3
+ //# sourceMappingURL=markdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/reporters/markdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAY,MAAM,oBAAoB,CAAC;AAMnE,wBAAgB,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM,CA8B5E"}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.renderMarkdown = renderMarkdown;
4
+ function severityRank(s) {
5
+ return { LOW: 1, MEDIUM: 2, HIGH: 3, CRITICAL: 4 }[s];
6
+ }
7
+ function renderMarkdown(findings, meta) {
8
+ const max = findings.length > 0
9
+ ? findings.sort((a, b) => severityRank(b.severity) - severityRank(a.severity))[0]?.severity ?? "LOW"
10
+ : "LOW";
11
+ const lines = [];
12
+ lines.push(`# DB Scalability Guardian — Migration Report`);
13
+ lines.push(``);
14
+ lines.push(`Compared range: **${meta.comparedRange}**`);
15
+ lines.push(`Generated at: **${meta.generatedAt}**`);
16
+ lines.push(`Overall severity: **${max}**`);
17
+ lines.push(`Findings: **${findings.length}**`);
18
+ lines.push(``);
19
+ const bySeverity = ["CRITICAL", "HIGH", "MEDIUM", "LOW"];
20
+ for (const sev of bySeverity) {
21
+ const items = findings.filter((f) => f.severity === sev);
22
+ if (!items.length)
23
+ continue;
24
+ lines.push(`## ${sev}`);
25
+ lines.push(``);
26
+ for (const f of items) {
27
+ lines.push(`### ${f.title}`);
28
+ if (f.file)
29
+ lines.push(`- File: \`${f.file}\``);
30
+ lines.push(`- Evidence: ${f.evidence}`);
31
+ lines.push(`- Impact: ${f.impact}`);
32
+ lines.push(`- Mitigation: ${f.mitigation}`);
33
+ lines.push(``);
34
+ }
35
+ }
36
+ return lines.join("\n");
37
+ }
38
+ //# sourceMappingURL=markdown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown.js","sourceRoot":"","sources":["../../src/reporters/markdown.ts"],"names":[],"mappings":";;AAMA,wCA8BC;AAlCD,SAAS,YAAY,CAAC,CAAW;IAC/B,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACxD,CAAC;AAED,SAAgB,cAAc,CAAC,QAAmB,EAAE,IAAgB;IAClE,MAAM,GAAG,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC;QAC7B,CAAC,CAAC,QAAQ,CAAC,IAAI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C,CAAC,IAAI;gBAAE,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC;YAChD,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;YACxC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;YACpC,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC;YAC5C,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACjB,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { Severity } from "./report.js";
2
+ export interface GuardianConfig {
3
+ baseBranch?: string;
4
+ headBranch?: string;
5
+ database?: {
6
+ engine?: string;
7
+ orm?: string;
8
+ migrationsPath?: string;
9
+ };
10
+ futureConstraints?: string[];
11
+ llm?: {
12
+ provider?: "mistral";
13
+ model?: string;
14
+ optional?: boolean;
15
+ apiKey?: string;
16
+ };
17
+ gate?: {
18
+ failOn?: Severity[];
19
+ };
20
+ }
21
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,MAAM,WAAW,cAAc;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE;QACT,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,CAAC;IACF,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,GAAG,CAAC,EAAE;QACJ,QAAQ,CAAC,EAAE,SAAS,CAAC;QACrB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,IAAI,CAAC,EAAE;QACL,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC;KACrB,CAAC;CACH"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":""}
@@ -0,0 +1,37 @@
1
+ export type Severity = "LOW" | "MEDIUM" | "HIGH" | "CRITICAL";
2
+ export interface Finding {
3
+ id: string;
4
+ severity: Severity;
5
+ title: string;
6
+ evidence: string;
7
+ impact: string;
8
+ mitigation: string;
9
+ file?: string;
10
+ }
11
+ export interface ReportMeta {
12
+ baseBranch: string;
13
+ headBranch: string;
14
+ comparedRange: string;
15
+ changedFilesCount: number;
16
+ generatedAt: string;
17
+ }
18
+ export interface MigrationReport {
19
+ meta: ReportMeta;
20
+ findings: Finding[];
21
+ }
22
+ export interface Context {
23
+ meta: ReportMeta;
24
+ database: {
25
+ engine: string;
26
+ orm: string;
27
+ migrationsPath: string;
28
+ modifiedMigrations: string[];
29
+ };
30
+ prisma: {
31
+ schemaPath: string;
32
+ schema: string | null;
33
+ };
34
+ backendHints: string[];
35
+ changedFiles: string[];
36
+ }
37
+ //# sourceMappingURL=report.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/types/report.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;AAE9D,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,OAAO,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE;QACR,MAAM,EAAE,MAAM,CAAC;QACf,GAAG,EAAE,MAAM,CAAC;QACZ,cAAc,EAAE,MAAM,CAAC;QACvB,kBAAkB,EAAE,MAAM,EAAE,CAAC;KAC9B,CAAC;IACF,MAAM,EAAE;QACN,UAAU,EAAE,MAAM,CAAC;QACnB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;KACvB,CAAC;IACF,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report.js","sourceRoot":"","sources":["../../src/types/report.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "db-scalability-guardian",
3
+ "version": "1.0.0",
4
+ "description": "A CLI tool for analyzing database migrations and schema changes for scalability and evolvability risks",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "bin": {
8
+ "db-scalability-guardian": "./dist/cli/index.js"
9
+ },
10
+ "scripts": {
11
+ "build": "tsc",
12
+ "prepare": "npm run build",
13
+ "test": "echo \"Error: no test specified\" && exit 1"
14
+ },
15
+ "keywords": [
16
+ "database",
17
+ "migrations",
18
+ "scalability",
19
+ "postgres",
20
+ "prisma",
21
+ "ci-cd"
22
+ ],
23
+ "author": "",
24
+ "license": "ISC",
25
+ "type": "commonjs",
26
+ "dependencies": {
27
+ "@mistralai/mistralai": "^1.11.0"
28
+ },
29
+ "devDependencies": {
30
+ "@types/node": "^25.0.3",
31
+ "typescript": "^5.7.3"
32
+ },
33
+ "engines": {
34
+ "node": ">=18.0.0"
35
+ },
36
+ "files": [
37
+ "dist",
38
+ "README.md"
39
+ ]
40
+ }
41
+