@rigour-labs/core 3.0.6 → 4.0.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.
Files changed (46) hide show
  1. package/dist/deep/fact-extractor.d.ts +80 -0
  2. package/dist/deep/fact-extractor.js +626 -0
  3. package/dist/deep/fact-extractor.test.d.ts +1 -0
  4. package/dist/deep/fact-extractor.test.js +547 -0
  5. package/dist/deep/index.d.ts +14 -0
  6. package/dist/deep/index.js +12 -0
  7. package/dist/deep/prompts.d.ts +22 -0
  8. package/dist/deep/prompts.js +374 -0
  9. package/dist/deep/prompts.test.d.ts +1 -0
  10. package/dist/deep/prompts.test.js +220 -0
  11. package/dist/deep/verifier.d.ts +16 -0
  12. package/dist/deep/verifier.js +388 -0
  13. package/dist/deep/verifier.test.d.ts +1 -0
  14. package/dist/deep/verifier.test.js +514 -0
  15. package/dist/gates/deep-analysis.d.ts +28 -0
  16. package/dist/gates/deep-analysis.js +302 -0
  17. package/dist/gates/runner.d.ts +4 -2
  18. package/dist/gates/runner.js +46 -1
  19. package/dist/index.d.ts +10 -0
  20. package/dist/index.js +12 -2
  21. package/dist/inference/cloud-provider.d.ts +34 -0
  22. package/dist/inference/cloud-provider.js +126 -0
  23. package/dist/inference/index.d.ts +17 -0
  24. package/dist/inference/index.js +23 -0
  25. package/dist/inference/model-manager.d.ts +26 -0
  26. package/dist/inference/model-manager.js +106 -0
  27. package/dist/inference/sidecar-provider.d.ts +15 -0
  28. package/dist/inference/sidecar-provider.js +153 -0
  29. package/dist/inference/types.d.ts +77 -0
  30. package/dist/inference/types.js +19 -0
  31. package/dist/settings.d.ts +104 -0
  32. package/dist/settings.js +186 -0
  33. package/dist/storage/db.d.ts +16 -0
  34. package/dist/storage/db.js +132 -0
  35. package/dist/storage/findings.d.ts +14 -0
  36. package/dist/storage/findings.js +38 -0
  37. package/dist/storage/index.d.ts +9 -0
  38. package/dist/storage/index.js +8 -0
  39. package/dist/storage/patterns.d.ts +35 -0
  40. package/dist/storage/patterns.js +62 -0
  41. package/dist/storage/scans.d.ts +42 -0
  42. package/dist/storage/scans.js +55 -0
  43. package/dist/templates/universal-config.js +19 -0
  44. package/dist/types/index.d.ts +438 -15
  45. package/dist/types/index.js +41 -1
  46. package/package.json +6 -2
@@ -168,6 +168,30 @@ export const GatesSchema = z.object({
168
168
  max_mocks_per_test: z.number().optional().default(5),
169
169
  ignore_patterns: z.array(z.string()).optional().default([]),
170
170
  }).optional().default({}),
171
+ // v4.0+ Deep Analysis (LLM-powered)
172
+ deep: z.object({
173
+ enabled: z.boolean().optional().default(false),
174
+ pro: z.boolean().optional().default(false),
175
+ provider: z.string().optional().default('local'), // 'local' for sidecar, or any cloud: 'claude', 'openai', 'gemini', 'groq', 'mistral', 'together', etc.
176
+ api_key: z.string().optional(),
177
+ api_base_url: z.string().optional(), // custom API base URL (for self-hosted, proxies, any OpenAI-compatible endpoint)
178
+ model_name: z.string().optional(), // cloud model name override (e.g. 'gpt-4o', 'claude-sonnet-4-5-20250929', 'gemini-pro')
179
+ model_path: z.string().optional(), // custom local GGUF model path override
180
+ threads: z.number().optional().default(4),
181
+ max_tokens: z.number().optional().default(512),
182
+ temperature: z.number().optional().default(0.1),
183
+ timeout_ms: z.number().optional().default(60000),
184
+ checks: z.object({
185
+ solid: z.boolean().optional().default(true),
186
+ dry: z.boolean().optional().default(true),
187
+ design_patterns: z.boolean().optional().default(true),
188
+ language_idioms: z.boolean().optional().default(true),
189
+ error_handling: z.boolean().optional().default(true),
190
+ test_quality: z.boolean().optional().default(true),
191
+ architecture: z.boolean().optional().default(true),
192
+ code_smells: z.boolean().optional().default(true),
193
+ }).optional().default({}),
194
+ }).optional().default({}),
171
195
  });
172
196
  export const CommandsSchema = z.object({
173
197
  format: z.string().optional(),
@@ -205,7 +229,7 @@ export const ConfigSchema = z.object({
205
229
  export const StatusSchema = z.enum(['PASS', 'FAIL', 'SKIP', 'ERROR']);
206
230
  export const SeveritySchema = z.enum(['critical', 'high', 'medium', 'low', 'info']);
207
231
  /** Provenance tags — lets dashboards/agents filter by what matters */
208
- export const ProvenanceSchema = z.enum(['ai-drift', 'traditional', 'security', 'governance']);
232
+ export const ProvenanceSchema = z.enum(['ai-drift', 'traditional', 'security', 'governance', 'deep-analysis']);
209
233
  /** Severity weights for score calculation */
210
234
  export const SEVERITY_WEIGHTS = {
211
235
  critical: 20,
@@ -224,6 +248,11 @@ export const FailureSchema = z.object({
224
248
  line: z.number().optional(),
225
249
  endLine: z.number().optional(),
226
250
  hint: z.string().optional(),
251
+ // Deep analysis fields
252
+ confidence: z.number().min(0).max(1).optional(), // LLM confidence score
253
+ source: z.enum(['ast', 'llm', 'hybrid']).optional(), // Finding source
254
+ category: z.string().optional(), // e.g. 'srp_violation', 'god_function'
255
+ verified: z.boolean().optional(), // AST-verified LLM finding
227
256
  });
228
257
  export const ReportSchema = z.object({
229
258
  status: StatusSchema,
@@ -234,12 +263,23 @@ export const ReportSchema = z.object({
234
263
  score: z.number().optional(),
235
264
  ai_health_score: z.number().optional(),
236
265
  structural_score: z.number().optional(),
266
+ code_quality_score: z.number().optional(), // Deep analysis score
237
267
  severity_breakdown: z.record(z.number()).optional(),
238
268
  provenance_breakdown: z.object({
239
269
  'ai-drift': z.number(),
240
270
  traditional: z.number(),
241
271
  security: z.number(),
242
272
  governance: z.number(),
273
+ 'deep-analysis': z.number(),
274
+ }).optional(),
275
+ deep: z.object({
276
+ enabled: z.boolean(),
277
+ tier: z.enum(['deep', 'pro', 'cloud']).optional(),
278
+ model: z.string().optional(),
279
+ total_ms: z.number().optional(),
280
+ files_analyzed: z.number().optional(),
281
+ findings_count: z.number().optional(),
282
+ findings_verified: z.number().optional(),
243
283
  }).optional(),
244
284
  }),
245
285
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rigour-labs/core",
3
- "version": "3.0.6",
3
+ "version": "4.0.1",
4
4
  "description": "Deterministic quality gate engine for AI-generated code. AST analysis, drift detection, and Fix Packet generation across TypeScript, JavaScript, Python, Go, Ruby, and C#.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://rigour.run",
@@ -55,9 +55,13 @@
55
55
  "zod": "^3.22.4"
56
56
  },
57
57
  "optionalDependencies": {
58
- "@xenova/transformers": "^2.17.2"
58
+ "@anthropic-ai/sdk": "^0.30.1",
59
+ "@xenova/transformers": "^2.17.2",
60
+ "better-sqlite3": "^11.0.0",
61
+ "openai": "^4.104.0"
59
62
  },
60
63
  "devDependencies": {
64
+ "@types/better-sqlite3": "^7.6.12",
61
65
  "@types/fs-extra": "^11.0.4",
62
66
  "@types/micromatch": "^4.0.10",
63
67
  "@types/node": "^25.0.3",