@yagyeshvyas/vibeguard 0.1.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 (52) hide show
  1. package/README.md +600 -0
  2. package/bin/cli.js +1640 -0
  3. package/ci/vibeguard.yml +41 -0
  4. package/ci-templates/Jenkinsfile +26 -0
  5. package/ci-templates/azure-pipelines.yml +29 -0
  6. package/ci-templates/circleci.yml +24 -0
  7. package/ci-templates/gitlab.yml +19 -0
  8. package/hooks/pre-commit +31 -0
  9. package/package.json +94 -0
  10. package/src/ai-guard.js +205 -0
  11. package/src/ast.js +319 -0
  12. package/src/audit-trail.js +154 -0
  13. package/src/autofix.js +524 -0
  14. package/src/badge.js +42 -0
  15. package/src/behavior.js +205 -0
  16. package/src/compliance.js +151 -0
  17. package/src/crosstaint.js +324 -0
  18. package/src/cve-intel.js +136 -0
  19. package/src/dashboard.js +279 -0
  20. package/src/deps.js +159 -0
  21. package/src/doctor.js +111 -0
  22. package/src/engine.js +234 -0
  23. package/src/external.js +160 -0
  24. package/src/firewall.js +517 -0
  25. package/src/history.js +87 -0
  26. package/src/hook.js +151 -0
  27. package/src/install.js +248 -0
  28. package/src/interceptor.js +476 -0
  29. package/src/mcp-server.js +1804 -0
  30. package/src/net-audit.js +208 -0
  31. package/src/pii.js +212 -0
  32. package/src/plugin.js +80 -0
  33. package/src/policy-gen.js +288 -0
  34. package/src/pre-deploy.js +282 -0
  35. package/src/presets.js +113 -0
  36. package/src/privacy-audit.js +273 -0
  37. package/src/repl.js +150 -0
  38. package/src/report.js +312 -0
  39. package/src/rules-pack.js +2753 -0
  40. package/src/rules.js +1446 -0
  41. package/src/sandbox.js +139 -0
  42. package/src/scanner.js +651 -0
  43. package/src/secure-prompt.js +140 -0
  44. package/src/slopsquat.js +144 -0
  45. package/src/supply-firewall.js +243 -0
  46. package/src/suppress.js +89 -0
  47. package/src/taint.js +168 -0
  48. package/src/trace.js +220 -0
  49. package/src/urlscan.js +142 -0
  50. package/src/vault.js +145 -0
  51. package/src/verify.js +98 -0
  52. package/src/verifykeys.js +87 -0
@@ -0,0 +1,208 @@
1
+ 'use strict';
2
+
3
+ /*
4
+ * VibeGuard Network Auditor.
5
+ *
6
+ * Maps every outbound HTTP/HTTPS call in the codebase.
7
+ * Shows exactly where your data goes — every fetch, axios, XHR, WebSocket.
8
+ * Flags unknown/suspicious endpoints that are not in an allowlist.
9
+ *
10
+ * 100% local. Zero network. Zero dependencies.
11
+ */
12
+
13
+ const fs = require('fs');
14
+ const path = require('path');
15
+
16
+ const URL_RE = /['"]https?:\/\/([^'"/]+)([^'"]*)['"]/g;
17
+ const FETCH_RE = /(?:fetch|axios\.(?:get|post|put|patch|delete)|axios\s*\(|http\.get|https\.get|http\.request|https\.request|got\(|superagent|XMLHttpRequest|\.open\s*\(\s*['"](?:GET|POST|PUT|PATCH|DELETE))\s*\(\s*['"]https?:\/\/([^'"/\s]+)/gi;
18
+ const WS_RE = /new\s+WebSocket\s*\(\s*['"]wss?:\/\/([^'"/]+)/gi;
19
+ const BEACON_RE = /sendBeacon\s*\(\s*['"]https?:\/\/([^'"/]+)/gi;
20
+ const DNS_RE = /dns\.lookup|dns\.resolve|child_process.*nslookup|child_process.*dig/gi;
21
+
22
+ const KNOWN_SAFE_DOMAINS = new Set([
23
+ 'localhost', '127.0.0.1', '0.0.0.0',
24
+ 'api.openai.com', 'api.anthropic.com', 'generativelanguage.googleapis.com',
25
+ 'api.stripe.com', 'connect.stripe.com',
26
+ 'api.github.com', 'github.com',
27
+ 'api.supabase.co', '*.supabase.co',
28
+ '.googleapis.com', 'firestore.googleapis.com', 'identitytoolkit.googleapis.com',
29
+ 'api.resend.com', 'api.postmarkapp.com',
30
+ 'api.upstash.com', 'api.pinecone.io',
31
+ 'api.telegram.org', 'api.slack.com',
32
+ 'registry.npmjs.org', 'api.osv.dev',
33
+ 'api.cloudflare.com', 'api.datadoghq.com',
34
+ 'sentry.io', '*.sentry.io',
35
+ 'api.openai.com', 'api.anthropic.com',
36
+ 'api.mapbox.com', 'api.mapbox.ai',
37
+ 'api.openai.com',
38
+ ]);
39
+
40
+ function isKnown(domain) {
41
+ if (KNOWN_SAFE_DOMAINS.has(domain)) return true;
42
+ for (const safe of KNOWN_SAFE_DOMAINS) {
43
+ if (safe.startsWith('*.') && domain.endsWith(safe.slice(1))) return true;
44
+ }
45
+ // Local addresses are not suspicious
46
+ if (/^(?:localhost|127\.|10\.|192\.168\.|172\.(?:1[6-9]|2[0-9]|3[01])\.|0\.0\.0\.0|::1|::)/.test(domain)) return true;
47
+ // Example domains
48
+ if (/example\.(com|org|net|io)$/.test(domain)) return true;
49
+ return false;
50
+ }
51
+
52
+ function auditNetwork(dir, files) {
53
+ const endpoints = [];
54
+ const seen = new Set();
55
+
56
+ for (const file of files) {
57
+ let content;
58
+ try { content = fs.readFileSync(file, 'utf8'); } catch { continue; }
59
+ const rel = path.relative(dir, file).split(path.sep).join('/');
60
+ const lines = content.split(/\r?\n/);
61
+
62
+ for (let i = 0; i < lines.length; i++) {
63
+ const line = lines[i];
64
+
65
+ // All HTTP URLs
66
+ let m;
67
+ URL_RE.lastIndex = 0;
68
+ while ((m = URL_RE.exec(line)) !== null) {
69
+ const domain = m[1];
70
+ const urlPath = m[2] || '/';
71
+ const key = `${domain}${urlPath}`;
72
+ if (seen.has(key)) continue;
73
+ seen.add(key);
74
+ endpoints.push({
75
+ file: rel, line: i + 1, domain, path: urlPath,
76
+ method: 'GET (URL only)',
77
+ known: isKnown(domain),
78
+ suspicious: !isKnown(domain) && !/^(?:www\.|api\.)?[a-z0-9-]+\.(?:com|org|net|io|dev|app|co|ai)$/i.test(domain),
79
+ });
80
+ }
81
+
82
+ // fetch/axios calls
83
+ FETCH_RE.lastIndex = 0;
84
+ while ((m = FETCH_RE.exec(line)) !== null) {
85
+ const domain = m[2] || m[1];
86
+ if (!domain) continue;
87
+ const key = `fetch:${domain}`;
88
+ if (seen.has(key)) continue;
89
+ seen.add(key);
90
+ endpoints.push({
91
+ file: rel, line: i + 1, domain,
92
+ path: '/',
93
+ method: 'fetch/axios',
94
+ known: isKnown(domain),
95
+ suspicious: !isKnown(domain),
96
+ });
97
+ }
98
+
99
+ // WebSocket
100
+ WS_RE.lastIndex = 0;
101
+ while ((m = WS_RE.exec(line)) !== null) {
102
+ const domain = m[1];
103
+ endpoints.push({
104
+ file: rel, line: i + 1, domain,
105
+ path: '/ws',
106
+ method: 'WebSocket',
107
+ known: isKnown(domain),
108
+ suspicious: !isKnown(domain),
109
+ });
110
+ }
111
+
112
+ // Beacon
113
+ BEACON_RE.lastIndex = 0;
114
+ while ((m = BEACON_RE.exec(line)) !== null) {
115
+ const domain = m[1];
116
+ endpoints.push({
117
+ file: rel, line: i + 1, domain,
118
+ path: '/beacon',
119
+ method: 'sendBeacon',
120
+ known: isKnown(domain),
121
+ suspicious: !isKnown(domain),
122
+ });
123
+ }
124
+ }
125
+ }
126
+
127
+ const known = endpoints.filter(e => e.known);
128
+ const unknown = endpoints.filter(e => !e.known);
129
+ const suspicious = endpoints.filter(e => e.suspicious);
130
+ const domains = [...new Set(endpoints.map(e => e.domain))];
131
+
132
+ return {
133
+ endpoints,
134
+ known,
135
+ unknown,
136
+ suspicious,
137
+ domains,
138
+ summary: {
139
+ totalEndpoints: endpoints.length,
140
+ knownDomains: known.length,
141
+ unknownDomains: unknown.length,
142
+ suspiciousDomains: suspicious.length,
143
+ uniqueDomains: domains.length,
144
+ },
145
+ };
146
+ }
147
+
148
+ function renderNetworkReport(result) {
149
+ const C = {
150
+ red: '\x1b[31m', green: '\x1b[32m', yellow: '\x1b[33m',
151
+ cyan: '\x1b[36m', dim: '\x1b[2m', bold: '\x1b[1m', reset: '\x1b[0m',
152
+ };
153
+
154
+ const lines = [];
155
+ lines.push(`${C.bold}VibeGuard Network Audit${C.reset}`);
156
+ lines.push(`${C.dim}${'─'.repeat(60)}${C.reset}`);
157
+ lines.push('');
158
+
159
+ lines.push(`${C.bold}Summary${C.reset}`);
160
+ lines.push(` Total endpoints: ${result.summary.totalEndpoints}`);
161
+ lines.push(` Unique domains: ${result.summary.uniqueDomains}`);
162
+ lines.push(` Known safe: ${C.green}${result.summary.knownDomains}${C.reset}`);
163
+ lines.push(` Unknown: ${C.yellow}${result.summary.unknownDomains}${C.reset}`);
164
+ lines.push(` Suspicious: ${C.red}${result.summary.suspiciousDomains}${C.reset}`);
165
+ lines.push('');
166
+
167
+ if (result.domains.length > 0) {
168
+ lines.push(`${C.bold}All Domains${C.reset}`);
169
+ for (const d of result.domains.sort()) {
170
+ const isKnown = result.known.some(e => e.domain === d);
171
+ const isSuspicious = result.suspicious.some(e => e.domain === d);
172
+ const color = isKnown ? C.green : isSuspicious ? C.red : C.yellow;
173
+ const tag = isKnown ? 'known' : isSuspicious ? 'SUSPICIOUS' : 'unknown';
174
+ lines.push(` ${color}${tag.padEnd(12)}${C.reset} ${d}`);
175
+ }
176
+ lines.push('');
177
+ }
178
+
179
+ if (result.suspicious.length > 0) {
180
+ lines.push(`${C.red}${C.bold}Suspicious Endpoints${C.reset}`);
181
+ for (const e of result.suspicious) {
182
+ lines.push(` ${C.red}[!]${C.reset} ${e.method} ${e.domain}${e.path}`);
183
+ lines.push(` ${C.dim}${e.file}:${e.line}${C.reset}`);
184
+ }
185
+ lines.push('');
186
+ }
187
+
188
+ if (result.unknown.length > 0 && result.suspicious.length === 0) {
189
+ lines.push(`${C.yellow}${C.bold}Unknown Endpoints (review)${C.reset}`);
190
+ for (const e of result.unknown.slice(0, 15)) {
191
+ lines.push(` ${C.yellow}[?]${C.reset} ${e.method} ${e.domain}${e.path}`);
192
+ lines.push(` ${C.dim}${e.file}:${e.line}${C.reset}`);
193
+ }
194
+ if (result.unknown.length > 15) {
195
+ lines.push(` ${C.dim}... and ${result.unknown.length - 15} more${C.reset}`);
196
+ }
197
+ lines.push('');
198
+ }
199
+
200
+ if (result.endpoints.length === 0) {
201
+ lines.push(` ${C.green}No outbound HTTP calls detected${C.reset}`);
202
+ lines.push('');
203
+ }
204
+
205
+ return lines.join('\n');
206
+ }
207
+
208
+ module.exports = { auditNetwork, renderNetworkReport, isKnown, KNOWN_SAFE_DOMAINS };
package/src/pii.js ADDED
@@ -0,0 +1,212 @@
1
+ 'use strict';
2
+
3
+ /*
4
+ * VibeGuard PII guard.
5
+ *
6
+ * Detects and redacts personal / sensitive data in ARBITRARY TEXT — not code.
7
+ * This is the piece that backs VibeGuard's core promise: an AI agent should be
8
+ * able to scrub user text BEFORE it sends it to a model, a tool, a log, or any
9
+ * external service. Runs 100% locally, zero network, zero dependencies.
10
+ *
11
+ * Design goals:
12
+ * - Low false positives. Credit cards are Luhn-validated; SSN/phone shapes are
13
+ * constrained; matches inside a longer digit run are rejected.
14
+ * - Deterministic, non-overlapping redaction (longest / highest-priority wins).
15
+ * - Format-preserving-ish output: cards/phones keep last 4 by default so the
16
+ * text stays readable ("****4242") while the sensitive part is gone.
17
+ */
18
+
19
+ // Luhn check — real card numbers pass, random 16-digit strings almost never do.
20
+ function luhnValid(digits) {
21
+ let sum = 0;
22
+ let alt = false;
23
+ for (let i = digits.length - 1; i >= 0; i--) {
24
+ let n = digits.charCodeAt(i) - 48;
25
+ if (n < 0 || n > 9) return false;
26
+ if (alt) {
27
+ n *= 2;
28
+ if (n > 9) n -= 9;
29
+ }
30
+ sum += n;
31
+ alt = !alt;
32
+ }
33
+ return sum % 10 === 0;
34
+ }
35
+
36
+ function last4Mask(raw, digits) {
37
+ return '****' + digits.slice(-4);
38
+ }
39
+
40
+ // Each detector: { type, severity, re, validate?(m), redact?(m) }
41
+ // `re` MUST be global. `validate` returns false to reject a candidate match.
42
+ // `redact` returns the replacement token (defaults to `[REDACTED_<TYPE>]`).
43
+ const DETECTORS = [
44
+ {
45
+ type: 'email',
46
+ severity: 'high',
47
+ re: /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g,
48
+ },
49
+ {
50
+ type: 'credit-card',
51
+ severity: 'critical',
52
+ // 13–19 digits, optionally split by spaces or dashes, not glued to more digits.
53
+ re: /(?<![\d])(?:\d[ -]?){12,18}\d(?![\d])/g,
54
+ validate(m) {
55
+ const digits = m.replace(/[^\d]/g, '');
56
+ if (digits.length < 13 || digits.length > 19) return false;
57
+ return luhnValid(digits);
58
+ },
59
+ redact(m) {
60
+ return last4Mask(m, m.replace(/[^\d]/g, ''));
61
+ },
62
+ },
63
+ {
64
+ type: 'ssn',
65
+ severity: 'critical',
66
+ // US SSN: 3-2-4 with separators. Reject obvious invalids (000 area, 00 group, 0000 serial).
67
+ re: /(?<![\d-])\d{3}[ -]\d{2}[ -]\d{4}(?![\d-])/g,
68
+ validate(m) {
69
+ const d = m.replace(/[^\d]/g, '');
70
+ const area = d.slice(0, 3);
71
+ const group = d.slice(3, 5);
72
+ const serial = d.slice(5);
73
+ if (area === '000' || area === '666' || area[0] === '9') return false;
74
+ if (group === '00' || serial === '0000') return false;
75
+ return true;
76
+ },
77
+ },
78
+ {
79
+ type: 'phone',
80
+ severity: 'medium',
81
+ // Intl / US phone with separators or +country code. Requires structure so we
82
+ // don't grab bare integers. 10–15 significant digits.
83
+ re: /(?<![\w.])(?:\+?\d{1,3}[ .-]?)?(?:\(\d{2,4}\)[ .-]?)?\d{2,4}[ .-]\d{2,4}[ .-]\d{2,4}(?:[ .-]\d{2,4})?(?![\w])/g,
84
+ validate(m) {
85
+ const d = m.replace(/[^\d]/g, '');
86
+ return d.length >= 10 && d.length <= 15;
87
+ },
88
+ redact(m) {
89
+ return '[REDACTED_PHONE_' + m.replace(/[^\d]/g, '').slice(-4) + ']';
90
+ },
91
+ },
92
+ {
93
+ type: 'ipv4',
94
+ severity: 'low',
95
+ re: /(?<![\d.])(?:(?:25[0-5]|2[0-4]\d|1?\d?\d)\.){3}(?:25[0-5]|2[0-4]\d|1?\d?\d)(?![\d.])/g,
96
+ },
97
+ {
98
+ type: 'ipv6',
99
+ severity: 'low',
100
+ re: /\b(?:[A-Fa-f0-9]{1,4}:){7}[A-Fa-f0-9]{1,4}\b/g,
101
+ },
102
+ {
103
+ type: 'jwt',
104
+ severity: 'high',
105
+ re: /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{5,}\b/g,
106
+ },
107
+ {
108
+ type: 'aws-access-key',
109
+ severity: 'critical',
110
+ re: /\b(?:AKIA|ASIA|AGPA|AIDA|AROA|ANPA|ANVA)[A-Z0-9]{16}\b/g,
111
+ },
112
+ {
113
+ type: 'private-key',
114
+ severity: 'critical',
115
+ re: /-----BEGIN (?:RSA |EC |OPENSSH |DSA |PGP )?PRIVATE KEY-----/g,
116
+ },
117
+ {
118
+ type: 'iban',
119
+ severity: 'high',
120
+ re: /\b[A-Z]{2}\d{2}[ ]?(?:[A-Z0-9]{4}[ ]?){2,7}[A-Z0-9]{1,4}\b/g,
121
+ validate(m) {
122
+ const s = m.replace(/\s/g, '');
123
+ return s.length >= 15 && s.length <= 34;
124
+ },
125
+ },
126
+ {
127
+ type: 'mac-address',
128
+ severity: 'low',
129
+ re: /\b(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}\b/g,
130
+ },
131
+ ];
132
+
133
+ const SEVERITY_RANK = { critical: 4, high: 3, medium: 2, low: 1 };
134
+
135
+ /**
136
+ * Detect PII in text.
137
+ * @param {string} text
138
+ * @param {{types?: string[]}} [opts] optional allowlist of entity types to scan for.
139
+ * @returns {{matches: Array, counts: Object, types: string[], total: number}}
140
+ */
141
+ function detectPII(text, opts = {}) {
142
+ if (typeof text !== 'string' || text.length === 0) {
143
+ return { matches: [], counts: {}, types: [], total: 0 };
144
+ }
145
+ const only = opts.types && opts.types.length ? new Set(opts.types) : null;
146
+ const raw = [];
147
+ for (const det of DETECTORS) {
148
+ if (only && !only.has(det.type)) continue;
149
+ det.re.lastIndex = 0;
150
+ let m;
151
+ while ((m = det.re.exec(text)) !== null) {
152
+ const value = m[0];
153
+ if (m.index === det.re.lastIndex) det.re.lastIndex++; // guard against zero-width
154
+ if (det.validate && !det.validate(value)) continue;
155
+ raw.push({
156
+ type: det.type,
157
+ severity: det.severity,
158
+ value,
159
+ start: m.index,
160
+ end: m.index + value.length,
161
+ token: det.redact ? det.redact(value) : `[REDACTED_${det.type.toUpperCase()}]`,
162
+ });
163
+ }
164
+ }
165
+ // Resolve overlaps: sort by start, then prefer higher severity, then longer.
166
+ raw.sort((a, b) => {
167
+ if (a.start !== b.start) return a.start - b.start;
168
+ const sr = SEVERITY_RANK[b.severity] - SEVERITY_RANK[a.severity];
169
+ if (sr !== 0) return sr;
170
+ return b.end - a.end - (a.end - a.start);
171
+ });
172
+ const matches = [];
173
+ let lastEnd = -1;
174
+ for (const r of raw) {
175
+ if (r.start < lastEnd) continue; // overlaps a kept, higher-priority match
176
+ matches.push(r);
177
+ lastEnd = r.end;
178
+ }
179
+ const counts = {};
180
+ for (const r of matches) counts[r.type] = (counts[r.type] || 0) + 1;
181
+ return {
182
+ matches,
183
+ counts,
184
+ types: Object.keys(counts),
185
+ total: matches.length,
186
+ };
187
+ }
188
+
189
+ /**
190
+ * Redact PII from text. Non-overlapping, right-to-left splice so indices stay valid.
191
+ * @param {string} text
192
+ * @param {{types?: string[]}} [opts]
193
+ * @returns {{redacted: string, matches: Array, counts: Object, total: number, clean: boolean}}
194
+ */
195
+ function redactText(text, opts = {}) {
196
+ const det = detectPII(text, opts);
197
+ let out = text;
198
+ // Apply from the end so earlier indices are unaffected by length changes.
199
+ for (let i = det.matches.length - 1; i >= 0; i--) {
200
+ const m = det.matches[i];
201
+ out = out.slice(0, m.start) + m.token + out.slice(m.end);
202
+ }
203
+ return {
204
+ redacted: out,
205
+ matches: det.matches.map((m) => ({ type: m.type, severity: m.severity, token: m.token })),
206
+ counts: det.counts,
207
+ total: det.total,
208
+ clean: det.total === 0,
209
+ };
210
+ }
211
+
212
+ module.exports = { detectPII, redactText, luhnValid, DETECTORS };
package/src/plugin.js ADDED
@@ -0,0 +1,80 @@
1
+ 'use strict';
2
+
3
+ /*
4
+ * Plugin system for VibeGuard.
5
+ *
6
+ * Auto-discovers npm packages matching `vibeguard-rules-*` or `@vibeguard/rules-*`,
7
+ * plus local paths from .vibeguardrc.json `plugins` array.
8
+ *
9
+ * A plugin exports an object: { name, version, description, rules: [ruleShape] }
10
+ * where ruleShape matches VibeGuard's line rule shape:
11
+ * { id, severity, confidence, title, re, skipComments, message, fix, owasp, cwe, compliance }
12
+ *
13
+ * Loaded plugins' rules are merged into the scanner's line rules at scan time.
14
+ */
15
+
16
+ const fs = require('fs');
17
+ const path = require('path');
18
+
19
+ let _loaded = null;
20
+
21
+ function loadPlugins(root, config) {
22
+ if (_loaded) return _loaded;
23
+ _loaded = { rules: [], errors: [] };
24
+
25
+ const pluginNames = [];
26
+ // Auto-discovery: scan node_modules for vibeguard-rules-* / @vibeguard/rules-*
27
+ try {
28
+ const nmDir = path.join(root, 'node_modules');
29
+ if (fs.existsSync(nmDir)) {
30
+ for (const entry of fs.readdirSync(nmDir)) {
31
+ if (entry.startsWith('vibeguard-rules-')) pluginNames.push(entry);
32
+ if (entry.startsWith('@')) {
33
+ const scopedDir = path.join(nmDir, entry);
34
+ try {
35
+ for (const sub of fs.readdirSync(scopedDir)) {
36
+ if (entry === '@vibeguard' && sub.startsWith('rules-')) {
37
+ pluginNames.push(`${entry}/${sub}`);
38
+ }
39
+ }
40
+ } catch {}
41
+ }
42
+ }
43
+ }
44
+ } catch {}
45
+
46
+ // Config-specified plugins
47
+ if (config && Array.isArray(config.plugins)) {
48
+ for (const p of config.plugins) {
49
+ if (typeof p === 'string' && !pluginNames.includes(p)) pluginNames.push(p);
50
+ }
51
+ }
52
+
53
+ for (const name of pluginNames) {
54
+ try {
55
+ let mod;
56
+ if (name.startsWith('./') || name.startsWith('../') || name.startsWith('/')) {
57
+ mod = require(path.resolve(root, name));
58
+ } else {
59
+ mod = require(name);
60
+ }
61
+ if (mod && mod.rules && Array.isArray(mod.rules)) {
62
+ _loaded.rules.push(...mod.rules);
63
+ }
64
+ } catch (err) {
65
+ _loaded.errors.push(`${name}: ${err.message}`);
66
+ }
67
+ }
68
+
69
+ return _loaded;
70
+ }
71
+
72
+ function getPluginRules() {
73
+ return _loaded ? _loaded.rules : [];
74
+ }
75
+
76
+ function resetPlugins() {
77
+ _loaded = null;
78
+ }
79
+
80
+ module.exports = { loadPlugins, getPluginRules, resetPlugins };