@rigour-labs/core 3.0.5 → 3.0.6

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 (47) hide show
  1. package/dist/gates/deprecated-apis-rules-lang.d.ts +21 -0
  2. package/dist/gates/deprecated-apis-rules-lang.js +311 -0
  3. package/dist/gates/deprecated-apis-rules-node.d.ts +19 -0
  4. package/dist/gates/deprecated-apis-rules-node.js +199 -0
  5. package/dist/gates/deprecated-apis-rules.d.ts +6 -0
  6. package/dist/gates/deprecated-apis-rules.js +6 -0
  7. package/dist/gates/deprecated-apis.js +1 -502
  8. package/dist/gates/hallucinated-imports-lang.d.ts +16 -0
  9. package/dist/gates/hallucinated-imports-lang.js +374 -0
  10. package/dist/gates/hallucinated-imports-stdlib.d.ts +12 -0
  11. package/dist/gates/hallucinated-imports-stdlib.js +228 -0
  12. package/dist/gates/hallucinated-imports.d.ts +0 -98
  13. package/dist/gates/hallucinated-imports.js +10 -678
  14. package/dist/gates/phantom-apis-data.d.ts +33 -0
  15. package/dist/gates/phantom-apis-data.js +398 -0
  16. package/dist/gates/phantom-apis.js +1 -393
  17. package/dist/gates/phantom-apis.test.js +52 -0
  18. package/dist/gates/promise-safety-helpers.d.ts +19 -0
  19. package/dist/gates/promise-safety-helpers.js +101 -0
  20. package/dist/gates/promise-safety-rules.d.ts +7 -0
  21. package/dist/gates/promise-safety-rules.js +19 -0
  22. package/dist/gates/promise-safety.d.ts +1 -21
  23. package/dist/gates/promise-safety.js +51 -257
  24. package/dist/gates/test-quality-lang.d.ts +30 -0
  25. package/dist/gates/test-quality-lang.js +188 -0
  26. package/dist/gates/test-quality.d.ts +0 -14
  27. package/dist/gates/test-quality.js +13 -186
  28. package/dist/pattern-index/indexer-helpers.d.ts +38 -0
  29. package/dist/pattern-index/indexer-helpers.js +111 -0
  30. package/dist/pattern-index/indexer-lang.d.ts +13 -0
  31. package/dist/pattern-index/indexer-lang.js +244 -0
  32. package/dist/pattern-index/indexer-ts.d.ts +22 -0
  33. package/dist/pattern-index/indexer-ts.js +258 -0
  34. package/dist/pattern-index/indexer.d.ts +4 -106
  35. package/dist/pattern-index/indexer.js +58 -707
  36. package/dist/pattern-index/staleness-data.d.ts +6 -0
  37. package/dist/pattern-index/staleness-data.js +262 -0
  38. package/dist/pattern-index/staleness.js +1 -258
  39. package/dist/templates/index.d.ts +12 -16
  40. package/dist/templates/index.js +11 -527
  41. package/dist/templates/paradigms.d.ts +2 -0
  42. package/dist/templates/paradigms.js +46 -0
  43. package/dist/templates/presets.d.ts +14 -0
  44. package/dist/templates/presets.js +227 -0
  45. package/dist/templates/universal-config.d.ts +2 -0
  46. package/dist/templates/universal-config.js +171 -0
  47. package/package.json +1 -1
@@ -1,527 +1,11 @@
1
- export const TEMPLATES = [
2
- {
3
- name: 'ui',
4
- markers: [
5
- 'react',
6
- 'next',
7
- 'vue',
8
- 'svelte',
9
- 'next.config.js',
10
- 'vite.config.ts',
11
- 'tailwind.config.js',
12
- 'base.css',
13
- 'index.html',
14
- ],
15
- config: {
16
- preset: 'ui',
17
- ignore: [
18
- '.git/**',
19
- 'node_modules/**',
20
- 'dist/**',
21
- 'build/**',
22
- '.next/**',
23
- '.nuxt/**',
24
- '.svelte-kit/**',
25
- 'coverage/**',
26
- '.turbo/**',
27
- ],
28
- gates: {
29
- max_file_lines: 300,
30
- required_files: ['docs/SPEC.md', 'docs/ARCH.md', 'README.md'],
31
- },
32
- planned: [
33
- 'Layer Boundary: Components cannot import from DB',
34
- 'Prop-Drilling Detection: Max depth 5',
35
- ],
36
- },
37
- },
38
- {
39
- name: 'api',
40
- markers: [
41
- 'express',
42
- 'fastify',
43
- 'nestjs',
44
- 'go.mod',
45
- 'requirements.txt',
46
- 'pyproject.toml',
47
- 'app.py',
48
- 'main.go',
49
- 'index.js',
50
- ],
51
- config: {
52
- preset: 'api',
53
- ignore: [
54
- '.git/**',
55
- // Node.js
56
- 'node_modules/**',
57
- 'dist/**',
58
- // Python
59
- 'venv/**',
60
- '.venv/**',
61
- '__pycache__/**',
62
- '*.pyc',
63
- '.tox/**',
64
- '.pytest_cache/**',
65
- '.mypy_cache/**',
66
- '*.egg-info/**',
67
- // Go
68
- 'vendor/**',
69
- ],
70
- gates: {
71
- max_file_lines: 400,
72
- required_files: ['docs/SPEC.md', 'docs/ARCH.md', 'README.md'],
73
- },
74
- planned: [
75
- 'Service Layer Enforcement: Controllers -> Services only',
76
- 'Repo Pattern: Databases access isolated to repositories/',
77
- ],
78
- },
79
- },
80
- {
81
- name: 'infra',
82
- markers: [
83
- 'Dockerfile',
84
- 'docker-compose.yml',
85
- 'main.tf',
86
- 'k8s/',
87
- 'helm/',
88
- 'ansible/',
89
- ],
90
- config: {
91
- preset: 'infra',
92
- ignore: [
93
- '.git/**',
94
- '.terraform/**',
95
- '*.tfstate',
96
- '*.tfstate.backup',
97
- '.terragrunt-cache/**',
98
- 'charts/**/*.tgz',
99
- ],
100
- gates: {
101
- max_file_lines: 300,
102
- required_files: ['docs/RUNBOOK.md', 'docs/ARCH.md', 'README.md'],
103
- },
104
- },
105
- },
106
- {
107
- name: 'data',
108
- markers: [
109
- 'ipynb',
110
- 'spark',
111
- 'pandas',
112
- 'data/',
113
- 'dbt_project.yml',
114
- ],
115
- config: {
116
- preset: 'data',
117
- ignore: [
118
- '.git/**',
119
- '.ipynb_checkpoints/**',
120
- '__pycache__/**',
121
- '*.pyc',
122
- 'dbt_packages/**',
123
- 'target/**',
124
- 'logs/**',
125
- '*.parquet',
126
- '*.csv',
127
- ],
128
- gates: {
129
- max_file_lines: 500,
130
- required_files: ['docs/DATA_DICTIONARY.md', 'docs/PIPELINE.md', 'README.md'],
131
- },
132
- planned: [
133
- 'Stochastic Determinism: Seed setting enforcement',
134
- 'Data Leaks: Detecting PII in notebook outputs',
135
- ],
136
- },
137
- },
138
- // --- Regulated Industry Presets ---
139
- {
140
- name: 'healthcare',
141
- markers: [
142
- 'hl7', 'fhir', 'hipaa', 'medical', 'patient', 'health',
143
- 'ehr', 'phi', 'dicom', 'icd-10', 'snomed',
144
- ],
145
- config: {
146
- preset: 'healthcare',
147
- ignore: [
148
- '.git/**', 'node_modules/**', 'dist/**', 'build/**',
149
- 'venv/**', '.venv/**', '__pycache__/**',
150
- ],
151
- gates: {
152
- max_file_lines: 300,
153
- required_files: ['docs/COMPLIANCE.md', 'docs/SPEC.md', 'docs/ARCH.md', 'README.md'],
154
- security: {
155
- enabled: true,
156
- sql_injection: true,
157
- xss: true,
158
- path_traversal: true,
159
- hardcoded_secrets: true,
160
- insecure_randomness: true,
161
- command_injection: true,
162
- block_on_severity: 'critical',
163
- },
164
- },
165
- },
166
- },
167
- {
168
- name: 'fintech',
169
- markers: [
170
- 'trading', 'payment', 'kyc', 'aml', 'pci', 'transaction',
171
- 'ledger', 'banking', 'stripe', 'plaid', 'sox',
172
- ],
173
- config: {
174
- preset: 'fintech',
175
- ignore: [
176
- '.git/**', 'node_modules/**', 'dist/**', 'build/**',
177
- 'venv/**', '.venv/**', '__pycache__/**', 'vendor/**',
178
- ],
179
- gates: {
180
- max_file_lines: 350,
181
- required_files: ['docs/AUDIT_LOG.md', 'docs/SPEC.md', 'docs/ARCH.md', 'README.md'],
182
- security: {
183
- enabled: true,
184
- sql_injection: true,
185
- xss: true,
186
- path_traversal: true,
187
- hardcoded_secrets: true,
188
- insecure_randomness: true,
189
- command_injection: true,
190
- block_on_severity: 'high',
191
- },
192
- agent_team: {
193
- enabled: true,
194
- max_concurrent_agents: 3,
195
- cross_agent_pattern_check: true,
196
- handoff_verification: true,
197
- task_ownership: 'strict',
198
- },
199
- },
200
- },
201
- },
202
- {
203
- name: 'government',
204
- markers: [
205
- 'fedramp', 'nist', 'cmmc', 'federal', 'govcloud',
206
- 'il4', 'il5', 'fisma', 'itar', 'cui',
207
- ],
208
- config: {
209
- preset: 'government',
210
- ignore: [
211
- '.git/**', 'node_modules/**', 'dist/**', 'build/**',
212
- 'venv/**', '.venv/**', '__pycache__/**', 'vendor/**',
213
- ],
214
- gates: {
215
- max_file_lines: 250,
216
- required_files: ['docs/SECURITY.md', 'docs/SPEC.md', 'docs/ARCH.md', 'README.md'],
217
- ast: {
218
- complexity: 8,
219
- max_methods: 10,
220
- max_params: 4,
221
- max_nesting: 3,
222
- max_inheritance_depth: 3,
223
- max_class_dependencies: 5,
224
- max_function_lines: 40,
225
- },
226
- security: {
227
- enabled: true,
228
- sql_injection: true,
229
- xss: true,
230
- path_traversal: true,
231
- hardcoded_secrets: true,
232
- insecure_randomness: true,
233
- command_injection: true,
234
- block_on_severity: 'medium',
235
- },
236
- agent_team: {
237
- enabled: true,
238
- max_concurrent_agents: 3,
239
- cross_agent_pattern_check: true,
240
- handoff_verification: true,
241
- task_ownership: 'strict',
242
- },
243
- checkpoint: {
244
- enabled: true,
245
- interval_minutes: 10,
246
- quality_threshold: 85,
247
- drift_detection: true,
248
- auto_save_on_failure: true,
249
- },
250
- },
251
- },
252
- },
253
- // DevSecOps / Security SRE preset
254
- {
255
- name: 'devsecops',
256
- markers: [
257
- 'trivy', 'snyk', 'semgrep', 'sonarqube', 'owasp',
258
- 'sast', 'dast', 'pentest', 'vulnerability', 'cve',
259
- 'security-scan', 'falco', 'wazuh', 'ossec',
260
- ],
261
- config: {
262
- preset: 'devsecops',
263
- ignore: [
264
- '.git/**', 'node_modules/**', 'dist/**', 'build/**',
265
- 'venv/**', '.venv/**', '__pycache__/**', 'vendor/**',
266
- ],
267
- gates: {
268
- max_file_lines: 300,
269
- required_files: ['docs/SECURITY.md', 'docs/RUNBOOK.md', 'README.md'],
270
- ast: {
271
- complexity: 10,
272
- max_methods: 10,
273
- max_params: 5,
274
- max_nesting: 3,
275
- max_inheritance_depth: 3,
276
- max_class_dependencies: 5,
277
- max_function_lines: 50,
278
- },
279
- security: {
280
- enabled: true,
281
- sql_injection: true,
282
- xss: true,
283
- path_traversal: true,
284
- hardcoded_secrets: true,
285
- insecure_randomness: true,
286
- command_injection: true,
287
- block_on_severity: 'high',
288
- },
289
- agent_team: {
290
- enabled: true,
291
- max_concurrent_agents: 3,
292
- cross_agent_pattern_check: true,
293
- handoff_verification: true,
294
- task_ownership: 'strict',
295
- },
296
- },
297
- },
298
- },
299
- ];
300
- export const PARADIGM_TEMPLATES = [
301
- {
302
- name: 'oop',
303
- markers: [
304
- 'class ',
305
- 'interface ',
306
- 'implements ',
307
- 'extends ',
308
- 'constructor(',
309
- 'private ',
310
- 'public ',
311
- 'protected ',
312
- ],
313
- config: {
314
- paradigm: 'oop',
315
- gates: {
316
- max_file_lines: 400,
317
- ast: {
318
- complexity: 10,
319
- max_methods: 10,
320
- max_params: 5,
321
- max_nesting: 4,
322
- max_inheritance_depth: 3,
323
- max_class_dependencies: 5,
324
- max_function_lines: 60,
325
- },
326
- },
327
- },
328
- },
329
- {
330
- name: 'functional',
331
- // Removed '=>' as primary marker - too broad (appears in OOP callbacks)
332
- markers: [
333
- 'export const',
334
- 'reduce(',
335
- '.pipe(',
336
- 'compose(',
337
- 'curry(',
338
- 'readonly ',
339
- ],
340
- config: {
341
- paradigm: 'functional',
342
- gates: {
343
- max_file_lines: 350,
344
- ast: {
345
- complexity: 8,
346
- max_methods: 15, // Functions, not classes
347
- max_params: 4,
348
- max_nesting: 3,
349
- max_inheritance_depth: 3,
350
- max_class_dependencies: 5,
351
- max_function_lines: 40,
352
- },
353
- },
354
- },
355
- },
356
- ];
357
- export const UNIVERSAL_CONFIG = {
358
- version: 1,
359
- commands: {},
360
- gates: {
361
- max_file_lines: 500,
362
- forbid_todos: true,
363
- forbid_fixme: true,
364
- forbid_paths: [],
365
- required_files: ['docs/SPEC.md', 'docs/ARCH.md', 'docs/DECISIONS.md', 'docs/TASKS.md'],
366
- ast: {
367
- complexity: 10,
368
- max_methods: 10,
369
- max_params: 5,
370
- max_nesting: 4,
371
- max_inheritance_depth: 3,
372
- max_class_dependencies: 5,
373
- max_function_lines: 50,
374
- },
375
- dependencies: {
376
- forbid: [],
377
- },
378
- architecture: {
379
- boundaries: [],
380
- },
381
- safety: {
382
- max_files_changed_per_cycle: 10,
383
- protected_paths: ['.github/**', 'docs/**', 'rigour.yml'],
384
- },
385
- context: {
386
- enabled: true,
387
- sensitivity: 0.8,
388
- mining_depth: 100,
389
- ignored_patterns: [],
390
- cross_file_patterns: true,
391
- naming_consistency: true,
392
- import_relationships: true,
393
- max_cross_file_depth: 50,
394
- },
395
- environment: {
396
- enabled: true,
397
- enforce_contracts: true,
398
- tools: {},
399
- required_env: [],
400
- },
401
- retry_loop_breaker: {
402
- enabled: true,
403
- max_retries: 3,
404
- auto_classify: true,
405
- doc_sources: {},
406
- },
407
- agent_team: {
408
- enabled: false,
409
- max_concurrent_agents: 3,
410
- cross_agent_pattern_check: true,
411
- handoff_verification: true,
412
- task_ownership: 'strict',
413
- },
414
- checkpoint: {
415
- enabled: false,
416
- interval_minutes: 15,
417
- quality_threshold: 80,
418
- drift_detection: true,
419
- auto_save_on_failure: true,
420
- },
421
- security: {
422
- enabled: true,
423
- sql_injection: true,
424
- xss: true,
425
- path_traversal: true,
426
- hardcoded_secrets: true,
427
- insecure_randomness: true,
428
- command_injection: true,
429
- block_on_severity: 'high',
430
- },
431
- adaptive: {
432
- enabled: false,
433
- base_coverage_threshold: 80,
434
- base_quality_threshold: 80,
435
- auto_detect_tier: true,
436
- },
437
- staleness: {
438
- enabled: false,
439
- rules: {
440
- 'no-var': true,
441
- 'no-commonjs': false,
442
- 'no-arguments': false,
443
- 'prefer-arrow': false,
444
- 'prefer-template': false,
445
- 'prefer-spread': false,
446
- 'prefer-rest': false,
447
- 'prefer-const': false,
448
- },
449
- },
450
- duplication_drift: {
451
- enabled: true,
452
- similarity_threshold: 0.8,
453
- min_body_lines: 5,
454
- },
455
- hallucinated_imports: {
456
- enabled: true,
457
- check_relative: true,
458
- check_packages: true,
459
- ignore_patterns: [
460
- '\\.css$', '\\.scss$', '\\.less$', '\\.svg$', '\\.png$', '\\.jpg$',
461
- '\\.json$', '\\.wasm$', '\\.graphql$', '\\.gql$',
462
- ],
463
- },
464
- inconsistent_error_handling: {
465
- enabled: true,
466
- max_strategies_per_type: 2,
467
- min_occurrences: 3,
468
- ignore_empty_catches: false,
469
- },
470
- context_window_artifacts: {
471
- enabled: true,
472
- min_file_lines: 100,
473
- degradation_threshold: 0.4,
474
- signals_required: 2,
475
- },
476
- promise_safety: {
477
- enabled: true,
478
- check_unhandled_then: true,
479
- check_unsafe_parse: true,
480
- check_async_without_await: true,
481
- check_unsafe_fetch: true,
482
- ignore_patterns: [],
483
- },
484
- phantom_apis: {
485
- enabled: true,
486
- check_node: true,
487
- check_python: true,
488
- check_go: true,
489
- check_csharp: true,
490
- check_java: true,
491
- ignore_patterns: [],
492
- },
493
- deprecated_apis: {
494
- enabled: true,
495
- check_node: true,
496
- check_python: true,
497
- check_web: true,
498
- check_go: true,
499
- check_csharp: true,
500
- check_java: true,
501
- block_security_deprecated: true,
502
- ignore_patterns: [],
503
- },
504
- test_quality: {
505
- enabled: true,
506
- check_empty_tests: true,
507
- check_tautological: true,
508
- check_mock_heavy: true,
509
- check_snapshot_abuse: true,
510
- check_assertion_free_async: true,
511
- max_mocks_per_test: 5,
512
- ignore_patterns: [],
513
- },
514
- },
515
- hooks: {
516
- enabled: false,
517
- tools: [],
518
- fast_gates: ['hallucinated-imports', 'phantom-apis', 'deprecated-apis', 'promise-safety', 'security-patterns', 'file-size'],
519
- timeout_ms: 5000,
520
- block_on_failure: false,
521
- },
522
- output: {
523
- report_path: 'rigour-report.json',
524
- },
525
- planned: [],
526
- ignore: [],
527
- };
1
+ /**
2
+ * Templates — Public Barrel
3
+ *
4
+ * Re-exports from sub-modules so that existing importers keep working.
5
+ * - Preset definitions → ./presets.ts
6
+ * - Paradigm templates → ./paradigms.ts
7
+ * - Universal config → ./universal-config.ts
8
+ */
9
+ export { TEMPLATES } from './presets.js';
10
+ export { PARADIGM_TEMPLATES } from './paradigms.js';
11
+ export { UNIVERSAL_CONFIG } from './universal-config.js';
@@ -0,0 +1,2 @@
1
+ import type { Template } from './presets.js';
2
+ export declare const PARADIGM_TEMPLATES: Template[];
@@ -0,0 +1,46 @@
1
+ export const PARADIGM_TEMPLATES = [
2
+ {
3
+ name: 'oop',
4
+ markers: [
5
+ 'class ', 'interface ', 'implements ', 'extends ',
6
+ 'constructor(', 'private ', 'public ', 'protected ',
7
+ ],
8
+ config: {
9
+ paradigm: 'oop',
10
+ gates: {
11
+ max_file_lines: 400,
12
+ ast: {
13
+ complexity: 10,
14
+ max_methods: 10,
15
+ max_params: 5,
16
+ max_nesting: 4,
17
+ max_inheritance_depth: 3,
18
+ max_class_dependencies: 5,
19
+ max_function_lines: 60,
20
+ },
21
+ },
22
+ },
23
+ },
24
+ {
25
+ name: 'functional',
26
+ // Removed '=>' as primary marker — too broad (appears in OOP callbacks)
27
+ markers: [
28
+ 'export const', 'reduce(', '.pipe(', 'compose(', 'curry(', 'readonly ',
29
+ ],
30
+ config: {
31
+ paradigm: 'functional',
32
+ gates: {
33
+ max_file_lines: 350,
34
+ ast: {
35
+ complexity: 8,
36
+ max_methods: 15, // Functions, not classes
37
+ max_params: 4,
38
+ max_nesting: 3,
39
+ max_inheritance_depth: 3,
40
+ max_class_dependencies: 5,
41
+ max_function_lines: 40,
42
+ },
43
+ },
44
+ },
45
+ },
46
+ ];
@@ -0,0 +1,14 @@
1
+ import { Gates } from '../types/index.js';
2
+ export interface Template {
3
+ name: string;
4
+ markers: string[];
5
+ config: {
6
+ preset?: string;
7
+ paradigm?: string;
8
+ commands?: Record<string, unknown>;
9
+ gates?: Partial<Gates>;
10
+ planned?: string[];
11
+ ignore?: string[];
12
+ };
13
+ }
14
+ export declare const TEMPLATES: Template[];