devintelligence 1.0.0 → 1.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 (75) hide show
  1. package/.env.example +14 -14
  2. package/LICENSE +22 -22
  3. package/README.md +146 -146
  4. package/bin/devintelligence.js +2481 -12
  5. package/bin/devintelligence.ts +244 -103
  6. package/dist/App.d.ts +3 -0
  7. package/dist/ai.js +366 -0
  8. package/dist/ai.js.map +7 -0
  9. package/dist/components/DeepAnalysisViews.d.ts +13 -0
  10. package/dist/components/MobileAndPlatformViews.d.ts +22 -0
  11. package/dist/components/OverviewAndExplorerViews.d.ts +20 -0
  12. package/dist/components/RepairAndGateViews.d.ts +25 -0
  13. package/dist/engine/aiEngine.d.ts +62 -0
  14. package/dist/engine/analyzerEngine.d.ts +19 -0
  15. package/dist/engine/repairEngine.d.ts +42 -0
  16. package/dist/engine.js +1541 -0
  17. package/dist/engine.js.map +7 -0
  18. package/dist/index.d.ts +10 -0
  19. package/dist/index.js +2344 -0
  20. package/dist/index.js.map +7 -0
  21. package/dist/main.d.ts +1 -0
  22. package/dist/repair.js +2052 -0
  23. package/dist/repair.js.map +7 -0
  24. package/dist/src/App.d.ts +3 -0
  25. package/dist/src/components/DeepAnalysisViews.d.ts +13 -0
  26. package/dist/src/components/MobileAndPlatformViews.d.ts +22 -0
  27. package/dist/src/components/OverviewAndExplorerViews.d.ts +20 -0
  28. package/dist/src/components/RepairAndGateViews.d.ts +25 -0
  29. package/dist/src/engine/aiEngine.d.ts +62 -0
  30. package/dist/src/engine/analyzerEngine.d.ts +19 -0
  31. package/dist/src/engine/repairEngine.d.ts +42 -0
  32. package/dist/src/index.d.ts +10 -0
  33. package/dist/src/main.d.ts +1 -0
  34. package/dist/src/types/devintelligence.d.ts +250 -0
  35. package/dist/types/devintelligence.d.ts +250 -0
  36. package/fixtures/django-analytics-service/requirements.txt +4 -4
  37. package/fixtures/django-analytics-service/settings.py +16 -16
  38. package/fixtures/express-api-gateway/package.json +14 -14
  39. package/fixtures/express-api-gateway/src/server.ts +16 -16
  40. package/fixtures/nextjs-saas-portal/package.json +21 -21
  41. package/fixtures/nextjs-saas-portal/src/app/dashboard/page.tsx +26 -26
  42. package/fixtures/rn-bare-fitness/android/build.gradle +19 -19
  43. package/fixtures/rn-bare-fitness/ios/Info.plist +14 -14
  44. package/fixtures/rn-bare-fitness/package.json +23 -23
  45. package/fixtures/rn-bare-fitness/src/WorkoutTracker.tsx +31 -31
  46. package/fixtures/rn-expo-commerce/android/app/build.gradle +20 -20
  47. package/fixtures/rn-expo-commerce/android/app/src/main/AndroidManifest.xml +21 -21
  48. package/fixtures/rn-expo-commerce/android/gradle.properties +6 -6
  49. package/fixtures/rn-expo-commerce/app.json +17 -17
  50. package/fixtures/rn-expo-commerce/babel.config.js +10 -10
  51. package/fixtures/rn-expo-commerce/ios/Podfile +13 -13
  52. package/fixtures/rn-expo-commerce/metro.config.js +7 -7
  53. package/fixtures/rn-expo-commerce/package.json +31 -31
  54. package/fixtures/rn-expo-commerce/src/components/LegacyPromoBanner.tsx +11 -11
  55. package/fixtures/rn-expo-commerce/src/screens/ProductFeedScreen.tsx +48 -48
  56. package/fixtures/rn-expo-commerce/src/services/api.ts +15 -15
  57. package/package.json +89 -77
  58. package/index.html +0 -21
  59. package/server.ts +0 -275
  60. package/src/App.tsx +0 -783
  61. package/src/components/DeepAnalysisViews.tsx +0 -526
  62. package/src/components/MobileAndPlatformViews.tsx +0 -625
  63. package/src/components/OverviewAndExplorerViews.tsx +0 -753
  64. package/src/components/RepairAndGateViews.tsx +0 -814
  65. package/src/engine/aiEngine.test.ts +0 -86
  66. package/src/engine/aiEngine.ts +0 -346
  67. package/src/engine/analyzerEngine.test.ts +0 -110
  68. package/src/engine/analyzerEngine.ts +0 -1579
  69. package/src/engine/repairEngine.ts +0 -545
  70. package/src/index.css +0 -44
  71. package/src/index.ts +0 -59
  72. package/src/main.tsx +0 -5
  73. package/src/types/devintelligence.ts +0 -310
  74. package/tsconfig.json +0 -28
  75. package/vite.config.ts +0 -22
@@ -19,11 +19,18 @@ import {
19
19
  diagnoseRawErrorLogWithAi,
20
20
  generateProjectAiAdvice,
21
21
  askDevIntelligenceAi,
22
+ getGroqApiKey,
22
23
  } from '../src/engine/aiEngine.ts';
23
24
 
25
+ // Load environment variables (.env in cwd or root)
24
26
  try {
25
27
  if (typeof process.loadEnvFile === 'function') {
26
- process.loadEnvFile();
28
+ const cwdEnv = path.join(process.cwd(), '.env');
29
+ if (fs.existsSync(cwdEnv)) {
30
+ process.loadEnvFile(cwdEnv);
31
+ } else {
32
+ process.loadEnvFile();
33
+ }
27
34
  }
28
35
  } catch {}
29
36
 
@@ -31,9 +38,70 @@ const __filename = fileURLToPath(import.meta.url);
31
38
  const __dirname = path.dirname(__filename);
32
39
  const rootWorkspaceDir = path.resolve(__dirname, '..');
33
40
 
41
+ // Terminal ANSI Styling Helpers
42
+ const isColorSupported =
43
+ !process.env.NO_COLOR &&
44
+ (Boolean(process.stdout?.isTTY) || process.env.FORCE_COLOR !== undefined);
45
+
46
+ const c = {
47
+ reset: (s: string | number) => (isColorSupported ? `\x1b[0m${s}\x1b[0m` : String(s)),
48
+ bold: (s: string | number) => (isColorSupported ? `\x1b[1m${s}\x1b[22m` : String(s)),
49
+ dim: (s: string | number) => (isColorSupported ? `\x1b[2m${s}\x1b[22m` : String(s)),
50
+ cyan: (s: string | number) => (isColorSupported ? `\x1b[36m${s}\x1b[39m` : String(s)),
51
+ blue: (s: string | number) => (isColorSupported ? `\x1b[34m${s}\x1b[39m` : String(s)),
52
+ green: (s: string | number) => (isColorSupported ? `\x1b[32m${s}\x1b[39m` : String(s)),
53
+ yellow: (s: string | number) => (isColorSupported ? `\x1b[33m${s}\x1b[39m` : String(s)),
54
+ red: (s: string | number) => (isColorSupported ? `\x1b[31m${s}\x1b[39m` : String(s)),
55
+ magenta: (s: string | number) => (isColorSupported ? `\x1b[35m${s}\x1b[39m` : String(s)),
56
+ gray: (s: string | number) => (isColorSupported ? `\x1b[90m${s}\x1b[39m` : String(s)),
57
+ bgBlue: (s: string | number) => (isColorSupported ? `\x1b[44m\x1b[37m ${s} \x1b[49m\x1b[39m` : `[${s}]`),
58
+ bgCyan: (s: string | number) => (isColorSupported ? `\x1b[46m\x1b[30m ${s} \x1b[49m\x1b[39m` : `[${s}]`),
59
+ bgGreen: (s: string | number) => (isColorSupported ? `\x1b[42m\x1b[30m ${s} \x1b[49m\x1b[39m` : `[${s}]`),
60
+ bgRed: (s: string | number) => (isColorSupported ? `\x1b[41m\x1b[37m ${s} \x1b[49m\x1b[39m` : `[${s}]`),
61
+ bgMagenta: (s: string | number) => (isColorSupported ? `\x1b[45m\x1b[37m ${s} \x1b[49m\x1b[39m` : `[${s}]`),
62
+ };
63
+
64
+ function formatScore(score: number): string {
65
+ if (score >= 80) return c.green(c.bold(`${score}/100`));
66
+ if (score >= 60) return c.yellow(c.bold(`${score}/100`));
67
+ return c.red(c.bold(`${score}/100`));
68
+ }
69
+
70
+ function readStdin(): Promise<string> {
71
+ return new Promise((resolve) => {
72
+ let data = '';
73
+ const timer = setTimeout(() => {
74
+ process.stdin.pause();
75
+ resolve(data.trim());
76
+ }, 300);
77
+
78
+ process.stdin.setEncoding('utf8');
79
+ process.stdin.on('data', (chunk) => {
80
+ data += chunk;
81
+ });
82
+ process.stdin.on('end', () => {
83
+ clearTimeout(timer);
84
+ resolve(data.trim());
85
+ });
86
+ process.stdin.on('error', () => {
87
+ clearTimeout(timer);
88
+ resolve(data.trim());
89
+ });
90
+ });
91
+ }
92
+
34
93
  const args = process.argv.slice(2);
35
94
  const command = args[0] || 'help';
36
- const projectArg = args.find((a) => a.startsWith('--project='))?.split('=')[1] || 'rn-expo-commerce';
95
+
96
+ // Extract target project or path:
97
+ // 1. --project=<id_or_path>
98
+ // 2. positional argument after command (e.g. `devintelligence scan .` or `devintelligence scan /path`)
99
+ // 3. Defaults to current working directory (process.cwd())!
100
+ const explicitProject =
101
+ args.find((a) => a.startsWith('--project='))?.split('=')[1] ||
102
+ args.find((a) => !a.startsWith('-') && a !== command);
103
+
104
+ const projectArg = explicitProject || process.cwd();
37
105
  const isCi = args.includes('--ci');
38
106
 
39
107
  async function runCli() {
@@ -41,8 +109,8 @@ async function runCli() {
41
109
  case 'init': {
42
110
  const cwd = process.cwd();
43
111
  const projectName = path.basename(cwd);
44
- console.log(`\n=== DEVINTELLIGENCE INITIALIZATION ===`);
45
- console.log(`Initializing workspace in: ${cwd}`);
112
+ console.log(`\n${c.bgCyan(' DEVINTELLIGENCE INITIALIZATION ')}`);
113
+ console.log(`${c.dim('Initializing workspace configuration in:')} ${c.bold(cwd)}`);
46
114
 
47
115
  const report = registerLocalProject({
48
116
  name: projectName,
@@ -50,31 +118,33 @@ async function runCli() {
50
118
  baseWorkspaceDir: rootWorkspaceDir,
51
119
  });
52
120
 
53
- console.log(`\n[SUCCESS] Project Registered: ${report.name}`);
54
- console.log(`Ecosystem: ${report.ecosystem} | Framework: ${report.launchDoctor.frameworkName}`);
55
- console.log(`Package Manager: ${report.launchDoctor.packageManager} | Workflow: ${report.launchDoctor.workflowType}`);
56
- console.log(`Files Analyzed: ${report.filesAnalyzed.length}`);
57
- console.log(`Scores: Overall ${report.scores.overall}/100 | Quality ${report.scores.codeQuality}/100 | Security ${report.scores.security}/100`);
58
- console.log(`Issues Found: ${report.issues.length} (${report.issues.filter((i) => i.repairTier === 'SAFE').length} SAFE auto-repairable)`);
59
- console.log(`Recommended Launch: ${report.launchDoctor.recommendedStartCommand}`);
60
- console.log(`\nRun 'devintelligence scan' or 'devintelligence fix' to inspect and auto-repair.`);
121
+ console.log(`\n${c.green(c.bold('✔ [SUCCESS] Project Registered:'))} ${c.bold(report.name)}`);
122
+ console.log(` ${c.cyan('Ecosystem:')} ${report.ecosystem} | ${c.cyan('Framework:')} ${report.launchDoctor.frameworkName}`);
123
+ console.log(` ${c.cyan('Package Manager:')} ${report.launchDoctor.packageManager} | ${c.cyan('Workflow:')} ${report.launchDoctor.workflowType}`);
124
+ console.log(` ${c.cyan('Files Analyzed:')} ${report.filesAnalyzed.length}`);
125
+ console.log(` ${c.cyan('Health Scores:')} Overall ${formatScore(report.scores.overall)} | Quality ${formatScore(report.scores.codeQuality)} | Security ${formatScore(report.scores.security)}`);
126
+ console.log(` ${c.cyan('Issues Found:')} ${report.issues.length} (${report.issues.filter((i) => i.repairTier === 'SAFE').length} SAFE auto-repairable)`);
127
+ console.log(` ${c.cyan('Recommended Launch:')} ${c.bold(report.launchDoctor.recommendedStartCommand)}`);
128
+ console.log(`\nRun ${c.cyan('devintelligence scan')} or ${c.cyan('devintelligence fix')} to inspect and auto-repair.`);
61
129
  break;
62
130
  }
63
131
 
64
132
  case 'doctor': {
65
- console.log('\n=== DEVINTELLIGENCE ENVIRONMENT DOCTOR ===');
66
- console.log('Inspecting Node, Package Managers, React Native, Android & iOS Native Runtimes...\n');
133
+ console.log(`\n${c.bgBlue(' DEVINTELLIGENCE ENVIRONMENT DOCTOR ')}`);
134
+ console.log(`${c.dim('Inspecting Node, Package Managers, React Native, Android & iOS Native Runtimes...\n')}`);
67
135
  const checks = inspectHostEnvironment(true);
68
- for (const c of checks) {
69
- let tag = `[WORKING]`;
70
- if (c.status === 'not_installed') tag = `[MISSING]`;
71
- if (c.status === 'incompatible') tag = `[INCOMPATIBLE]`;
72
- if (c.status === 'misconfigured') tag = `[MISCONFIGURED]`;
73
- if (c.status === 'os_unsupported') tag = `[OS UNSUPPORTED]`;
74
-
75
- console.log(`${tag.padEnd(17)} ${c.name.padEnd(30)} ${c.detectedVersion || 'Not found'} (Req: ${c.requiredVersion})`);
76
- if (c.status !== 'working' && c.remediationCommand) {
77
- console.log(` -> Fix Command: ${c.remediationCommand}`);
136
+ for (const ch of checks) {
137
+ let tag = c.green(c.bold('✔ [WORKING] '));
138
+ if (ch.status === 'not_installed') tag = c.red(c.bold('✖ [MISSING] '));
139
+ if (ch.status === 'incompatible') tag = c.red(c.bold('✖ [INCOMPATIBLE] '));
140
+ if (ch.status === 'misconfigured') tag = c.yellow(c.bold('⚠ [MISCONFIGURED]'));
141
+ if (ch.status === 'os_unsupported') tag = c.gray('• [OS UNSUPPORTED]');
142
+
143
+ const nameCol = ch.name.padEnd(30);
144
+ const verCol = ch.detectedVersion || 'Not found';
145
+ console.log(`${tag} ${c.bold(nameCol)} ${verCol} ${c.dim(`(Req: ${ch.requiredVersion})`)}`);
146
+ if (ch.status !== 'working' && ch.remediationCommand) {
147
+ console.log(` ${c.cyan('➜ Fix Command:')} ${c.bold(ch.remediationCommand)}`);
78
148
  }
79
149
  }
80
150
  break;
@@ -82,40 +152,44 @@ async function runCli() {
82
152
 
83
153
  case 'scan': {
84
154
  const report = getProjectReportById(projectArg, true, rootWorkspaceDir);
85
- console.log(`\n=== DEVINTELLIGENCE SCAN: ${report.name} ===`);
86
- console.log(`Ecosystem: ${report.ecosystem} | Framework: ${report.launchDoctor.frameworkName}`);
87
- console.log(`Files Analyzed: ${report.filesAnalyzed.length} | Scan Time: ${report.scanDurationMs}ms`);
88
- console.log(`\nScores:`);
89
- console.log(` - Overall Health: ${report.scores.overall}/100`);
90
- console.log(` - React Native: ${report.scores.reactNative}/100`);
91
- console.log(` - Code Quality: ${report.scores.codeQuality}/100`);
92
- console.log(` - Design Tokens: ${report.scores.designQuality}/100`);
93
- console.log(` - Performance: ${report.scores.performance}/100`);
94
- console.log(` - Security Audit: ${report.scores.security}/100`);
155
+ console.log(`\n${c.bgCyan(` DEVINTELLIGENCE SCAN: ${report.name} `)}`);
156
+ console.log(`${c.cyan('Root Path:')} ${c.dim(report.rootPath)}`);
157
+ console.log(`${c.cyan('Ecosystem:')} ${report.ecosystem} | ${c.cyan('Framework:')} ${report.launchDoctor.frameworkName}`);
158
+ console.log(`${c.cyan('Files Analyzed:')} ${report.filesAnalyzed.length} | ${c.cyan('Scan Time:')} ${report.scanDurationMs}ms`);
159
+
160
+ console.log(`\n${c.bold('Scores:')}`);
161
+ console.log(` - Overall Health: ${formatScore(report.scores.overall)}`);
162
+ console.log(` - React Native: ${formatScore(report.scores.reactNative)}`);
163
+ console.log(` - Code Quality: ${formatScore(report.scores.codeQuality)}`);
164
+ console.log(` - Design Tokens: ${formatScore(report.scores.designQuality)}`);
165
+ console.log(` - Performance: ${formatScore(report.scores.performance)}`);
166
+ console.log(` - Security Audit: ${formatScore(report.scores.security)}`);
95
167
 
96
168
  const safeIssues = report.issues.filter((i) => i.repairTier === 'SAFE');
97
169
  const reviewIssues = report.issues.filter((i) => i.repairTier === 'REVIEW_REQUIRED');
98
170
  const criticalIssues = report.issues.filter((i) => i.severity === 'critical');
99
171
 
100
- console.log(`\nIssues Summary: ${report.issues.length} detected`);
101
- console.log(` - Critical: ${criticalIssues.length}`);
102
- console.log(` - SAFE Auto-Fix: ${safeIssues.length}`);
172
+ console.log(`\n${c.bold('Issues Summary:')} ${report.issues.length} detected`);
173
+ console.log(` - Critical: ${criticalIssues.length > 0 ? c.red(c.bold(criticalIssues.length)) : c.green(0)}`);
174
+ console.log(` - SAFE Auto-Fix: ${safeIssues.length > 0 ? c.yellow(c.bold(safeIssues.length)) : 0}`);
103
175
  console.log(` - Review Required: ${reviewIssues.length}`);
104
176
 
105
177
  if (report.issues.length > 0) {
106
- console.log(`\nTop Findings:`);
178
+ console.log(`\n${c.bold('Top Findings:')}`);
107
179
  report.issues.slice(0, 5).forEach((issue, idx) => {
108
- console.log(` ${idx + 1}. [${issue.severity.toUpperCase()}] ${issue.title}`);
109
- console.log(` File: ${issue.filePath}:${issue.line} (${issue.repairTier})`);
180
+ const sevColor = issue.severity === 'critical' ? c.red : issue.severity === 'high' ? c.yellow : c.cyan;
181
+ console.log(` ${idx + 1}. [${sevColor(issue.severity.toUpperCase())}] ${c.bold(issue.title)}`);
182
+ console.log(` File: ${c.dim(`${issue.filePath}:${issue.line}`)} (${issue.repairTier === 'SAFE' ? c.green('SAFE Auto-Repair') : c.yellow('Review Required')})`);
110
183
  });
111
184
  }
112
185
 
113
- console.log(`\nQuality Gate: ${report.qualityGateEvaluation.passed ? 'PASSED ✅' : 'FAILED ❌'}`);
114
- if (!report.qualityGateEvaluation.passed) {
186
+ const gatePass = report.qualityGateEvaluation.passed;
187
+ console.log(`\n${c.bold('Quality Gate:')} ${gatePass ? c.bgGreen(' PASSED ✅ ') : c.bgRed(' FAILED ❌ ')}`);
188
+ if (!gatePass) {
115
189
  const failedChecks = (report.qualityGateEvaluation.checks || [])
116
- .filter((c) => !c.passed)
117
- .map((c) => `${c.name} (Actual: ${c.actual} vs Required: ${c.threshold})`);
118
- console.log(` Violations: ${failedChecks.join('; ')}`);
190
+ .filter((ch) => !ch.passed)
191
+ .map((ch) => `${ch.name} (Actual: ${ch.actual} vs Required: ${ch.threshold})`);
192
+ console.log(` ${c.red('Violations:')} ${failedChecks.join('; ')}`);
119
193
  }
120
194
 
121
195
  if (isCi) {
@@ -125,64 +199,124 @@ async function runCli() {
125
199
  }
126
200
 
127
201
  case 'diagnose': {
128
- const customLog = args[1] || PRESET_ERROR_LOGS[0].rawLog;
129
- console.log('\n=== DEVINTELLIGENCE ERROR DIAGNOSTICS ===');
130
- console.log('Analyzing error trace with Groq AI (with guaranteed zero-downtime heuristic fallback shield)...\n');
202
+ let customLog = '';
203
+
204
+ // 1. Check for --file=<path> or positional string arguments first
205
+ const fileFlag = args.find((a) => a.startsWith('--file='))?.split('=')[1];
206
+ const positionalWords = args.slice(1).filter((a) => !a.startsWith('-'));
207
+ const candidate = fileFlag || (positionalWords.length > 0 ? positionalWords.join(' ') : '');
208
+
209
+ if (candidate) {
210
+ const candidatePath = path.resolve(process.cwd(), candidate);
211
+ if (fs.existsSync(candidatePath) && fs.statSync(candidatePath).isFile()) {
212
+ try {
213
+ customLog = fs.readFileSync(candidatePath, 'utf8');
214
+ console.log(`${c.dim('[Reading error log from file:]')} ${c.bold(candidatePath)}`);
215
+ } catch {}
216
+ } else {
217
+ customLog = candidate;
218
+ }
219
+ }
220
+
221
+ // 2. Check if input is piped into stdin (only if no arguments were passed)
222
+ if (!customLog && !process.stdin.isTTY) {
223
+ try {
224
+ customLog = await readStdin();
225
+ } catch {}
226
+ }
227
+
228
+ // 3. Auto-detect recent project error logs
229
+ if (!customLog) {
230
+ const commonLogFiles = ['npm-debug.log', 'yarn-error.log', 'metro.log', 'error.log', 'build.log'];
231
+ for (const logFile of commonLogFiles) {
232
+ const fullPath = path.join(process.cwd(), logFile);
233
+ if (fs.existsSync(fullPath)) {
234
+ try {
235
+ const content = fs.readFileSync(fullPath, 'utf8').trim();
236
+ if (content.length > 20) {
237
+ console.log(`${c.cyan(`[Auto-Detected Log File: ${logFile}]`)}`);
238
+ customLog = content;
239
+ break;
240
+ }
241
+ } catch {}
242
+ }
243
+ }
244
+ }
245
+
246
+ const isPresetDemo = !customLog;
247
+ if (isPresetDemo) {
248
+ customLog = PRESET_ERROR_LOGS[0].rawLog;
249
+ console.log(`\n${c.yellow(c.bold('ℹ [NOTICE]'))} No error trace provided via argument, file, or stdin pipe.`);
250
+ console.log(`${c.dim('To diagnose real errors in your project:')}`);
251
+ console.log(` ${c.cyan('devintelligence diagnose "Error: <your stack trace>"')}`);
252
+ console.log(` ${c.cyan('devintelligence diagnose ./error.log')}`);
253
+ console.log(` ${c.cyan('npm test 2>&1 | devintelligence diagnose')}\n`);
254
+ console.log(`${c.dim('--- Running diagnosis on sample preset error log for demonstration ---')}`);
255
+ }
256
+
257
+ console.log(`\n${c.bgMagenta(' DEVINTELLIGENCE ERROR DIAGNOSTICS ')}`);
258
+ const apiKey = getGroqApiKey();
259
+ if (!apiKey) {
260
+ console.log(`${c.dim('[AI Engine Note: Set GROQ_API_KEY environment variable to enable Qwen-27B cloud acceleration. Using local zero-downtime heuristic rule engine.]')}\n`);
261
+ } else {
262
+ console.log(`${c.dim('Analyzing error trace with Groq AI (with zero-downtime heuristic shield)...\n')}`);
263
+ }
264
+
131
265
  const diag = await diagnoseRawErrorLogWithAi(customLog);
132
266
 
133
267
  if (diag.aiPowered) {
134
- console.log(`[AI-Powered: Groq ${diag.aiModel || 'Qwen 27B'}] Confidence: ${diag.confidence}%`);
268
+ console.log(`${c.magenta(c.bold(`[AI-Powered: Groq ${diag.aiModel || 'Qwen 27B'}]`))} Confidence: ${c.bold(`${diag.confidence}%`)}`);
135
269
  } else {
136
- console.log(`[Local Rule Engine - Zero Downtime Fallback] Confidence: ${diag.confidence}%`);
270
+ console.log(`${c.blue(c.bold('[Local Rule Engine - Zero Downtime Fallback]'))} Confidence: ${c.bold(`${diag.confidence}%`)}`);
137
271
  if (diag.fallbackReason) {
138
- console.log(`Note: ${diag.fallbackReason}`);
272
+ console.log(`Note: ${c.dim(diag.fallbackReason)}`);
139
273
  }
140
274
  }
141
275
 
142
- console.log(`Category: ${diag.category}`);
143
- console.log(`Severity: ${diag.severity.toUpperCase()}`);
144
- console.log(`Summary: ${diag.summary}`);
276
+ console.log(`Category: ${c.bold(diag.category)}`);
277
+ console.log(`Severity: ${diag.severity === 'critical' ? c.red(c.bold('CRITICAL')) : c.yellow(diag.severity.toUpperCase())}`);
278
+ console.log(`Summary: ${c.bold(diag.summary)}`);
145
279
  console.log(`Root Cause: ${diag.rootCause}`);
146
- console.log(`Responsible: ${diag.responsibleFile}${diag.line ? `:${diag.line}` : ''}`);
280
+ console.log(`Responsible: ${c.cyan(diag.responsibleFile)}${diag.line ? `:${diag.line}` : ''}`);
147
281
 
148
282
  if (diag.safeRepairSteps?.length) {
149
- console.log('\nRecommended Safe Repair Steps:');
283
+ console.log(`\n${c.bold('Recommended Safe Repair Steps:')}`);
150
284
  diag.safeRepairSteps.forEach((s, idx) => console.log(` ${idx + 1}. ${s}`));
151
285
  }
152
286
 
153
287
  if (diag.terminalCommands?.length) {
154
- console.log('\nExact Terminal Commands:');
155
- diag.terminalCommands.forEach((cmd) => console.log(` $ ${cmd}`));
288
+ console.log(`\n${c.bold('Exact Terminal Commands:')}`);
289
+ diag.terminalCommands.forEach((cmd) => console.log(` $ ${c.cyan(c.bold(cmd))}`));
156
290
  }
157
291
 
158
292
  if (diag.codePatchSuggestion) {
159
- console.log('\nSuggested Configuration / Code Patch:');
160
- console.log(diag.codePatchSuggestion);
293
+ console.log(`\n${c.bold('Suggested Configuration / Code Patch:')}`);
294
+ console.log(c.dim(diag.codePatchSuggestion));
161
295
  }
162
296
  break;
163
297
  }
164
298
 
165
299
  case 'fix': {
166
- console.log(`\n=== DEVINTELLIGENCE AUTO-REPAIR CENTER ===`);
167
- console.log(`Applying validated SAFE fixes on project '${projectArg}'...`);
300
+ console.log(`\n${c.bgGreen(' DEVINTELLIGENCE AUTO-REPAIR CENTER ')}`);
301
+ console.log(`Applying validated SAFE fixes on project '${c.bold(projectArg)}'...`);
168
302
  const res = applyAllSafeRepairsOnDisk(projectArg, rootWorkspaceDir);
169
- console.log(`\n[COMPLETED] Applied ${res.appliedRepairs.length} SAFE repair(s).`);
303
+ console.log(`\n${c.green(c.bold(`[COMPLETED] Applied ${res.appliedRepairs.length} SAFE repair(s).`))}`);
170
304
  res.appliedRepairs.forEach((r, idx) => {
171
- console.log(` ${idx + 1}. Fixed: ${r.issueTitle}`);
172
- console.log(` Target: ${r.filePath} (Backup saved in .devintelligence/backups/)`);
305
+ console.log(` ${idx + 1}. Fixed: ${c.bold(r.issueTitle)}`);
306
+ console.log(` Target: ${c.dim(r.filePath)} (Backup saved in .devintelligence/backups/)`);
173
307
  });
174
- console.log(`\nPost-Repair Re-Scan:`);
175
- console.log(` Overall Score: ${res.updatedReport.scores.overall}/100`);
308
+ console.log(`\n${c.bold('Post-Repair Re-Scan:')}`);
309
+ console.log(` Overall Score: ${formatScore(res.updatedReport.scores.overall)}`);
176
310
  console.log(` Remaining Issues: ${res.updatedReport.issues.length}`);
177
311
  break;
178
312
  }
179
313
 
180
314
  case 'dashboard':
181
315
  case 'ui': {
182
- console.log(`\n=== LAUNCHING DEVINTELLIGENCE WORKSTATION ===`);
183
- console.log(`Starting local server at http://localhost:3000 ...`);
316
+ console.log(`\n${c.bgCyan(' LAUNCHING DEVINTELLIGENCE WORKSTATION ')}`);
317
+ console.log(`Starting local server at ${c.bold('http://localhost:3000')} ...`);
184
318
  const serverScript = path.join(rootWorkspaceDir, 'server.ts');
185
- const child = spawn(process.execPath, ['--experimental-strip-types', '--no-warnings', serverScript], {
319
+ const child = spawn(process.execPath, [serverScript], {
186
320
  cwd: rootWorkspaceDir,
187
321
  stdio: 'inherit',
188
322
  });
@@ -194,10 +328,10 @@ async function runCli() {
194
328
 
195
329
  case 'advice': {
196
330
  const report = getProjectReportById(projectArg, false, rootWorkspaceDir);
197
- console.log(`\nGenerating AI Executive Advice for '${report.name}'...`);
331
+ console.log(`\nGenerating AI Executive Advice for '${c.bold(report.name)}'...`);
198
332
  const res = await generateProjectAiAdvice(report);
199
- console.log(`\n=== DEVINTELLIGENCE EXECUTIVE ADVICE ===`);
200
- console.log(res.aiPowered ? `[Powered by Groq AI - ${res.model || 'Qwen 27B'}]` : `[Local Rule Fallback]`);
333
+ console.log(`\n${c.bgBlue(' DEVINTELLIGENCE EXECUTIVE ADVICE ')}`);
334
+ console.log(res.aiPowered ? c.magenta(`[Powered by Groq AI - ${res.model || 'Qwen 27B'}]`) : c.blue(`[Local Rule Fallback]`));
201
335
  console.log(res.advice);
202
336
  break;
203
337
  }
@@ -205,18 +339,18 @@ async function runCli() {
205
339
  case 'ai': {
206
340
  const query = args.slice(1).join(' ');
207
341
  if (!query) {
208
- console.log('Usage: devintelligence ai "your question or build error here"');
342
+ console.log(`Usage: ${c.cyan('devintelligence ai "your question or build error here"')}`);
209
343
  break;
210
344
  }
211
- console.log(`\nAsking DEVINTELLIGENCE AI: "${query}"...`);
345
+ console.log(`\nAsking DEVINTELLIGENCE AI: "${c.bold(query)}"...`);
212
346
  const res = await askDevIntelligenceAi(query);
213
- console.log(`\n=== AI ASSISTANT ANSWER ===`);
347
+ console.log(`\n${c.bgMagenta(' AI ASSISTANT ANSWER ')}`);
214
348
  console.log(res.answer);
215
349
  break;
216
350
  }
217
351
 
218
352
  case 'test': {
219
- console.log('\n=== RUNNING DEVINTELLIGENCE SELF-TESTING SUITE ===');
353
+ console.log(`\n${c.bgCyan(' RUNNING DEVINTELLIGENCE SELF-TESTING SUITE ')}`);
220
354
  const child = spawn(process.execPath, ['--test', 'src/engine/analyzerEngine.test.ts', 'src/engine/aiEngine.test.ts'], {
221
355
  cwd: rootWorkspaceDir,
222
356
  stdio: 'inherit',
@@ -234,37 +368,44 @@ async function runCli() {
234
368
  }
235
369
 
236
370
  case 'mcp': {
237
- console.log(JSON.stringify({
238
- status: 'online',
239
- server: 'DEVINTELLIGENCE Local MCP Server',
240
- tools: MCP_TOOLS_CATALOG,
241
- }, null, 2));
371
+ console.log(
372
+ JSON.stringify(
373
+ {
374
+ status: 'online',
375
+ server: 'DEVINTELLIGENCE Local MCP Server',
376
+ tools: MCP_TOOLS_CATALOG,
377
+ },
378
+ null,
379
+ 2
380
+ )
381
+ );
242
382
  break;
243
383
  }
244
384
 
245
385
  default:
246
386
  console.log(`
247
- DEVINTELLIGENCE — Personal Software Engineering Intelligence System
248
- Understand. Diagnose. Repair. Optimize.
249
-
250
- Usage: devintelligence <command> [options]
251
-
252
- Commands:
253
- init Register and initialize current directory as a project
254
- doctor Audit host runtimes (Node, Expo, Android SDK, Gradle, CocoaPods, Xcode)
255
- scan [--project=<id>] Deep AST code audit, quality scores & Quality Gate check
256
- diagnose [error_log] AI-first error trace diagnosis with guaranteed rule fallback
257
- fix [--project=<id>] Apply all validated SAFE auto-repairs on disk with backup
258
- dashboard Launch desktop engineering workstation on http://localhost:3000
259
- advice [--project=<id>] Generate AI executive engineering brief & prioritized action plan
260
- ai "<question>" Ask AI assistant technical questions about code or native builds
261
- report [--project=<id>] Output full machine-readable JSON project report
262
- test Run multi-ecosystem verification test suite
263
- mcp Inspect available Model Context Protocol tools
264
-
265
- Options:
266
- --project=<id> Specify target project ID (default: rn-expo-commerce)
267
- --ci Return proper exit code based on Quality Gate (0 for pass, 1 for fail)
387
+ ${c.cyan(c.bold('DEVINTELLIGENCE'))} — Personal Software Engineering Intelligence System
388
+ ${c.dim('Understand. Diagnose. Repair. Optimize.')}
389
+
390
+ ${c.bold('Usage:')} ${c.cyan('devintelligence <command> [options]')}
391
+
392
+ ${c.bold('Commands:')}
393
+ ${c.cyan('init')} Register and initialize current directory as a project
394
+ ${c.cyan('doctor')} Audit host runtimes (Node, Expo, Android SDK, Gradle, CocoaPods, Xcode)
395
+ ${c.cyan('scan')} [path] Deep AST code audit, quality scores & Quality Gate check (default: current dir)
396
+ ${c.cyan('diagnose')} [log|file] AI-first error trace diagnosis with guaranteed rule fallback
397
+ ${c.cyan('fix')} [path] Apply all validated SAFE auto-repairs on disk with backup
398
+ ${c.cyan('dashboard')} Launch desktop engineering workstation on http://localhost:3000
399
+ ${c.cyan('advice')} [path] Generate AI executive engineering brief & prioritized action plan
400
+ ${c.cyan('ai')} "<question>" Ask AI assistant technical questions about code or native builds
401
+ ${c.cyan('report')} [path] Output full machine-readable JSON project report
402
+ ${c.cyan('test')} Run multi-ecosystem verification test suite
403
+ ${c.cyan('mcp')} Inspect available Model Context Protocol tools
404
+
405
+ ${c.bold('Options:')}
406
+ ${c.cyan('--project=<path|id>')} Specify target project directory or ID (default: current directory)
407
+ ${c.cyan('--file=<path>')} Specify file path to read error log from in diagnose
408
+ ${c.cyan('--ci')} Return proper exit code based on Quality Gate (0 for pass, 1 for fail)
268
409
  `);
269
410
  }
270
411
  }
package/dist/App.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ export declare function App(): React.JSX.Element;
3
+ export default App;