@rigour-labs/core 3.0.5 → 4.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 (85) 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/index.d.ts +14 -0
  4. package/dist/deep/index.js +12 -0
  5. package/dist/deep/prompts.d.ts +22 -0
  6. package/dist/deep/prompts.js +374 -0
  7. package/dist/deep/verifier.d.ts +16 -0
  8. package/dist/deep/verifier.js +388 -0
  9. package/dist/gates/deep-analysis.d.ts +28 -0
  10. package/dist/gates/deep-analysis.js +302 -0
  11. package/dist/gates/deprecated-apis-rules-lang.d.ts +21 -0
  12. package/dist/gates/deprecated-apis-rules-lang.js +311 -0
  13. package/dist/gates/deprecated-apis-rules-node.d.ts +19 -0
  14. package/dist/gates/deprecated-apis-rules-node.js +199 -0
  15. package/dist/gates/deprecated-apis-rules.d.ts +6 -0
  16. package/dist/gates/deprecated-apis-rules.js +6 -0
  17. package/dist/gates/deprecated-apis.js +1 -502
  18. package/dist/gates/hallucinated-imports-lang.d.ts +16 -0
  19. package/dist/gates/hallucinated-imports-lang.js +374 -0
  20. package/dist/gates/hallucinated-imports-stdlib.d.ts +12 -0
  21. package/dist/gates/hallucinated-imports-stdlib.js +228 -0
  22. package/dist/gates/hallucinated-imports.d.ts +0 -98
  23. package/dist/gates/hallucinated-imports.js +10 -678
  24. package/dist/gates/phantom-apis-data.d.ts +33 -0
  25. package/dist/gates/phantom-apis-data.js +398 -0
  26. package/dist/gates/phantom-apis.js +1 -393
  27. package/dist/gates/phantom-apis.test.js +52 -0
  28. package/dist/gates/promise-safety-helpers.d.ts +19 -0
  29. package/dist/gates/promise-safety-helpers.js +101 -0
  30. package/dist/gates/promise-safety-rules.d.ts +7 -0
  31. package/dist/gates/promise-safety-rules.js +19 -0
  32. package/dist/gates/promise-safety.d.ts +1 -21
  33. package/dist/gates/promise-safety.js +51 -257
  34. package/dist/gates/runner.d.ts +4 -2
  35. package/dist/gates/runner.js +46 -1
  36. package/dist/gates/test-quality-lang.d.ts +30 -0
  37. package/dist/gates/test-quality-lang.js +188 -0
  38. package/dist/gates/test-quality.d.ts +0 -14
  39. package/dist/gates/test-quality.js +13 -186
  40. package/dist/index.d.ts +10 -0
  41. package/dist/index.js +12 -2
  42. package/dist/inference/cloud-provider.d.ts +34 -0
  43. package/dist/inference/cloud-provider.js +126 -0
  44. package/dist/inference/index.d.ts +17 -0
  45. package/dist/inference/index.js +23 -0
  46. package/dist/inference/model-manager.d.ts +26 -0
  47. package/dist/inference/model-manager.js +106 -0
  48. package/dist/inference/sidecar-provider.d.ts +15 -0
  49. package/dist/inference/sidecar-provider.js +153 -0
  50. package/dist/inference/types.d.ts +77 -0
  51. package/dist/inference/types.js +19 -0
  52. package/dist/pattern-index/indexer-helpers.d.ts +38 -0
  53. package/dist/pattern-index/indexer-helpers.js +111 -0
  54. package/dist/pattern-index/indexer-lang.d.ts +13 -0
  55. package/dist/pattern-index/indexer-lang.js +244 -0
  56. package/dist/pattern-index/indexer-ts.d.ts +22 -0
  57. package/dist/pattern-index/indexer-ts.js +258 -0
  58. package/dist/pattern-index/indexer.d.ts +4 -106
  59. package/dist/pattern-index/indexer.js +58 -707
  60. package/dist/pattern-index/staleness-data.d.ts +6 -0
  61. package/dist/pattern-index/staleness-data.js +262 -0
  62. package/dist/pattern-index/staleness.js +1 -258
  63. package/dist/settings.d.ts +104 -0
  64. package/dist/settings.js +186 -0
  65. package/dist/storage/db.d.ts +16 -0
  66. package/dist/storage/db.js +132 -0
  67. package/dist/storage/findings.d.ts +14 -0
  68. package/dist/storage/findings.js +38 -0
  69. package/dist/storage/index.d.ts +9 -0
  70. package/dist/storage/index.js +8 -0
  71. package/dist/storage/patterns.d.ts +35 -0
  72. package/dist/storage/patterns.js +62 -0
  73. package/dist/storage/scans.d.ts +42 -0
  74. package/dist/storage/scans.js +55 -0
  75. package/dist/templates/index.d.ts +12 -16
  76. package/dist/templates/index.js +11 -527
  77. package/dist/templates/paradigms.d.ts +2 -0
  78. package/dist/templates/paradigms.js +46 -0
  79. package/dist/templates/presets.d.ts +14 -0
  80. package/dist/templates/presets.js +227 -0
  81. package/dist/templates/universal-config.d.ts +2 -0
  82. package/dist/templates/universal-config.js +190 -0
  83. package/dist/types/index.d.ts +438 -15
  84. package/dist/types/index.js +41 -1
  85. package/package.json +6 -2
@@ -0,0 +1,199 @@
1
+ /**
2
+ * Rule data for deprecated-apis gate.
3
+ * Node.js and Web API deprecation rules extracted to keep deprecated-apis.ts under 500 lines.
4
+ */
5
+ /**
6
+ * Node.js deprecated APIs — sourced from official Node.js deprecation list
7
+ */
8
+ export const NODE_DEPRECATED_RULES = [
9
+ // Security-deprecated
10
+ {
11
+ pattern: /new\s+Buffer\s*\(/,
12
+ api: 'new Buffer()',
13
+ reason: 'DEP0005: Security vulnerability — uninitialized memory exposure',
14
+ replacement: 'Buffer.from(), Buffer.alloc(), or Buffer.allocUnsafe()',
15
+ category: 'security',
16
+ },
17
+ {
18
+ pattern: /Buffer\s*\(\s*(?:\d|['"])/,
19
+ api: 'Buffer() constructor',
20
+ reason: 'DEP0005: Security vulnerability — uninitialized memory exposure',
21
+ replacement: 'Buffer.from(), Buffer.alloc(), or Buffer.allocUnsafe()',
22
+ category: 'security',
23
+ },
24
+ {
25
+ pattern: /createCipher\s*\(/,
26
+ api: 'crypto.createCipher()',
27
+ reason: 'DEP0106: Uses weak key derivation (no IV, no salt)',
28
+ replacement: 'crypto.createCipheriv() with explicit IV',
29
+ category: 'security',
30
+ },
31
+ {
32
+ pattern: /createDecipher\s*\(/,
33
+ api: 'crypto.createDecipher()',
34
+ reason: 'DEP0106: Uses weak key derivation (no IV, no salt)',
35
+ replacement: 'crypto.createDecipheriv() with explicit IV',
36
+ category: 'security',
37
+ },
38
+ // Removed
39
+ {
40
+ pattern: /\brequire\s*\(\s*['"]domain['"]\s*\)/,
41
+ api: "require('domain')",
42
+ reason: 'DEP0032: domain module is deprecated (error handling issues)',
43
+ replacement: 'async_hooks, try/catch, or Promise error handling',
44
+ category: 'removed',
45
+ },
46
+ {
47
+ pattern: /\brequire\s*\(\s*['"]punycode['"]\s*\)/,
48
+ api: "require('punycode')",
49
+ reason: 'DEP0040: punycode module removed from Node.js core',
50
+ replacement: 'npm package: punycode (userland)',
51
+ category: 'removed',
52
+ },
53
+ {
54
+ pattern: /\brequire\s*\(\s*['"]sys['"]\s*\)/,
55
+ api: "require('sys')",
56
+ reason: 'DEP0025: sys module was renamed to util',
57
+ replacement: "require('util')",
58
+ category: 'removed',
59
+ },
60
+ {
61
+ pattern: /\brequire\s*\(\s*['"]_linklist['"]\s*\)/,
62
+ api: "require('_linklist')",
63
+ reason: 'DEP0037: _linklist module removed',
64
+ replacement: 'npm userland linked list package',
65
+ category: 'removed',
66
+ },
67
+ // Superseded
68
+ {
69
+ pattern: /url\.parse\s*\(/,
70
+ api: 'url.parse()',
71
+ reason: 'DEP0169: Legacy URL parser has known vulnerabilities',
72
+ replacement: 'new URL() (WHATWG URL API)',
73
+ category: 'superseded',
74
+ },
75
+ {
76
+ pattern: /url\.resolve\s*\(/,
77
+ api: 'url.resolve()',
78
+ reason: 'DEP0169: Legacy URL API',
79
+ replacement: 'new URL(relative, base)',
80
+ category: 'superseded',
81
+ },
82
+ {
83
+ pattern: /url\.format\s*\(\s*(?:url\.parse|{)/,
84
+ api: 'url.format(urlObject)',
85
+ reason: 'DEP0169: Legacy URL API with url.parse objects',
86
+ replacement: 'new URL().toString() or url.format(new URL(...))',
87
+ category: 'superseded',
88
+ },
89
+ {
90
+ pattern: /\.send\s*\(\s*new\s+Buffer\b/,
91
+ api: 'Sending raw Buffer',
92
+ reason: 'Potential uninitialized memory leak when Buffer() used without alloc',
93
+ replacement: 'Buffer.from() or Buffer.alloc()',
94
+ category: 'security',
95
+ },
96
+ {
97
+ pattern: /fs\.exists\s*\(/,
98
+ api: 'fs.exists()',
99
+ reason: 'DEP0103: fs.exists() is deprecated (race condition issues)',
100
+ replacement: 'fs.access() or fs.stat()',
101
+ category: 'superseded',
102
+ },
103
+ {
104
+ pattern: /util\.inherits\s*\(/,
105
+ api: 'util.inherits()',
106
+ reason: 'DEP0: Superseded by ES6 class extends',
107
+ replacement: 'class Child extends Parent {}',
108
+ category: 'superseded',
109
+ },
110
+ {
111
+ pattern: /util\.pump\s*\(/,
112
+ api: 'util.pump()',
113
+ reason: 'DEP0004: Removed — use stream.pipeline()',
114
+ replacement: 'stream.pipeline() or pipe()',
115
+ category: 'removed',
116
+ },
117
+ {
118
+ pattern: /util\.puts\s*\(|util\.print\s*\(|util\.debug\s*\(/,
119
+ api: 'util.puts/print/debug()',
120
+ reason: 'DEP0027/28/29: Removed console wrappers',
121
+ replacement: 'console.log() / console.error()',
122
+ category: 'removed',
123
+ },
124
+ {
125
+ pattern: /SlowBuffer\s*\(/,
126
+ api: 'SlowBuffer',
127
+ reason: 'DEP0030: Deprecated class',
128
+ replacement: 'Buffer.allocUnsafeSlow()',
129
+ category: 'superseded',
130
+ },
131
+ {
132
+ pattern: /\.setEncoding\s*\(\s*['"]binary['"]\s*\)/,
133
+ api: "setEncoding('binary')",
134
+ reason: "DEP0040: 'binary' encoding is deprecated",
135
+ replacement: "'latin1' encoding",
136
+ category: 'superseded',
137
+ },
138
+ {
139
+ pattern: /process\.(?:assert|binding)\s*\(/,
140
+ api: 'process.assert()/binding()',
141
+ reason: 'DEP0064/0098: Internal APIs removed',
142
+ replacement: 'assert module / public APIs',
143
+ category: 'removed',
144
+ },
145
+ ];
146
+ /**
147
+ * Web API deprecated patterns
148
+ */
149
+ export const WEB_DEPRECATED_RULES = [
150
+ {
151
+ pattern: /document\.write\s*\(/,
152
+ api: 'document.write()',
153
+ reason: 'Blocks parsing, security risk (XSS vector), removed in strict mode',
154
+ replacement: 'DOM manipulation (createElement, appendChild, innerHTML)',
155
+ category: 'security',
156
+ },
157
+ {
158
+ pattern: /\.innerHTML\s*=\s*[`'"]/,
159
+ api: 'innerHTML assignment with strings',
160
+ reason: 'XSS vulnerability when used with user-supplied content',
161
+ replacement: 'textContent, createElement + appendChild, or DOMPurify.sanitize()',
162
+ category: 'security',
163
+ },
164
+ {
165
+ pattern: /eval\s*\(\s*[^)]/,
166
+ api: 'eval()',
167
+ reason: 'Code injection vulnerability, prevents optimization',
168
+ replacement: 'JSON.parse(), Function constructor (if absolutely needed), or structured approach',
169
+ category: 'security',
170
+ },
171
+ {
172
+ pattern: /with\s*\(\s*\w/,
173
+ api: 'with statement',
174
+ reason: 'Removed in strict mode, creates ambiguous scope, security risk',
175
+ replacement: 'Destructuring or explicit property access',
176
+ category: 'removed',
177
+ },
178
+ {
179
+ pattern: /document\.all\b/,
180
+ api: 'document.all',
181
+ reason: 'Legacy IE API, falsy object (quirks mode artifact)',
182
+ replacement: 'document.getElementById(), document.querySelector()',
183
+ category: 'superseded',
184
+ },
185
+ {
186
+ pattern: /escape\s*\(\s*['"]/,
187
+ api: 'escape()',
188
+ reason: 'Deprecated — does not handle Unicode correctly',
189
+ replacement: 'encodeURIComponent() or encodeURI()',
190
+ category: 'superseded',
191
+ },
192
+ {
193
+ pattern: /unescape\s*\(/,
194
+ api: 'unescape()',
195
+ reason: 'Deprecated — does not handle Unicode correctly',
196
+ replacement: 'decodeURIComponent() or decodeURI()',
197
+ category: 'superseded',
198
+ },
199
+ ];
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Barrel file: re-exports all deprecated API rules.
3
+ * Individual rules extracted to separate files for maintainability.
4
+ */
5
+ export { DeprecatedRule, NODE_DEPRECATED_RULES, WEB_DEPRECATED_RULES } from './deprecated-apis-rules-node.js';
6
+ export { PYTHON_DEPRECATED_RULES, GO_DEPRECATED_RULES, CSHARP_DEPRECATED_RULES, JAVA_DEPRECATED_RULES } from './deprecated-apis-rules-lang.js';
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Barrel file: re-exports all deprecated API rules.
3
+ * Individual rules extracted to separate files for maintainability.
4
+ */
5
+ export { NODE_DEPRECATED_RULES, WEB_DEPRECATED_RULES } from './deprecated-apis-rules-node.js';
6
+ export { PYTHON_DEPRECATED_RULES, GO_DEPRECATED_RULES, CSHARP_DEPRECATED_RULES, JAVA_DEPRECATED_RULES } from './deprecated-apis-rules-lang.js';