devintelligence 0.0.0-stage → 1.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 (45) hide show
  1. package/.env.example +14 -0
  2. package/LICENSE +22 -0
  3. package/README.md +145 -2
  4. package/bin/devintelligence.js +17 -0
  5. package/bin/devintelligence.ts +275 -0
  6. package/fixtures/django-analytics-service/requirements.txt +4 -0
  7. package/fixtures/django-analytics-service/settings.py +16 -0
  8. package/fixtures/express-api-gateway/package.json +14 -0
  9. package/fixtures/express-api-gateway/src/server.ts +16 -0
  10. package/fixtures/nextjs-saas-portal/package.json +21 -0
  11. package/fixtures/nextjs-saas-portal/src/app/dashboard/page.tsx +26 -0
  12. package/fixtures/rn-bare-fitness/android/build.gradle +19 -0
  13. package/fixtures/rn-bare-fitness/ios/Info.plist +14 -0
  14. package/fixtures/rn-bare-fitness/package.json +23 -0
  15. package/fixtures/rn-bare-fitness/src/WorkoutTracker.tsx +31 -0
  16. package/fixtures/rn-expo-commerce/android/app/build.gradle +20 -0
  17. package/fixtures/rn-expo-commerce/android/app/src/main/AndroidManifest.xml +21 -0
  18. package/fixtures/rn-expo-commerce/android/gradle.properties +6 -0
  19. package/fixtures/rn-expo-commerce/app.json +17 -0
  20. package/fixtures/rn-expo-commerce/babel.config.js +10 -0
  21. package/fixtures/rn-expo-commerce/ios/Podfile +13 -0
  22. package/fixtures/rn-expo-commerce/metro.config.js +7 -0
  23. package/fixtures/rn-expo-commerce/package.json +31 -0
  24. package/fixtures/rn-expo-commerce/src/components/LegacyPromoBanner.tsx +11 -0
  25. package/fixtures/rn-expo-commerce/src/screens/ProductFeedScreen.tsx +48 -0
  26. package/fixtures/rn-expo-commerce/src/services/api.ts +15 -0
  27. package/index.html +21 -0
  28. package/package.json +75 -4
  29. package/server.ts +275 -0
  30. package/src/App.tsx +783 -0
  31. package/src/components/DeepAnalysisViews.tsx +526 -0
  32. package/src/components/MobileAndPlatformViews.tsx +625 -0
  33. package/src/components/OverviewAndExplorerViews.tsx +753 -0
  34. package/src/components/RepairAndGateViews.tsx +814 -0
  35. package/src/engine/aiEngine.test.ts +86 -0
  36. package/src/engine/aiEngine.ts +346 -0
  37. package/src/engine/analyzerEngine.test.ts +110 -0
  38. package/src/engine/analyzerEngine.ts +1579 -0
  39. package/src/engine/repairEngine.ts +545 -0
  40. package/src/index.css +44 -0
  41. package/src/index.ts +59 -0
  42. package/src/main.tsx +5 -0
  43. package/src/types/devintelligence.ts +310 -0
  44. package/tsconfig.json +28 -0
  45. package/vite.config.ts +22 -0
package/.env.example ADDED
@@ -0,0 +1,14 @@
1
+ # DEVINTELLIGENCE — Personal Software Engineering Intelligence System
2
+ # Understand. Diagnose. Repair. Optimize.
3
+
4
+ # Groq AI API Key (Optional for AI Error Diagnostics & Intelligent Fixes)
5
+ # Note: DEVINTELLIGENCE works 100% offline with zero external API keys required!
6
+ GROQ_API_KEY="your_groq_api_key_here"
7
+ GROQ_MODEL="qwen/qwen3.8-27b"
8
+
9
+ # Optional Gemini API Key
10
+ GEMINI_API_KEY="MY_GEMINI_API_KEY"
11
+
12
+ # Local Workstation Configuration
13
+ PORT=3000
14
+ HOST="0.0.0.0"
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 DevIntelligence & NetControl Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
package/README.md CHANGED
@@ -1,3 +1,146 @@
1
- # Temporary Holding Version
1
+ # DEVINTELLIGENCE
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ > **Personal Software Engineering Intelligence System**
4
+ > *Understand. Diagnose. Repair. Optimize.*
5
+
6
+ DEVINTELLIGENCE is an advanced, locally operating developer intelligence platform and installable library built for daily multi-ecosystem engineering workflows.
7
+
8
+ It deeply understands your project structure, inspects native mobile configurations (React Native, Expo, Bare RN, Android, iOS), analyzes full-stack web and backend architectures (Next.js, Vite, Node.js, Express, Python, Django), detects architectural, security, and performance bottlenecks, and safely executes verified auto-repairs on disk with automatic rollback snapshots.
9
+
10
+ ---
11
+
12
+ ## ⚡ Core Philosophy
13
+
14
+ - **Zero Cloud Dependence**: Operates 100% locally on your machine.
15
+ - **Engineered Correctness**: Deep AST and configuration analysis instead of surface-level linting.
16
+ - **Resilient AI Shield**: Integrated with ultra-fast Groq AI (Qwen 27B / Llama 3) for sub-second crash diagnosis. If API limits are reached (HTTP 429) or offline, it **never crashes** — seamlessly degrading to built-in heuristic rule engines with zero downtime.
17
+ - **Safe Auto-Remediation**: Categorizes all fixes into `SAFE` (zero regression risk with timestamped backups), `REVIEW REQUIRED`, and `RISKY`.
18
+
19
+ ---
20
+
21
+ ## 📦 Installation & Library Usage
22
+
23
+ Install anywhere in your projects:
24
+
25
+ ```bash
26
+ # Global CLI Installation
27
+ npm install -g devintelligence
28
+
29
+ # Or install as a development dependency / library in any project
30
+ npm install devintelligence --save-dev
31
+ ```
32
+
33
+ ### Programmatic Library API
34
+
35
+ Import DEVINTELLIGENCE directly into your Node.js, TypeScript, or custom developer automation scripts:
36
+
37
+ ```typescript
38
+ import {
39
+ inspectHostEnvironment,
40
+ analyzeProjectDirectory,
41
+ diagnoseRawErrorLogWithAi,
42
+ applyAllSafeRepairsOnDisk,
43
+ getProjectReportById,
44
+ } from 'devintelligence';
45
+
46
+ // 1. Audit developer environment runtimes
47
+ const envReport = inspectHostEnvironment();
48
+ console.log(envReport);
49
+
50
+ // 2. Perform deep AST & architecture scan on any repository
51
+ const report = analyzeProjectDirectory('/path/to/my-react-native-app');
52
+ console.log(`Overall Health: ${report.scores.overall}/100`);
53
+
54
+ // 3. AI-Powered crash trace diagnosis with guaranteed rule fallback
55
+ const diagnosis = await diagnoseRawErrorLogWithAi(metroErrorStack);
56
+ console.log(diagnosis.summary, diagnosis.rootCause, diagnosis.safeRepairSteps);
57
+
58
+ // 4. Automatically apply all safe auto-repairs with rollback protection
59
+ const repairResult = applyAllSafeRepairsOnDisk('my-project-id');
60
+ console.log(`Applied ${repairResult.appliedRepairs.length} safe patches.`);
61
+ ```
62
+
63
+ ---
64
+
65
+ ## 🚀 CLI Commands
66
+
67
+ Run directly without installing via `npx`:
68
+
69
+ ```bash
70
+ # Initialize DEVINTELLIGENCE in current directory
71
+ npx devintelligence init
72
+
73
+ # Audit host environment (Node, Expo, Android SDK, Gradle, CocoaPods, Xcode)
74
+ npx devintelligence doctor
75
+
76
+ # Deep AST scan on current project or registered fixture
77
+ npx devintelligence scan [--project=<id>] [--ci]
78
+
79
+ # Diagnose any build or runtime crash trace with AI + Rule Fallback
80
+ npx devintelligence diagnose "<error_trace>"
81
+
82
+ # Apply all validated SAFE auto-repairs on disk with backup
83
+ npx devintelligence fix [--project=<id>]
84
+
85
+ # Generate AI executive engineering advice & prioritized action plan
86
+ npx devintelligence advice [--project=<id>]
87
+
88
+ # Ask the interactive AI technical assistant directly
89
+ npx devintelligence ai "How do I optimize FlatList windowing in React Native?"
90
+
91
+ # Run self-testing verification suite across 5 multi-ecosystem fixtures
92
+ npx devintelligence test
93
+
94
+ # Launch desktop engineering workstation on http://localhost:3000
95
+ npx devintelligence dashboard
96
+ ```
97
+
98
+ ---
99
+
100
+ ## 📱 React Native & Native Intelligence
101
+
102
+ Dedicated, deeply implemented intelligence for Expo Managed, Expo Prebuild (CNG), and Bare React Native CLI:
103
+
104
+ 1. **Initial Project Doctor**: Inspects Node, npm, yarn, pnpm, Bun, Expo SDK, Android SDK, platform-tools, build-tools, JDK, Gradle, AGP, Kotlin, Xcode (macOS), iOS deployment targets, CocoaPods, Metro, Babel, and TypeScript.
105
+ 2. **Error Intelligence**: Traces root causes for Metro bundler crashes, Reanimated Babel plugin ordering, Android Gradle merger failures, missing permissions, Hermes runtime exceptions, CocoaPods linkage issues, and Red Screen traces.
106
+ 3. **Component Intelligence**: Detects unnecessary re-renders, missing list keys, FlatList performance anti-patterns, hook memory leaks (e.g. uncleaned `AppState` listeners), and accessibility gaps.
107
+ 4. **Android Intelligence**: Full inspection of `AndroidManifest.xml`, `build.gradle`, `settings.gradle`, `gradle.properties`, target SDK, and cleartext HTTP policies.
108
+ 5. **iOS Intelligence**: Deep audit of `Podfile`, deployment targets, privacy usage keys in `Info.plist`, and native framework linking.
109
+
110
+ ---
111
+
112
+ ## 🖥️ 18-Module Developer Workstation
113
+
114
+ To launch the desktop-first developer interface locally:
115
+
116
+ ```bash
117
+ npm run dev
118
+ # or
119
+ npx devintelligence dashboard
120
+ ```
121
+
122
+ Open `http://localhost:3000` to access all 18 dedicated modules:
123
+ - **Core**: Command Center, Project Explorer, Project Health.
124
+ - **Mobile & Native**: React Native Doctor, Android Diagnostics, iOS Diagnostics, Error Diagnostics.
125
+ - **Deep Analysis**: Code Intelligence, Design Intelligence, Performance Lab, Security Audit, Dependency Intelligence.
126
+ - **Repair & Delivery**: Auto Repair Center, Visual Testing, Quality Gate, Project History, Environment Manager, Settings & MCP.
127
+
128
+ ---
129
+
130
+ ## 🛠️ Model Context Protocol (MCP) Tools
131
+
132
+ DEVINTELLIGENCE exposes local MCP tools compatible with Claude Desktop, Cursor, Antigravity, and Gemini:
133
+
134
+ - `inspect_project`
135
+ - `diagnose_error`
136
+ - `analyze_react_native`
137
+ - `inspect_android_environment`
138
+ - `find_unused_files`
139
+ - `apply_safe_fix`
140
+ - `verify_repair`
141
+
142
+ ---
143
+
144
+ ## 📄 License
145
+
146
+ MIT © 2026 DEVINTELLIGENCE Engineering Team
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env node
2
+ import { spawn } from 'node:child_process';
3
+ import path from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
5
+
6
+ const __filename = fileURLToPath(import.meta.url);
7
+ const __dirname = path.dirname(__filename);
8
+ const targetScript = path.join(__dirname, 'devintelligence.ts');
9
+
10
+ const nodeVersionMajor = parseInt(process.versions.node.split('.')[0], 10);
11
+ const nodeArgs = nodeVersionMajor >= 22
12
+ ? ['--experimental-strip-types', '--no-warnings', targetScript, ...process.argv.slice(2)]
13
+ : [targetScript, ...process.argv.slice(2)];
14
+
15
+ const child = spawn(process.execPath, nodeArgs, { stdio: 'inherit' });
16
+ child.on('exit', (code) => process.exit(code ?? 0));
17
+
@@ -0,0 +1,275 @@
1
+ #!/usr/bin/env node
2
+ import fs from 'node:fs';
3
+ import path from 'node:path';
4
+ import { spawn } from 'node:child_process';
5
+ import { fileURLToPath } from 'node:url';
6
+ import {
7
+ getAllProjectReports,
8
+ getProjectReportById,
9
+ registerLocalProject,
10
+ applyAllSafeRepairsOnDisk,
11
+ MCP_TOOLS_CATALOG,
12
+ executeMcpToolCall,
13
+ } from '../src/engine/repairEngine.ts';
14
+ import {
15
+ inspectHostEnvironment,
16
+ PRESET_ERROR_LOGS,
17
+ } from '../src/engine/analyzerEngine.ts';
18
+ import {
19
+ diagnoseRawErrorLogWithAi,
20
+ generateProjectAiAdvice,
21
+ askDevIntelligenceAi,
22
+ } from '../src/engine/aiEngine.ts';
23
+
24
+ try {
25
+ if (typeof process.loadEnvFile === 'function') {
26
+ process.loadEnvFile();
27
+ }
28
+ } catch {}
29
+
30
+ const __filename = fileURLToPath(import.meta.url);
31
+ const __dirname = path.dirname(__filename);
32
+ const rootWorkspaceDir = path.resolve(__dirname, '..');
33
+
34
+ const args = process.argv.slice(2);
35
+ const command = args[0] || 'help';
36
+ const projectArg = args.find((a) => a.startsWith('--project='))?.split('=')[1] || 'rn-expo-commerce';
37
+ const isCi = args.includes('--ci');
38
+
39
+ async function runCli() {
40
+ switch (command) {
41
+ case 'init': {
42
+ const cwd = process.cwd();
43
+ const projectName = path.basename(cwd);
44
+ console.log(`\n=== DEVINTELLIGENCE INITIALIZATION ===`);
45
+ console.log(`Initializing workspace in: ${cwd}`);
46
+
47
+ const report = registerLocalProject({
48
+ name: projectName,
49
+ rootPath: cwd,
50
+ baseWorkspaceDir: rootWorkspaceDir,
51
+ });
52
+
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.`);
61
+ break;
62
+ }
63
+
64
+ case 'doctor': {
65
+ console.log('\n=== DEVINTELLIGENCE ENVIRONMENT DOCTOR ===');
66
+ console.log('Inspecting Node, Package Managers, React Native, Android & iOS Native Runtimes...\n');
67
+ 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}`);
78
+ }
79
+ }
80
+ break;
81
+ }
82
+
83
+ case 'scan': {
84
+ 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`);
95
+
96
+ const safeIssues = report.issues.filter((i) => i.repairTier === 'SAFE');
97
+ const reviewIssues = report.issues.filter((i) => i.repairTier === 'REVIEW_REQUIRED');
98
+ const criticalIssues = report.issues.filter((i) => i.severity === 'critical');
99
+
100
+ console.log(`\nIssues Summary: ${report.issues.length} detected`);
101
+ console.log(` - Critical: ${criticalIssues.length}`);
102
+ console.log(` - SAFE Auto-Fix: ${safeIssues.length}`);
103
+ console.log(` - Review Required: ${reviewIssues.length}`);
104
+
105
+ if (report.issues.length > 0) {
106
+ console.log(`\nTop Findings:`);
107
+ 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})`);
110
+ });
111
+ }
112
+
113
+ console.log(`\nQuality Gate: ${report.qualityGateEvaluation.passed ? 'PASSED ✅' : 'FAILED ❌'}`);
114
+ if (!report.qualityGateEvaluation.passed) {
115
+ 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('; ')}`);
119
+ }
120
+
121
+ if (isCi) {
122
+ process.exit(report.qualityGateEvaluation.exitCode);
123
+ }
124
+ break;
125
+ }
126
+
127
+ 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');
131
+ const diag = await diagnoseRawErrorLogWithAi(customLog);
132
+
133
+ if (diag.aiPowered) {
134
+ console.log(`[AI-Powered: Groq ${diag.aiModel || 'Qwen 27B'}] Confidence: ${diag.confidence}%`);
135
+ } else {
136
+ console.log(`[Local Rule Engine - Zero Downtime Fallback] Confidence: ${diag.confidence}%`);
137
+ if (diag.fallbackReason) {
138
+ console.log(`Note: ${diag.fallbackReason}`);
139
+ }
140
+ }
141
+
142
+ console.log(`Category: ${diag.category}`);
143
+ console.log(`Severity: ${diag.severity.toUpperCase()}`);
144
+ console.log(`Summary: ${diag.summary}`);
145
+ console.log(`Root Cause: ${diag.rootCause}`);
146
+ console.log(`Responsible: ${diag.responsibleFile}${diag.line ? `:${diag.line}` : ''}`);
147
+
148
+ if (diag.safeRepairSteps?.length) {
149
+ console.log('\nRecommended Safe Repair Steps:');
150
+ diag.safeRepairSteps.forEach((s, idx) => console.log(` ${idx + 1}. ${s}`));
151
+ }
152
+
153
+ if (diag.terminalCommands?.length) {
154
+ console.log('\nExact Terminal Commands:');
155
+ diag.terminalCommands.forEach((cmd) => console.log(` $ ${cmd}`));
156
+ }
157
+
158
+ if (diag.codePatchSuggestion) {
159
+ console.log('\nSuggested Configuration / Code Patch:');
160
+ console.log(diag.codePatchSuggestion);
161
+ }
162
+ break;
163
+ }
164
+
165
+ case 'fix': {
166
+ console.log(`\n=== DEVINTELLIGENCE AUTO-REPAIR CENTER ===`);
167
+ console.log(`Applying validated SAFE fixes on project '${projectArg}'...`);
168
+ const res = applyAllSafeRepairsOnDisk(projectArg, rootWorkspaceDir);
169
+ console.log(`\n[COMPLETED] Applied ${res.appliedRepairs.length} SAFE repair(s).`);
170
+ res.appliedRepairs.forEach((r, idx) => {
171
+ console.log(` ${idx + 1}. Fixed: ${r.issueTitle}`);
172
+ console.log(` Target: ${r.filePath} (Backup saved in .devintelligence/backups/)`);
173
+ });
174
+ console.log(`\nPost-Repair Re-Scan:`);
175
+ console.log(` Overall Score: ${res.updatedReport.scores.overall}/100`);
176
+ console.log(` Remaining Issues: ${res.updatedReport.issues.length}`);
177
+ break;
178
+ }
179
+
180
+ case 'dashboard':
181
+ case 'ui': {
182
+ console.log(`\n=== LAUNCHING DEVINTELLIGENCE WORKSTATION ===`);
183
+ console.log(`Starting local server at http://localhost:3000 ...`);
184
+ const serverScript = path.join(rootWorkspaceDir, 'server.ts');
185
+ const child = spawn(process.execPath, ['--experimental-strip-types', '--no-warnings', serverScript], {
186
+ cwd: rootWorkspaceDir,
187
+ stdio: 'inherit',
188
+ });
189
+ child.on('error', (err) => {
190
+ console.error('Failed to start workstation server:', err);
191
+ });
192
+ break;
193
+ }
194
+
195
+ case 'advice': {
196
+ const report = getProjectReportById(projectArg, false, rootWorkspaceDir);
197
+ console.log(`\nGenerating AI Executive Advice for '${report.name}'...`);
198
+ 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]`);
201
+ console.log(res.advice);
202
+ break;
203
+ }
204
+
205
+ case 'ai': {
206
+ const query = args.slice(1).join(' ');
207
+ if (!query) {
208
+ console.log('Usage: devintelligence ai "your question or build error here"');
209
+ break;
210
+ }
211
+ console.log(`\nAsking DEVINTELLIGENCE AI: "${query}"...`);
212
+ const res = await askDevIntelligenceAi(query);
213
+ console.log(`\n=== AI ASSISTANT ANSWER ===`);
214
+ console.log(res.answer);
215
+ break;
216
+ }
217
+
218
+ case 'test': {
219
+ console.log('\n=== RUNNING DEVINTELLIGENCE SELF-TESTING SUITE ===');
220
+ const child = spawn(process.execPath, ['--test', 'src/engine/analyzerEngine.test.ts', 'src/engine/aiEngine.test.ts'], {
221
+ cwd: rootWorkspaceDir,
222
+ stdio: 'inherit',
223
+ });
224
+ child.on('exit', (code) => {
225
+ process.exit(code ?? 0);
226
+ });
227
+ break;
228
+ }
229
+
230
+ case 'report': {
231
+ const report = getProjectReportById(projectArg, false, rootWorkspaceDir);
232
+ console.log(JSON.stringify(report, null, 2));
233
+ break;
234
+ }
235
+
236
+ case 'mcp': {
237
+ console.log(JSON.stringify({
238
+ status: 'online',
239
+ server: 'DEVINTELLIGENCE Local MCP Server',
240
+ tools: MCP_TOOLS_CATALOG,
241
+ }, null, 2));
242
+ break;
243
+ }
244
+
245
+ default:
246
+ 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)
268
+ `);
269
+ }
270
+ }
271
+
272
+ runCli().catch((err) => {
273
+ console.error('Fatal CLI Error:', err);
274
+ process.exit(1);
275
+ });
@@ -0,0 +1,4 @@
1
+ Django==5.0.6
2
+ djangorestframework==3.15.1
3
+ psycopg2-binary==2.9.9
4
+ celery==5.4.0
@@ -0,0 +1,16 @@
1
+ import os
2
+
3
+ SECRET_KEY = "django-insecure-hardcoded-production-key-9918273645"
4
+ DEBUG = True
5
+ ALLOWED_HOSTS = ["*"]
6
+
7
+ DATABASES = {
8
+ "default": {
9
+ "ENGINE": "django.db.backends.postgresql",
10
+ "NAME": "analytics_prod",
11
+ "USER": "postgres",
12
+ "PASSWORD": "prod_db_password_plain_text_2026",
13
+ "HOST": "10.0.14.22",
14
+ "PORT": "5432",
15
+ }
16
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "express-api-gateway",
3
+ "version": "1.1.0",
4
+ "private": true,
5
+ "scripts": {
6
+ "dev": "tsx src/server.ts",
7
+ "start": "node dist/server.js"
8
+ },
9
+ "dependencies": {
10
+ "express": "^4.19.2",
11
+ "pg": "^8.11.5",
12
+ "jsonwebtoken": "^9.0.2"
13
+ }
14
+ }
@@ -0,0 +1,16 @@
1
+ import express from 'express';
2
+ import fs from 'node:fs';
3
+
4
+ const app = express();
5
+ const JWT_SECRET = "super_secret_hardcoded_jwt_signing_key_2026";
6
+
7
+ app.get('/api/users/search', async (req, res) => {
8
+ const emailQuery = req.query.email as string;
9
+ // Blocking synchronous file read inside request loop
10
+ const auditConfig = fs.readFileSync('./config.json', 'utf8');
11
+ // SQL Injection vulnerability via raw string interpolation
12
+ const rawSql = `SELECT * FROM users WHERE email = '${emailQuery}'`;
13
+ res.json({ query: rawSql, configLength: auditConfig.length, signedBy: JWT_SECRET.slice(0, 4) });
14
+ });
15
+
16
+ app.listen(4000);
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "nextjs-saas-portal",
3
+ "version": "0.9.2",
4
+ "private": true,
5
+ "scripts": {
6
+ "dev": "next dev",
7
+ "build": "next build",
8
+ "start": "next start",
9
+ "lint": "next lint"
10
+ },
11
+ "dependencies": {
12
+ "next": "14.2.5",
13
+ "react": "^18.3.1",
14
+ "react-dom": "^18.3.1",
15
+ "moment": "^2.30.1",
16
+ "lodash": "^4.17.21"
17
+ },
18
+ "devDependencies": {
19
+ "typescript": "^5.4.5"
20
+ }
21
+ }
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import _ from 'lodash';
3
+ import moment from 'moment';
4
+
5
+ const HARDCODED_WEBHOOK_TOKEN = "whsec_live_98a7bc654321devintelligence";
6
+
7
+ export default function DashboardPage() {
8
+ const items = _.chunk([1, 2, 3, 4, 5, 6], 2);
9
+
10
+ async function syncWebhook() {
11
+ const res = await fetch('http://internal.billing.local/sync', {
12
+ headers: { 'X-Token': HARDCODED_WEBHOOK_TOKEN }
13
+ });
14
+ return res.json();
15
+ }
16
+
17
+ return (
18
+ <main style={{ backgroundColor: '#111827', padding: '23px', borderRadius: '19px' }}>
19
+ <h1 style={{ color: '#F9FAFB', fontSize: '27px' }}>🚀 Billing Portal ({moment().format('YYYY-MM-DD')})</h1>
20
+ <img src="/hero-unoptimized-banner.bmp" width={1200} height={600} />
21
+ <button onClick={syncWebhook} style={{ backgroundColor: '#7C3AED', padding: '13px' }}>
22
+ ✨ Sync Billing Now
23
+ </button>
24
+ </main>
25
+ );
26
+ }
@@ -0,0 +1,19 @@
1
+ buildscript {
2
+ ext {
3
+ buildToolsVersion = "34.0.0"
4
+ minSdkVersion = 23
5
+ compileSdkVersion = 34
6
+ targetSdkVersion = 33
7
+ ndkVersion = "25.1.8937393"
8
+ kotlinVersion = "1.8.10"
9
+ }
10
+ repositories {
11
+ google()
12
+ mavenCentral()
13
+ }
14
+ dependencies {
15
+ classpath("com.android.tools.build:gradle:8.1.1")
16
+ classpath("com.facebook.react:react-native-gradle-plugin")
17
+ classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
18
+ }
19
+ }
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>CFBundleDisplayName</key>
6
+ <string>BareFitnessPro</string>
7
+ <key>CFBundleIdentifier</key>
8
+ <string>com.devintel.barefitness</string>
9
+ <key>CFBundleVersion</key>
10
+ <string>21</string>
11
+ <key>UILaunchStoryboardName</key>
12
+ <string>LaunchScreen</string>
13
+ </dict>
14
+ </plist>
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "rn-bare-fitness",
3
+ "version": "2.1.0",
4
+ "private": true,
5
+ "scripts": {
6
+ "android": "react-native run-android",
7
+ "ios": "react-native run-ios",
8
+ "start": "react-native start",
9
+ "test": "jest"
10
+ },
11
+ "dependencies": {
12
+ "react": "18.2.0",
13
+ "react-native": "0.74.5",
14
+ "react-native-reanimated": "3.10.1",
15
+ "react-native-vision-camera": "^4.0.0",
16
+ "@react-navigation/native": "^6.1.18"
17
+ },
18
+ "devDependencies": {
19
+ "@react-native/babel-preset": "0.74.85",
20
+ "@react-native/metro-config": "0.74.85",
21
+ "typescript": "5.0.4"
22
+ }
23
+ }
@@ -0,0 +1,31 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import { View, Text, FlatList, Pressable } from 'react-native';
3
+
4
+ export function WorkoutTracker() {
5
+ const [heartRate, setHeartRate] = useState(72);
6
+
7
+ useEffect(() => {
8
+ setInterval(() => {
9
+ setHeartRate((h) => h + 1);
10
+ }, 1000);
11
+ }, []);
12
+
13
+ const sessions = [
14
+ { id: '1', name: 'VO2 Max Interval', kcal: 640 },
15
+ { id: '2', name: 'Threshold Tempo', kcal: 510 },
16
+ ];
17
+
18
+ return (
19
+ <View style={{ flex: 1, backgroundColor: '#0D0D12', padding: 19 }}>
20
+ <Text style={{ color: '#00FF66', fontSize: 23 }}>⚡ Live HR: {heartRate} BPM</Text>
21
+ <FlatList
22
+ data={sessions}
23
+ renderItem={({ item }) => (
24
+ <Pressable style={{ padding: 13, borderRadius: 15, backgroundColor: '#1B1B22' }}>
25
+ <Text style={{ color: '#FFFFFF' }}>{item.name}</Text>
26
+ </Pressable>
27
+ )}
28
+ />
29
+ </View>
30
+ );
31
+ }