@vibecheckai/cli 3.0.2 → 3.0.3

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 (68) hide show
  1. package/package.json +9 -1
  2. package/bin/cli-hygiene.js +0 -241
  3. package/bin/guardrail.js +0 -834
  4. package/bin/runners/cli-utils.js +0 -1070
  5. package/bin/runners/context/ai-task-decomposer.js +0 -337
  6. package/bin/runners/context/analyzer.js +0 -462
  7. package/bin/runners/context/api-contracts.js +0 -427
  8. package/bin/runners/context/context-diff.js +0 -342
  9. package/bin/runners/context/context-pruner.js +0 -291
  10. package/bin/runners/context/dependency-graph.js +0 -414
  11. package/bin/runners/context/generators/claude.js +0 -107
  12. package/bin/runners/context/generators/codex.js +0 -108
  13. package/bin/runners/context/generators/copilot.js +0 -119
  14. package/bin/runners/context/generators/cursor.js +0 -514
  15. package/bin/runners/context/generators/mcp.js +0 -151
  16. package/bin/runners/context/generators/windsurf.js +0 -180
  17. package/bin/runners/context/git-context.js +0 -302
  18. package/bin/runners/context/index.js +0 -1042
  19. package/bin/runners/context/insights.js +0 -173
  20. package/bin/runners/context/mcp-server/generate-rules.js +0 -337
  21. package/bin/runners/context/mcp-server/index.js +0 -1176
  22. package/bin/runners/context/mcp-server/package.json +0 -24
  23. package/bin/runners/context/memory.js +0 -200
  24. package/bin/runners/context/monorepo.js +0 -215
  25. package/bin/runners/context/multi-repo-federation.js +0 -404
  26. package/bin/runners/context/patterns.js +0 -253
  27. package/bin/runners/context/proof-context.js +0 -972
  28. package/bin/runners/context/security-scanner.js +0 -303
  29. package/bin/runners/context/semantic-search.js +0 -350
  30. package/bin/runners/context/shared.js +0 -264
  31. package/bin/runners/context/team-conventions.js +0 -310
  32. package/bin/runners/lib/ai-bridge.js +0 -416
  33. package/bin/runners/lib/analysis-core.js +0 -271
  34. package/bin/runners/lib/analyzers.js +0 -541
  35. package/bin/runners/lib/audit-bridge.js +0 -391
  36. package/bin/runners/lib/auth-truth.js +0 -193
  37. package/bin/runners/lib/auth.js +0 -215
  38. package/bin/runners/lib/backup.js +0 -62
  39. package/bin/runners/lib/billing.js +0 -107
  40. package/bin/runners/lib/claims.js +0 -118
  41. package/bin/runners/lib/cli-ui.js +0 -540
  42. package/bin/runners/lib/compliance-bridge-new.js +0 -0
  43. package/bin/runners/lib/compliance-bridge.js +0 -165
  44. package/bin/runners/lib/contracts/auth-contract.js +0 -194
  45. package/bin/runners/lib/contracts/env-contract.js +0 -178
  46. package/bin/runners/lib/contracts/external-contract.js +0 -198
  47. package/bin/runners/lib/contracts/guard.js +0 -168
  48. package/bin/runners/lib/contracts/index.js +0 -89
  49. package/bin/runners/lib/contracts/plan-validator.js +0 -311
  50. package/bin/runners/lib/contracts/route-contract.js +0 -192
  51. package/bin/runners/lib/detect.js +0 -89
  52. package/bin/runners/lib/doctor/autofix.js +0 -254
  53. package/bin/runners/lib/doctor/index.js +0 -37
  54. package/bin/runners/lib/doctor/modules/dependencies.js +0 -325
  55. package/bin/runners/lib/doctor/modules/index.js +0 -46
  56. package/bin/runners/lib/doctor/modules/network.js +0 -250
  57. package/bin/runners/lib/doctor/modules/project.js +0 -312
  58. package/bin/runners/lib/doctor/modules/runtime.js +0 -224
  59. package/bin/runners/lib/doctor/modules/security.js +0 -348
  60. package/bin/runners/lib/doctor/modules/system.js +0 -213
  61. package/bin/runners/lib/doctor/modules/vibecheck.js +0 -394
  62. package/bin/runners/lib/doctor/reporter.js +0 -262
  63. package/bin/runners/lib/doctor/service.js +0 -262
  64. package/bin/runners/lib/doctor/types.js +0 -113
  65. package/bin/runners/lib/doctor/ui.js +0 -263
  66. package/bin/runners/lib/doctor-enhanced.js +0 -233
  67. package/bin/runners/lib/doctor-v2.js +0 -608
  68. package/bin/runners/lib/enforcement.js +0 -72
@@ -1,325 +0,0 @@
1
- /**
2
- * Dependencies Diagnostics Module
3
- *
4
- * Checks for outdated packages, vulnerabilities, and dependency health
5
- */
6
-
7
- const fs = require('fs');
8
- const path = require('path');
9
- const { execSync } = require('child_process');
10
- const { SEVERITY, CATEGORY, FIX_TYPE } = require('../types');
11
-
12
- const MODULE_ID = 'dependencies';
13
-
14
- function createDiagnostics(projectPath) {
15
- return [
16
- {
17
- id: `${MODULE_ID}.outdated`,
18
- name: 'Outdated Packages',
19
- category: CATEGORY.DEPENDENCIES,
20
- parallel: true,
21
- check: async () => {
22
- try {
23
- // Try npm outdated (returns non-zero if outdated packages exist)
24
- const result = execSync('npm outdated --json 2>/dev/null || echo "{}"', {
25
- cwd: projectPath,
26
- encoding: 'utf8',
27
- timeout: 30000,
28
- stdio: ['pipe', 'pipe', 'pipe'],
29
- }).trim();
30
-
31
- const outdated = JSON.parse(result || '{}');
32
- const count = Object.keys(outdated).length;
33
-
34
- const metadata = { count, packages: outdated };
35
-
36
- // Check for major version updates
37
- const majorUpdates = Object.entries(outdated).filter(([_, info]) => {
38
- const current = parseInt((info.current || '0').split('.')[0]);
39
- const latest = parseInt((info.latest || '0').split('.')[0]);
40
- return latest > current;
41
- });
42
-
43
- if (majorUpdates.length > 0) {
44
- return {
45
- severity: SEVERITY.INFO,
46
- message: `${count} outdated (${majorUpdates.length} major)`,
47
- detail: `Major updates: ${majorUpdates.slice(0, 3).map(([n]) => n).join(', ')}${majorUpdates.length > 3 ? '...' : ''}`,
48
- metadata,
49
- fixes: [{
50
- type: FIX_TYPE.COMMAND,
51
- description: 'Update all packages',
52
- command: 'npm update',
53
- autoFixable: false,
54
- }],
55
- };
56
- }
57
-
58
- if (count > 0) {
59
- return {
60
- severity: SEVERITY.INFO,
61
- message: `${count} minor/patch updates available`,
62
- metadata,
63
- };
64
- }
65
-
66
- return {
67
- severity: SEVERITY.PASS,
68
- message: 'All packages up to date',
69
- metadata,
70
- };
71
- } catch {
72
- return {
73
- severity: SEVERITY.INFO,
74
- message: 'Could not check for outdated packages',
75
- };
76
- }
77
- },
78
- },
79
- {
80
- id: `${MODULE_ID}.audit`,
81
- name: 'Security Vulnerabilities',
82
- category: CATEGORY.DEPENDENCIES,
83
- parallel: true,
84
- check: async () => {
85
- try {
86
- const result = execSync('npm audit --json 2>/dev/null || echo "{}"', {
87
- cwd: projectPath,
88
- encoding: 'utf8',
89
- timeout: 60000,
90
- stdio: ['pipe', 'pipe', 'pipe'],
91
- }).trim();
92
-
93
- let audit;
94
- try {
95
- audit = JSON.parse(result || '{}');
96
- } catch {
97
- return {
98
- severity: SEVERITY.INFO,
99
- message: 'Could not parse audit results',
100
- };
101
- }
102
-
103
- const vulnerabilities = audit.metadata?.vulnerabilities || {};
104
- const total = vulnerabilities.total || 0;
105
- const critical = vulnerabilities.critical || 0;
106
- const high = vulnerabilities.high || 0;
107
- const moderate = vulnerabilities.moderate || 0;
108
- const low = vulnerabilities.low || 0;
109
-
110
- const metadata = { total, critical, high, moderate, low };
111
-
112
- if (critical > 0) {
113
- return {
114
- severity: SEVERITY.ERROR,
115
- message: `${critical} critical vulnerabilities`,
116
- detail: `Total: ${total} (${high} high, ${moderate} moderate, ${low} low)`,
117
- metadata,
118
- fixes: [
119
- {
120
- type: FIX_TYPE.COMMAND,
121
- description: 'Auto-fix vulnerabilities',
122
- command: 'npm audit fix',
123
- autoFixable: true,
124
- },
125
- {
126
- type: FIX_TYPE.COMMAND,
127
- description: 'Force fix (may have breaking changes)',
128
- command: 'npm audit fix --force',
129
- dangerous: true,
130
- autoFixable: false,
131
- },
132
- ],
133
- };
134
- }
135
-
136
- if (high > 0) {
137
- return {
138
- severity: SEVERITY.WARNING,
139
- message: `${high} high severity vulnerabilities`,
140
- detail: `Total: ${total} (${moderate} moderate, ${low} low)`,
141
- metadata,
142
- fixes: [{
143
- type: FIX_TYPE.COMMAND,
144
- description: 'Auto-fix vulnerabilities',
145
- command: 'npm audit fix',
146
- autoFixable: true,
147
- }],
148
- };
149
- }
150
-
151
- if (total > 0) {
152
- return {
153
- severity: SEVERITY.INFO,
154
- message: `${total} low/moderate vulnerabilities`,
155
- metadata,
156
- };
157
- }
158
-
159
- return {
160
- severity: SEVERITY.PASS,
161
- message: 'No known vulnerabilities',
162
- metadata,
163
- };
164
- } catch {
165
- return {
166
- severity: SEVERITY.INFO,
167
- message: 'Could not run security audit',
168
- };
169
- }
170
- },
171
- },
172
- {
173
- id: `${MODULE_ID}.peer_deps`,
174
- name: 'Peer Dependencies',
175
- category: CATEGORY.DEPENDENCIES,
176
- parallel: true,
177
- check: async () => {
178
- try {
179
- const result = execSync('npm ls --json 2>&1 || true', {
180
- cwd: projectPath,
181
- encoding: 'utf8',
182
- timeout: 30000,
183
- stdio: ['pipe', 'pipe', 'pipe'],
184
- });
185
-
186
- // Look for peer dependency warnings
187
- const peerWarnings = (result.match(/WARN.*peer/gi) || []).length;
188
- const missingPeers = (result.match(/missing peer/gi) || []).length;
189
-
190
- const metadata = { peerWarnings, missingPeers };
191
-
192
- if (missingPeers > 0) {
193
- return {
194
- severity: SEVERITY.WARNING,
195
- message: `${missingPeers} missing peer dependencies`,
196
- metadata,
197
- fixes: [{
198
- type: FIX_TYPE.COMMAND,
199
- description: 'Install peer dependencies',
200
- command: 'npm install --legacy-peer-deps',
201
- autoFixable: false,
202
- }],
203
- };
204
- }
205
-
206
- return {
207
- severity: SEVERITY.PASS,
208
- message: 'Peer dependencies satisfied',
209
- metadata,
210
- };
211
- } catch {
212
- return {
213
- severity: SEVERITY.INFO,
214
- message: 'Could not check peer dependencies',
215
- };
216
- }
217
- },
218
- },
219
- {
220
- id: `${MODULE_ID}.duplicate`,
221
- name: 'Duplicate Packages',
222
- category: CATEGORY.DEPENDENCIES,
223
- parallel: true,
224
- check: async () => {
225
- try {
226
- const result = execSync('npm dedupe --dry-run 2>&1 || true', {
227
- cwd: projectPath,
228
- encoding: 'utf8',
229
- timeout: 30000,
230
- stdio: ['pipe', 'pipe', 'pipe'],
231
- });
232
-
233
- const wouldDedupe = result.includes('removed') || result.includes('dedupe');
234
-
235
- if (wouldDedupe) {
236
- return {
237
- severity: SEVERITY.INFO,
238
- message: 'Deduplication possible',
239
- fixes: [{
240
- type: FIX_TYPE.COMMAND,
241
- description: 'Deduplicate packages',
242
- command: 'npm dedupe',
243
- autoFixable: true,
244
- }],
245
- };
246
- }
247
-
248
- return {
249
- severity: SEVERITY.PASS,
250
- message: 'No duplicates found',
251
- };
252
- } catch {
253
- return {
254
- severity: SEVERITY.INFO,
255
- message: 'Could not check for duplicates',
256
- };
257
- }
258
- },
259
- },
260
- {
261
- id: `${MODULE_ID}.engines`,
262
- name: 'Engine Requirements',
263
- category: CATEGORY.DEPENDENCIES,
264
- parallel: true,
265
- check: async () => {
266
- const pkgPath = path.join(projectPath, 'package.json');
267
-
268
- try {
269
- const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
270
-
271
- if (!pkg.engines) {
272
- return {
273
- severity: SEVERITY.INFO,
274
- message: 'No engine requirements specified',
275
- fixes: [{
276
- type: FIX_TYPE.MANUAL,
277
- description: 'Add "engines" field to package.json to enforce Node version',
278
- autoFixable: false,
279
- }],
280
- };
281
- }
282
-
283
- const nodeReq = pkg.engines.node;
284
- const npmReq = pkg.engines.npm;
285
-
286
- const metadata = { nodeReq, npmReq };
287
-
288
- // Basic semver check against current version
289
- if (nodeReq) {
290
- const currentMajor = parseInt(process.version.slice(1).split('.')[0]);
291
- const minMatch = nodeReq.match(/>=?\s*(\d+)/);
292
- const minRequired = minMatch ? parseInt(minMatch[1]) : 0;
293
-
294
- if (currentMajor < minRequired) {
295
- return {
296
- severity: SEVERITY.ERROR,
297
- message: `Node ${process.version} does not satisfy "${nodeReq}"`,
298
- metadata,
299
- fixes: [{
300
- type: FIX_TYPE.COMMAND,
301
- description: `Upgrade to Node ${minRequired}+`,
302
- command: `nvm install ${minRequired}`,
303
- autoFixable: false,
304
- }],
305
- };
306
- }
307
- }
308
-
309
- return {
310
- severity: SEVERITY.PASS,
311
- message: nodeReq ? `node: ${nodeReq}` : 'Specified',
312
- metadata,
313
- };
314
- } catch {
315
- return {
316
- severity: SEVERITY.INFO,
317
- message: 'Could not check engine requirements',
318
- };
319
- }
320
- },
321
- },
322
- ];
323
- }
324
-
325
- module.exports = { MODULE_ID, createDiagnostics };
@@ -1,46 +0,0 @@
1
- /**
2
- * Diagnostic Modules Index
3
- *
4
- * Exports all diagnostic modules for the Doctor service
5
- */
6
-
7
- const system = require('./system');
8
- const runtime = require('./runtime');
9
- const project = require('./project');
10
- const dependencies = require('./dependencies');
11
- const security = require('./security');
12
- const network = require('./network');
13
- const vibecheck = require('./vibecheck');
14
-
15
- const ALL_MODULES = [
16
- system,
17
- runtime,
18
- project,
19
- dependencies,
20
- security,
21
- network,
22
- vibecheck,
23
- ];
24
-
25
- function getAllDiagnostics(projectPath) {
26
- const diagnostics = [];
27
-
28
- for (const mod of ALL_MODULES) {
29
- const moduleDiagnostics = mod.createDiagnostics(projectPath);
30
- diagnostics.push(...moduleDiagnostics);
31
- }
32
-
33
- return diagnostics;
34
- }
35
-
36
- module.exports = {
37
- system,
38
- runtime,
39
- project,
40
- dependencies,
41
- security,
42
- network,
43
- vibecheck,
44
- ALL_MODULES,
45
- getAllDiagnostics,
46
- };
@@ -1,250 +0,0 @@
1
- /**
2
- * Network Diagnostics Module
3
- *
4
- * Checks network connectivity, API availability, and proxy configuration
5
- */
6
-
7
- const https = require('https');
8
- const http = require('http');
9
- const { SEVERITY, CATEGORY, FIX_TYPE } = require('../types');
10
-
11
- const MODULE_ID = 'network';
12
-
13
- const ENDPOINTS = [
14
- { name: 'npm Registry', url: 'https://registry.npmjs.org/', required: true },
15
- { name: 'GitHub API', url: 'https://api.github.com/', required: false },
16
- { name: 'vibecheck API', url: 'https://api.vibecheck.dev/health', required: false },
17
- ];
18
-
19
- function checkUrl(url, timeout = 5000) {
20
- return new Promise((resolve) => {
21
- const protocol = url.startsWith('https') ? https : http;
22
- const startTime = Date.now();
23
-
24
- const req = protocol.get(url, { timeout }, (res) => {
25
- const latency = Date.now() - startTime;
26
- resolve({
27
- ok: res.statusCode >= 200 && res.statusCode < 400,
28
- statusCode: res.statusCode,
29
- latency,
30
- });
31
- res.destroy();
32
- });
33
-
34
- req.on('error', (err) => {
35
- resolve({
36
- ok: false,
37
- error: err.message,
38
- latency: Date.now() - startTime,
39
- });
40
- });
41
-
42
- req.on('timeout', () => {
43
- resolve({
44
- ok: false,
45
- error: 'Timeout',
46
- latency: timeout,
47
- });
48
- req.destroy();
49
- });
50
- });
51
- }
52
-
53
- function createDiagnostics(projectPath) {
54
- return [
55
- {
56
- id: `${MODULE_ID}.internet`,
57
- name: 'Internet Connectivity',
58
- category: CATEGORY.NETWORK,
59
- parallel: true,
60
- check: async () => {
61
- const result = await checkUrl('https://www.google.com/', 5000);
62
-
63
- if (!result.ok) {
64
- return {
65
- severity: SEVERITY.ERROR,
66
- message: 'No internet connection',
67
- detail: result.error || 'Cannot reach google.com',
68
- fixes: [{
69
- type: FIX_TYPE.MANUAL,
70
- description: 'Check your network connection and firewall settings',
71
- autoFixable: false,
72
- }],
73
- };
74
- }
75
-
76
- return {
77
- severity: SEVERITY.PASS,
78
- message: `Connected (${result.latency}ms)`,
79
- metadata: { latency: result.latency },
80
- };
81
- },
82
- },
83
- {
84
- id: `${MODULE_ID}.npm_registry`,
85
- name: 'npm Registry',
86
- category: CATEGORY.NETWORK,
87
- parallel: true,
88
- check: async () => {
89
- const result = await checkUrl('https://registry.npmjs.org/', 10000);
90
-
91
- if (!result.ok) {
92
- return {
93
- severity: SEVERITY.ERROR,
94
- message: 'Cannot reach npm registry',
95
- detail: result.error,
96
- fixes: [
97
- {
98
- type: FIX_TYPE.MANUAL,
99
- description: 'Check if npm registry is blocked by firewall',
100
- autoFixable: false,
101
- },
102
- {
103
- type: FIX_TYPE.COMMAND,
104
- description: 'Use alternative registry',
105
- command: 'npm config set registry https://registry.npmmirror.com',
106
- autoFixable: false,
107
- },
108
- ],
109
- };
110
- }
111
-
112
- if (result.latency > 3000) {
113
- return {
114
- severity: SEVERITY.WARNING,
115
- message: `Slow connection (${result.latency}ms)`,
116
- detail: 'Package installations may be slow',
117
- metadata: { latency: result.latency },
118
- };
119
- }
120
-
121
- return {
122
- severity: SEVERITY.PASS,
123
- message: `Reachable (${result.latency}ms)`,
124
- metadata: { latency: result.latency },
125
- };
126
- },
127
- },
128
- {
129
- id: `${MODULE_ID}.github`,
130
- name: 'GitHub API',
131
- category: CATEGORY.NETWORK,
132
- parallel: true,
133
- check: async () => {
134
- const result = await checkUrl('https://api.github.com/', 5000);
135
-
136
- if (!result.ok) {
137
- return {
138
- severity: SEVERITY.INFO,
139
- message: 'Cannot reach GitHub API',
140
- detail: 'Some features may be limited',
141
- metadata: { error: result.error },
142
- };
143
- }
144
-
145
- return {
146
- severity: SEVERITY.PASS,
147
- message: `Reachable (${result.latency}ms)`,
148
- metadata: { latency: result.latency },
149
- };
150
- },
151
- },
152
- {
153
- id: `${MODULE_ID}.vibecheck_api`,
154
- name: 'vibecheck API',
155
- category: CATEGORY.NETWORK,
156
- parallel: true,
157
- check: async () => {
158
- // Check if API key is configured
159
- const hasApiKey = !!process.env.VIBECHECK_API_KEY;
160
-
161
- if (!hasApiKey) {
162
- return {
163
- severity: SEVERITY.INFO,
164
- message: 'API key not configured (offline mode)',
165
- detail: 'Set VIBECHECK_API_KEY for cloud features',
166
- };
167
- }
168
-
169
- const apiUrl = process.env.VIBECHECK_API_URL || 'https://api.vibecheck.dev';
170
- const result = await checkUrl(`${apiUrl}/health`, 5000);
171
-
172
- if (!result.ok) {
173
- return {
174
- severity: SEVERITY.WARNING,
175
- message: 'vibecheck API unreachable',
176
- detail: 'Cloud features may be unavailable',
177
- metadata: { error: result.error, apiUrl },
178
- };
179
- }
180
-
181
- return {
182
- severity: SEVERITY.PASS,
183
- message: `Connected (${result.latency}ms)`,
184
- metadata: { latency: result.latency, apiUrl },
185
- };
186
- },
187
- },
188
- {
189
- id: `${MODULE_ID}.proxy`,
190
- name: 'Proxy Configuration',
191
- category: CATEGORY.NETWORK,
192
- parallel: true,
193
- check: async () => {
194
- const httpProxy = process.env.HTTP_PROXY || process.env.http_proxy;
195
- const httpsProxy = process.env.HTTPS_PROXY || process.env.https_proxy;
196
- const noProxy = process.env.NO_PROXY || process.env.no_proxy;
197
-
198
- const metadata = { httpProxy, httpsProxy, noProxy };
199
-
200
- if (httpProxy || httpsProxy) {
201
- return {
202
- severity: SEVERITY.INFO,
203
- message: `Proxy configured: ${httpsProxy || httpProxy}`,
204
- metadata,
205
- };
206
- }
207
-
208
- return {
209
- severity: SEVERITY.PASS,
210
- message: 'No proxy configured',
211
- metadata,
212
- };
213
- },
214
- },
215
- {
216
- id: `${MODULE_ID}.dns`,
217
- name: 'DNS Resolution',
218
- category: CATEGORY.NETWORK,
219
- parallel: true,
220
- check: async () => {
221
- const dns = require('dns').promises;
222
- const startTime = Date.now();
223
-
224
- try {
225
- await dns.resolve('registry.npmjs.org');
226
- const latency = Date.now() - startTime;
227
-
228
- return {
229
- severity: SEVERITY.PASS,
230
- message: `Working (${latency}ms)`,
231
- metadata: { latency },
232
- };
233
- } catch (err) {
234
- return {
235
- severity: SEVERITY.ERROR,
236
- message: 'DNS resolution failed',
237
- detail: err.message,
238
- fixes: [{
239
- type: FIX_TYPE.MANUAL,
240
- description: 'Check DNS settings or use 8.8.8.8 / 1.1.1.1',
241
- autoFixable: false,
242
- }],
243
- };
244
- }
245
- },
246
- },
247
- ];
248
- }
249
-
250
- module.exports = { MODULE_ID, createDiagnostics, checkUrl };