@mrpatronz/nexusflow 0.2.19 → 1.3.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 (294) hide show
  1. package/README.md +37 -7
  2. package/dist/analyzers/index.d.ts +23 -0
  3. package/dist/analyzers/index.d.ts.map +1 -1
  4. package/dist/analyzers/index.js +62 -0
  5. package/dist/analyzers/index.js.map +1 -1
  6. package/dist/commands/add-repo.d.ts +9 -0
  7. package/dist/commands/add-repo.d.ts.map +1 -1
  8. package/dist/commands/add-repo.js +12 -1
  9. package/dist/commands/add-repo.js.map +1 -1
  10. package/dist/commands/add-repo.test.d.ts +2 -0
  11. package/dist/commands/add-repo.test.d.ts.map +1 -0
  12. package/dist/commands/add-repo.test.js +30 -0
  13. package/dist/commands/add-repo.test.js.map +1 -0
  14. package/dist/commands/commands.test.js +26 -6
  15. package/dist/commands/commands.test.js.map +1 -1
  16. package/dist/commands/commit.d.ts +7 -1
  17. package/dist/commands/commit.d.ts.map +1 -1
  18. package/dist/commands/commit.js +31 -8
  19. package/dist/commands/commit.js.map +1 -1
  20. package/dist/commands/commit.test.d.ts +2 -0
  21. package/dist/commands/commit.test.d.ts.map +1 -0
  22. package/dist/commands/commit.test.js +54 -0
  23. package/dist/commands/commit.test.js.map +1 -0
  24. package/dist/commands/diff.d.ts +9 -2
  25. package/dist/commands/diff.d.ts.map +1 -1
  26. package/dist/commands/diff.js +36 -12
  27. package/dist/commands/diff.js.map +1 -1
  28. package/dist/commands/doctor.d.ts.map +1 -1
  29. package/dist/commands/doctor.js +16 -20
  30. package/dist/commands/doctor.js.map +1 -1
  31. package/dist/commands/handoff.d.ts.map +1 -1
  32. package/dist/commands/handoff.js +11 -15
  33. package/dist/commands/handoff.js.map +1 -1
  34. package/dist/commands/refresh.d.ts +4 -2
  35. package/dist/commands/refresh.d.ts.map +1 -1
  36. package/dist/commands/refresh.js +20 -36
  37. package/dist/commands/refresh.js.map +1 -1
  38. package/dist/commands/schedule.d.ts +35 -0
  39. package/dist/commands/schedule.d.ts.map +1 -0
  40. package/dist/commands/schedule.js +151 -0
  41. package/dist/commands/schedule.js.map +1 -0
  42. package/dist/commands/sync.d.ts.map +1 -1
  43. package/dist/commands/sync.js +28 -7
  44. package/dist/commands/sync.js.map +1 -1
  45. package/dist/commands/tui.js +1 -1
  46. package/dist/commands/tui.js.map +1 -1
  47. package/dist/commands/ui.d.ts +1 -0
  48. package/dist/commands/ui.d.ts.map +1 -1
  49. package/dist/commands/ui.js +5 -2
  50. package/dist/commands/ui.js.map +1 -1
  51. package/dist/core/adapters/local-storage.d.ts +7 -0
  52. package/dist/core/adapters/local-storage.d.ts.map +1 -1
  53. package/dist/core/adapters/local-storage.js +13 -4
  54. package/dist/core/adapters/local-storage.js.map +1 -1
  55. package/dist/core/adapters/storage.test.js +18 -0
  56. package/dist/core/adapters/storage.test.js.map +1 -1
  57. package/dist/core/analysis-cache.d.ts +58 -0
  58. package/dist/core/analysis-cache.d.ts.map +1 -0
  59. package/dist/core/analysis-cache.js +116 -0
  60. package/dist/core/analysis-cache.js.map +1 -0
  61. package/dist/core/analysis-cache.test.d.ts +2 -0
  62. package/dist/core/analysis-cache.test.d.ts.map +1 -0
  63. package/dist/core/analysis-cache.test.js +108 -0
  64. package/dist/core/analysis-cache.test.js.map +1 -0
  65. package/dist/core/refresh.d.ts +41 -0
  66. package/dist/core/refresh.d.ts.map +1 -0
  67. package/dist/core/refresh.js +56 -0
  68. package/dist/core/refresh.js.map +1 -0
  69. package/dist/core/scheduler.d.ts +117 -0
  70. package/dist/core/scheduler.d.ts.map +1 -0
  71. package/dist/core/scheduler.js +361 -0
  72. package/dist/core/scheduler.js.map +1 -0
  73. package/dist/core/scheduler.test.d.ts +2 -0
  74. package/dist/core/scheduler.test.d.ts.map +1 -0
  75. package/dist/core/scheduler.test.js +163 -0
  76. package/dist/core/scheduler.test.js.map +1 -0
  77. package/dist/core/sync.d.ts +6 -0
  78. package/dist/core/sync.d.ts.map +1 -1
  79. package/dist/core/sync.js +17 -12
  80. package/dist/core/sync.js.map +1 -1
  81. package/dist/core/workspace.d.ts +6 -0
  82. package/dist/core/workspace.d.ts.map +1 -1
  83. package/dist/core/workspace.js +32 -15
  84. package/dist/core/workspace.js.map +1 -1
  85. package/dist/core/workspace.test.d.ts +2 -0
  86. package/dist/core/workspace.test.d.ts.map +1 -0
  87. package/dist/core/workspace.test.js +42 -0
  88. package/dist/core/workspace.test.js.map +1 -0
  89. package/dist/generators/index.d.ts +7 -1
  90. package/dist/generators/index.d.ts.map +1 -1
  91. package/dist/generators/index.js +14 -1
  92. package/dist/generators/index.js.map +1 -1
  93. package/dist/generators/map-generator.d.ts.map +1 -1
  94. package/dist/generators/map-generator.js +4 -3
  95. package/dist/generators/map-generator.js.map +1 -1
  96. package/dist/generators/map-generator.test.js +4 -2
  97. package/dist/generators/map-generator.test.js.map +1 -1
  98. package/dist/gui/assets/index-ElroPpSP.js +26 -0
  99. package/dist/gui/index.html +1 -1
  100. package/dist/index.js +108 -4
  101. package/dist/index.js.map +1 -1
  102. package/dist/orchestration/index.d.ts +1 -1
  103. package/dist/orchestration/index.d.ts.map +1 -1
  104. package/dist/orchestration/index.js +1 -1
  105. package/dist/orchestration/index.js.map +1 -1
  106. package/dist/orchestration/runner.d.ts +16 -1
  107. package/dist/orchestration/runner.d.ts.map +1 -1
  108. package/dist/orchestration/runner.js +41 -5
  109. package/dist/orchestration/runner.js.map +1 -1
  110. package/dist/orchestration/runner.test.d.ts +2 -0
  111. package/dist/orchestration/runner.test.d.ts.map +1 -0
  112. package/dist/orchestration/runner.test.js +71 -0
  113. package/dist/orchestration/runner.test.js.map +1 -0
  114. package/dist/server.d.ts +17 -1
  115. package/dist/server.d.ts.map +1 -1
  116. package/dist/server.js +275 -114
  117. package/dist/server.js.map +1 -1
  118. package/dist/server.test.js +158 -1
  119. package/dist/server.test.js.map +1 -1
  120. package/dist/utils/multi-git.d.ts +21 -0
  121. package/dist/utils/multi-git.d.ts.map +1 -1
  122. package/dist/utils/multi-git.js +40 -4
  123. package/dist/utils/multi-git.js.map +1 -1
  124. package/dist/utils/prompts.d.ts.map +1 -1
  125. package/dist/utils/prompts.js +8 -2
  126. package/dist/utils/prompts.js.map +1 -1
  127. package/package.json +13 -1
  128. package/.agents/skills/ccc/SKILL.md +0 -71
  129. package/.agents/skills/ccc/references/management.md +0 -110
  130. package/.agents/skills/ccc/references/settings.md +0 -126
  131. package/.github/dependabot.yml +0 -52
  132. package/.github/workflows/ci.yml +0 -44
  133. package/.github/workflows/dependabot-merge.yml +0 -53
  134. package/.github/workflows/release-desktop.yml +0 -67
  135. package/.github/workflows/release-npm.yml +0 -65
  136. package/.github/workflows/release-vscode.yml +0 -61
  137. package/.vscode/launch.json +0 -17
  138. package/.vscode/tasks.json +0 -17
  139. package/GETTING_STARTED.md +0 -114
  140. package/desktop/build-installer.js +0 -228
  141. package/desktop/build.js +0 -118
  142. package/desktop/installer/nexusflow.iss +0 -35
  143. package/desktop/neutralino.config.json +0 -39
  144. package/desktop/package-lock.json +0 -1060
  145. package/desktop/package.json +0 -14
  146. package/dist/gui/assets/index-D8iJPvnk.js +0 -26
  147. package/extension/media/icon.svg +0 -1
  148. package/extension/package-lock.json +0 -6044
  149. package/extension/package.json +0 -117
  150. package/extension/src/extension.ts +0 -653
  151. package/extension/tsconfig.json +0 -21
  152. package/gui/README.md +0 -73
  153. package/gui/e2e/dashboard.spec.ts +0 -61
  154. package/gui/e2e/wizard.spec.ts +0 -346
  155. package/gui/eslint.config.js +0 -26
  156. package/gui/index.html +0 -17
  157. package/gui/package-lock.json +0 -3137
  158. package/gui/package.json +0 -37
  159. package/gui/playwright.config.ts +0 -41
  160. package/gui/public/app_logo.png +0 -0
  161. package/gui/public/favicon.svg +0 -1
  162. package/gui/public/icons.svg +0 -24
  163. package/gui/src/App.css +0 -1
  164. package/gui/src/App.tsx +0 -3573
  165. package/gui/src/app/AppSidebar.tsx +0 -69
  166. package/gui/src/assets/hero.png +0 -0
  167. package/gui/src/assets/react.svg +0 -1
  168. package/gui/src/assets/vite.svg +0 -1
  169. package/gui/src/components/AddRepoPicker.tsx +0 -81
  170. package/gui/src/components/ui/Button.tsx +0 -40
  171. package/gui/src/components/ui/Card.tsx +0 -6
  172. package/gui/src/components/ui/EmptyState.tsx +0 -22
  173. package/gui/src/components/ui/Input.tsx +0 -21
  174. package/gui/src/components/ui/Menu.tsx +0 -71
  175. package/gui/src/components/ui/Modal.tsx +0 -39
  176. package/gui/src/components/ui/PageHeader.tsx +0 -21
  177. package/gui/src/components/ui/RepoStatusStrip.tsx +0 -33
  178. package/gui/src/components/ui/Skeleton.tsx +0 -5
  179. package/gui/src/components/ui/StatusPill.tsx +0 -36
  180. package/gui/src/components/ui/Tabs.tsx +0 -40
  181. package/gui/src/components/ui/cn.ts +0 -4
  182. package/gui/src/components/ui/index.ts +0 -16
  183. package/gui/src/features/changes/ChangesViewer.tsx +0 -388
  184. package/gui/src/features/knowledge/KnowledgeBase.tsx +0 -84
  185. package/gui/src/features/onboarding/OnboardingWizard.tsx +0 -230
  186. package/gui/src/features/plan/ImplementationPlan.tsx +0 -32
  187. package/gui/src/features/services/ServiceConsole.tsx +0 -215
  188. package/gui/src/features/sessions/SessionHistory.tsx +0 -195
  189. package/gui/src/index.css +0 -167
  190. package/gui/src/lib/status.ts +0 -24
  191. package/gui/src/main.tsx +0 -94
  192. package/gui/src/pages/DashboardPage.tsx +0 -129
  193. package/gui/src/pages/WorkspacesPage.tsx +0 -352
  194. package/gui/src/types.ts +0 -81
  195. package/gui/tsconfig.app.json +0 -25
  196. package/gui/tsconfig.json +0 -7
  197. package/gui/tsconfig.node.json +0 -24
  198. package/gui/vite.config.ts +0 -12
  199. package/resources/workflows/plan-implement-review.md +0 -8
  200. package/resources/workflows/research-verify.md +0 -6
  201. package/resources/workflows/solo-developer.md +0 -3
  202. package/scripts/simulate-workspaces.ts +0 -55
  203. package/skills-lock.json +0 -11
  204. package/src/analyzers/detect-apis.ts +0 -290
  205. package/src/analyzers/detect-deps.ts +0 -315
  206. package/src/analyzers/detect-existing.ts +0 -74
  207. package/src/analyzers/detect-ports.ts +0 -110
  208. package/src/analyzers/index.ts +0 -97
  209. package/src/analyzers/messaging-analyzer.ts +0 -254
  210. package/src/analyzers/readme-summarizer.ts +0 -102
  211. package/src/analyzers/run-analyzer.ts +0 -269
  212. package/src/analyzers/tech-stack.ts +0 -283
  213. package/src/commands/adapter.ts +0 -348
  214. package/src/commands/add-repo.ts +0 -156
  215. package/src/commands/commands.test.ts +0 -156
  216. package/src/commands/commit.ts +0 -131
  217. package/src/commands/config.ts +0 -52
  218. package/src/commands/create.ts +0 -204
  219. package/src/commands/desktop.ts +0 -128
  220. package/src/commands/diff.ts +0 -125
  221. package/src/commands/doctor.ts +0 -370
  222. package/src/commands/handoff.ts +0 -266
  223. package/src/commands/init.ts +0 -134
  224. package/src/commands/list.ts +0 -46
  225. package/src/commands/logs.ts +0 -63
  226. package/src/commands/mcp.ts +0 -94
  227. package/src/commands/open.ts +0 -129
  228. package/src/commands/refresh.ts +0 -137
  229. package/src/commands/remove.ts +0 -98
  230. package/src/commands/start.ts +0 -117
  231. package/src/commands/status.ts +0 -54
  232. package/src/commands/stop.ts +0 -55
  233. package/src/commands/sync.ts +0 -125
  234. package/src/commands/tui.ts +0 -484
  235. package/src/commands/ui.ts +0 -111
  236. package/src/core/adapters/local-storage.ts +0 -66
  237. package/src/core/adapters/obsidian-storage.ts +0 -151
  238. package/src/core/adapters/registry.ts +0 -44
  239. package/src/core/adapters/storage.test.ts +0 -174
  240. package/src/core/adapters/vault-storage.ts +0 -86
  241. package/src/core/config.test.ts +0 -96
  242. package/src/core/config.ts +0 -140
  243. package/src/core/graph.ts +0 -344
  244. package/src/core/plugins/index.ts +0 -17
  245. package/src/core/plugins/loader.ts +0 -36
  246. package/src/core/ports/storage.ts +0 -71
  247. package/src/core/scanner.test.ts +0 -61
  248. package/src/core/scanner.ts +0 -91
  249. package/src/core/storage.ts +0 -37
  250. package/src/core/sync.ts +0 -121
  251. package/src/core/workspace-state.test.ts +0 -108
  252. package/src/core/workspace-state.ts +0 -130
  253. package/src/core/workspace.ts +0 -487
  254. package/src/core/worktree.ts +0 -120
  255. package/src/generators/antigravity.ts +0 -32
  256. package/src/generators/base.ts +0 -243
  257. package/src/generators/claude.ts +0 -34
  258. package/src/generators/codex.ts +0 -48
  259. package/src/generators/copilot.ts +0 -56
  260. package/src/generators/cursor.ts +0 -44
  261. package/src/generators/diff-context.ts +0 -75
  262. package/src/generators/index.ts +0 -322
  263. package/src/generators/map-generator.test.ts +0 -159
  264. package/src/generators/map-generator.ts +0 -539
  265. package/src/generators/plan-generator.ts +0 -483
  266. package/src/generators/skills-generator.ts +0 -259
  267. package/src/index.ts +0 -539
  268. package/src/mcp/server.ts +0 -338
  269. package/src/orchestration/detect.ts +0 -313
  270. package/src/orchestration/index.ts +0 -7
  271. package/src/orchestration/runner.ts +0 -283
  272. package/src/server.test.ts +0 -618
  273. package/src/server.ts +0 -1402
  274. package/src/types.ts +0 -451
  275. package/src/utils/detect-ai.test.ts +0 -44
  276. package/src/utils/detect-ai.ts +0 -84
  277. package/src/utils/detect-editors.test.ts +0 -48
  278. package/src/utils/detect-editors.ts +0 -57
  279. package/src/utils/git.test.ts +0 -74
  280. package/src/utils/git.ts +0 -117
  281. package/src/utils/local-ai.test.ts +0 -130
  282. package/src/utils/local-ai.ts +0 -116
  283. package/src/utils/multi-git.test.ts +0 -158
  284. package/src/utils/multi-git.ts +0 -405
  285. package/src/utils/prompts.ts +0 -209
  286. package/src/utils/session-finder.ts +0 -483
  287. package/src/utils/system-scanner.test.ts +0 -89
  288. package/src/utils/system-scanner.ts +0 -96
  289. package/src/utils/update-check.ts +0 -286
  290. package/src/utils/workflow-advisor.ts +0 -118
  291. package/src/utils/workflows.test.ts +0 -114
  292. package/src/utils/workflows.ts +0 -178
  293. package/tsconfig.json +0 -19
  294. package/vitest.config.ts +0 -14
@@ -1,269 +0,0 @@
1
- /**
2
- * @module analyzers/run-analyzer
3
- * Analyzes projects to discover local run configurations, entry points,
4
- * database dependencies, external services, and flags shared staging/test
5
- * infrastructure or committed secrets.
6
- */
7
-
8
- import * as fs from 'node:fs';
9
- import * as fsp from 'node:fs/promises';
10
- import * as path from 'node:path';
11
- import { globby } from 'globby';
12
- import type { RunConfig, RunConfigEntryPoint, RunConfigDatabase, RunConfigSharedInfraWarning, RunConfigSecret } from '../types.js';
13
-
14
- /**
15
- * Analyzes local run configurations, databases, and dependencies in a repository.
16
- *
17
- * @param repoPath - Absolute path to the repository root.
18
- * @returns Run configuration analysis.
19
- */
20
- export async function analyzeRunConfig(repoPath: string): Promise<RunConfig> {
21
- const entryPoints: RunConfigEntryPoint[] = [];
22
- const databases: RunConfigDatabase[] = [];
23
- const sharedInfraWarnings: RunConfigSharedInfraWarning[] = [];
24
- const committedSecrets: RunConfigSecret[] = [];
25
- const externalDependencies: string[] = [];
26
-
27
- const isLocalHost = (host: string): boolean => {
28
- const h = host.toLowerCase().trim();
29
- return (
30
- h.includes('localhost') ||
31
- h.includes('127.0.0.1') ||
32
- h.includes('[::1]') ||
33
- h.includes('(localdb)') ||
34
- h === 'db' ||
35
- h === 'postgres' ||
36
- h === 'redis' ||
37
- h === 'mongo'
38
- );
39
- };
40
-
41
- try {
42
- // ── 1. Entry Points Detection ──────────────────────────────────────────
43
- // A. Check for C# Web/Worker apps
44
- const csprojFiles = await globby('**/*.csproj', {
45
- cwd: repoPath,
46
- absolute: true,
47
- ignore: ['**/node_modules/**', '**/bin/**', '**/obj/**', '**/dist/**', '**/out/**', '**/.git/**'],
48
- });
49
-
50
- for (const file of csprojFiles) {
51
- try {
52
- const content = await fsp.readFile(file, 'utf-8');
53
- const relPath = path.relative(repoPath, file).replace(/\\/g, '/');
54
- if (content.includes('Sdk="Microsoft.NET.Sdk.Web"')) {
55
- entryPoints.push({
56
- projectPath: relPath,
57
- type: 'aspnet',
58
- command: 'dotnet run',
59
- });
60
- } else if (content.includes('Sdk="Microsoft.NET.Sdk.Worker"')) {
61
- entryPoints.push({
62
- projectPath: relPath,
63
- type: 'worker',
64
- command: 'dotnet run',
65
- });
66
- }
67
- } catch {}
68
- }
69
-
70
- // B. Check for package.json (Node/JS/TS)
71
- const packageJsonPath = path.join(repoPath, 'package.json');
72
- try {
73
- const raw = await fsp.readFile(packageJsonPath, 'utf-8');
74
- const pkg = JSON.parse(raw);
75
- if (pkg.scripts && (pkg.scripts.start || pkg.scripts.dev)) {
76
- entryPoints.push({
77
- projectPath: 'package.json',
78
- type: pkg.dependencies && pkg.dependencies.next ? 'nextjs' : 'node',
79
- command: pkg.scripts.dev ? 'npm run dev' : 'npm start',
80
- });
81
- }
82
- } catch {}
83
-
84
- // C. Check for Python/Go
85
- const goModFiles = await globby('**/go.mod', { cwd: repoPath, absolute: true });
86
- if (goModFiles.length > 0) {
87
- entryPoints.push({
88
- projectPath: path.relative(repoPath, goModFiles[0]!).replace(/\\/g, '/'),
89
- type: 'go',
90
- command: 'go run .',
91
- });
92
- }
93
-
94
- const pyFiles = await globby(['**/requirements.txt', '**/Pipfile', '**/pyproject.toml'], { cwd: repoPath, absolute: true });
95
- if (pyFiles.length > 0) {
96
- entryPoints.push({
97
- projectPath: path.relative(repoPath, pyFiles[0]!).replace(/\\/g, '/'),
98
- type: 'python',
99
- command: 'python main.py',
100
- });
101
- }
102
-
103
- // ── 2. Config Files Parsing (DBs, Shared Infra, Secrets) ───────────────
104
- const configFiles = await globby(
105
- ['**/appsettings.json', '**/appsettings.Development.json', '**/appsettings.*.json', '**/.env', '**/.env.development', '**/.env.local'],
106
- {
107
- cwd: repoPath,
108
- absolute: true,
109
- ignore: ['**/node_modules/**', '**/bin/**', '**/obj/**', '**/dist/**', '**/out/**', '**/.git/**'],
110
- }
111
- );
112
-
113
- for (const file of configFiles) {
114
- try {
115
- const content = await fsp.readFile(file, 'utf-8');
116
- const relPath = path.relative(repoPath, file).replace(/\\/g, '/');
117
-
118
- // Secrets Check (Universal regex for high probability secrets)
119
- const secretRegex = /(?:password|pwd|secret|key|token|privatekey|accountkey|sharedaccesskey)\s*[=:]\s*['"`]?([^'";\s]{12,})['"`]?/gi;
120
- let secretMatch: RegExpExecArray | null;
121
- while ((secretMatch = secretRegex.exec(content)) !== null) {
122
- const matchedVal = secretMatch[1]!;
123
- // Skip if it looks like a placeholder
124
- if (!matchedVal.includes('placeholder') && !matchedVal.includes('<your') && !matchedVal.toLowerCase().includes('your_')) {
125
- committedSecrets.push({
126
- file: relPath,
127
- lineHint: secretMatch[0]!.split(/[=:]/)[0]!.trim(),
128
- });
129
- }
130
- }
131
-
132
- if (file.endsWith('.json')) {
133
- const parsed = JSON.parse(content);
134
-
135
- // connectionStrings
136
- if (parsed.ConnectionStrings) {
137
- for (const [key, value] of Object.entries(parsed.ConnectionStrings)) {
138
- if (typeof value === 'string') {
139
- let provider = 'unknown';
140
- if (value.toLowerCase().includes('sql server') || value.toLowerCase().includes('sqlexpress') || value.toLowerCase().includes('server=')) {
141
- provider = 'SQL Server';
142
- }
143
- if (value.toLowerCase().includes('postgresql') || value.toLowerCase().includes('port=5432')) {
144
- provider = 'PostgreSQL';
145
- }
146
-
147
- // Extract Host
148
- const hostMatch = value.match(/Server=([^;]+)/i) ?? value.match(/Host=([^;]+)/i) ?? value.match(/Data Source=([^;]+)/i);
149
- const host = hostMatch ? hostMatch[1]!.trim() : 'unknown';
150
-
151
- databases.push({
152
- provider,
153
- host,
154
- configFile: relPath,
155
- });
156
-
157
- if (host !== 'unknown' && !isLocalHost(host)) {
158
- sharedInfraWarnings.push({
159
- resource: key,
160
- host,
161
- configFile: relPath,
162
- warning: `⚠️ SHARED INFRA: ${relPath} binds ConnectionString "${key}" to non-local host (${host}). Running locally may connect to shared test/production databases.`,
163
- });
164
- }
165
- }
166
- }
167
- }
168
-
169
- // Service Bus or MQ settings
170
- const rabbitRegex = /"HostName"\s*:\s*"([^"]+)"/gi;
171
- let rabbitMatch: RegExpExecArray | null;
172
- while ((rabbitMatch = rabbitRegex.exec(content)) !== null) {
173
- const host = rabbitMatch[1]!;
174
- if (!isLocalHost(host)) {
175
- sharedInfraWarnings.push({
176
- resource: 'RabbitMQ',
177
- host,
178
- configFile: relPath,
179
- warning: `⚠️ SHARED INFRA: ${relPath} binds RabbitMQ host to non-local host (${host}).`,
180
- });
181
- }
182
- }
183
- } else {
184
- // B. .env parsing
185
- const lines = content.split('\n');
186
- for (const line of lines) {
187
- const cleanLine = line.trim();
188
- if (cleanLine.startsWith('#') || !cleanLine.includes('=')) continue;
189
-
190
- const [key, val] = cleanLine.split('=', 2);
191
- if (!key || !val) continue;
192
-
193
- const cleanKey = key.trim();
194
- const cleanVal = val.trim().replace(/^['"]|['"]$/g, '');
195
-
196
- // DB UrL e.g. DATABASE_URL=postgres://user:pass@host:port/db
197
- if (cleanKey.includes('DATABASE_URL') || cleanKey.includes('MONGODB_URI') || cleanKey.includes('REDIS_URL')) {
198
- let provider = 'unknown';
199
- if (cleanVal.startsWith('postgres')) provider = 'PostgreSQL';
200
- else if (cleanVal.startsWith('mongodb')) provider = 'MongoDB';
201
- else if (cleanVal.startsWith('redis')) provider = 'Redis';
202
-
203
- // Extract Host from URL
204
- const hostMatch = cleanVal.match(/@([^:/]+)/);
205
- const host = hostMatch ? hostMatch[1]! : cleanVal;
206
-
207
- databases.push({
208
- provider,
209
- host,
210
- configFile: relPath,
211
- });
212
-
213
- if (!isLocalHost(host)) {
214
- sharedInfraWarnings.push({
215
- resource: cleanKey,
216
- host,
217
- configFile: relPath,
218
- warning: `⚠️ SHARED INFRA: .env variable "${cleanKey}" points to non-local host (${host}).`,
219
- });
220
- }
221
- }
222
- }
223
- }
224
- } catch {}
225
- }
226
-
227
- } catch {
228
- // Ignore errors
229
- }
230
-
231
- // De-duplicate external dependencies / warnings
232
- const uniqueInfraWarnings: RunConfigSharedInfraWarning[] = [];
233
- const seenInfra = new Set<string>();
234
- for (const w of sharedInfraWarnings) {
235
- const key = `${w.resource}:${w.host}:${w.configFile}`;
236
- if (!seenInfra.has(key)) {
237
- seenInfra.add(key);
238
- uniqueInfraWarnings.push(w);
239
- }
240
- }
241
-
242
- const uniqueDatabases: RunConfigDatabase[] = [];
243
- const seenDb = new Set<string>();
244
- for (const db of databases) {
245
- const key = `${db.provider}:${db.host}:${db.configFile}`;
246
- if (!seenDb.has(key)) {
247
- seenDb.add(key);
248
- uniqueDatabases.push(db);
249
- }
250
- }
251
-
252
- const uniqueSecrets: RunConfigSecret[] = [];
253
- const seenSecret = new Set<string>();
254
- for (const s of committedSecrets) {
255
- const key = `${s.file}:${s.lineHint}`;
256
- if (!seenSecret.has(key)) {
257
- seenSecret.add(key);
258
- uniqueSecrets.push(s);
259
- }
260
- }
261
-
262
- return {
263
- entryPoints,
264
- databases: uniqueDatabases,
265
- sharedInfraWarnings: uniqueInfraWarnings,
266
- committedSecrets: uniqueSecrets,
267
- externalDependencies,
268
- };
269
- }
@@ -1,283 +0,0 @@
1
- /**
2
- * @module analyzers/tech-stack
3
- * Detects the language, framework, build tools, and project type
4
- * of a repository by inspecting manifest files.
5
- */
6
-
7
- import * as fs from 'node:fs/promises';
8
- import * as path from 'node:path';
9
- import { globby } from 'globby';
10
-
11
- import type { TechStack, Language, Framework, ProjectType } from '../types.js';
12
-
13
- /** Safely read and parse a JSON file. Returns null on failure. */
14
- async function readJson(filePath: string): Promise<Record<string, unknown> | null> {
15
- try {
16
- const raw = await fs.readFile(filePath, 'utf-8');
17
- return JSON.parse(raw) as Record<string, unknown>;
18
- } catch {
19
- return null;
20
- }
21
- }
22
-
23
- /**
24
- * Detects the tech stack of a repository by recursively inspecting its
25
- * contents for manifest files, config files, and project structures.
26
- *
27
- * @param repoPath - Absolute path to the repository root.
28
- * @returns A {@link TechStack} object describing the detected stack.
29
- */
30
- export async function detectTechStack(repoPath: string): Promise<TechStack> {
31
- const languages = new Set<Language>();
32
- const frameworks = new Set<Framework>();
33
- const buildTools = new Set<string>();
34
- const projectTypes = new Set<ProjectType>();
35
-
36
- try {
37
- const files = await globby([
38
- '**/package.json',
39
- '**/tsconfig.json',
40
- '**/*.csproj',
41
- '**/*.sln',
42
- '**/requirements.txt',
43
- '**/pyproject.toml',
44
- '**/setup.py',
45
- '**/go.mod',
46
- '**/pom.xml',
47
- '**/build.gradle',
48
- '**/build.gradle.kts',
49
- '**/Cargo.toml',
50
- '**/Gemfile',
51
- '**/composer.json',
52
- '**/Dockerfile',
53
- '**/docker-compose.yml',
54
- '**/docker-compose.yaml',
55
- '**/compose.yaml',
56
- '**/compose.yml',
57
- ], {
58
- cwd: repoPath,
59
- absolute: true,
60
- ignore: ['**/node_modules/**', '**/bin/**', '**/obj/**', '**/dist/**', '**/out/**', '**/.git/**'],
61
- });
62
-
63
- const fileMap = new Map<string, string[]>();
64
- for (const file of files) {
65
- const name = path.basename(file);
66
- let list = fileMap.get(name);
67
- if (!list) {
68
- list = [];
69
- fileMap.set(name, list);
70
- }
71
- list.push(file);
72
- }
73
-
74
- // ── Node.js / JavaScript / TypeScript ──────────────────────────────
75
- const packageJsons = fileMap.get('package.json') || [];
76
- if (packageJsons.length > 0) {
77
- const tsconfigs = fileMap.get('tsconfig.json') || [];
78
- if (tsconfigs.length > 0) {
79
- languages.add('typescript');
80
- } else {
81
- languages.add('javascript');
82
- }
83
-
84
- for (const pj of packageJsons) {
85
- const pkg = await readJson(pj);
86
- if (pkg) {
87
- const allDeps = {
88
- ...(pkg.dependencies as Record<string, string> | undefined),
89
- ...(pkg.devDependencies as Record<string, string> | undefined),
90
- };
91
-
92
- // Frameworks
93
- if (allDeps['next']) { frameworks.add('nextjs'); projectTypes.add('fullstack'); }
94
- if (allDeps['react'] && !allDeps['next']) { frameworks.add('react'); projectTypes.add('frontend'); }
95
- if (allDeps['@angular/core']) { frameworks.add('angular'); projectTypes.add('frontend'); }
96
- if (allDeps['vue']) { frameworks.add('vue'); projectTypes.add('frontend'); }
97
- if (allDeps['svelte']) { frameworks.add('svelte'); projectTypes.add('frontend'); }
98
- if (allDeps['express']) { frameworks.add('express'); projectTypes.add('backend'); }
99
- if (allDeps['@nestjs/core']) { frameworks.add('nestjs'); projectTypes.add('backend'); }
100
- if (allDeps['fastify']) { frameworks.add('fastify'); projectTypes.add('backend'); }
101
- if (allDeps['hono']) { frameworks.add('hono'); projectTypes.add('backend'); }
102
-
103
- // Build tools
104
- if (allDeps['vite'] || allDeps['@vitejs/plugin-react']) buildTools.add('vite');
105
- if (allDeps['webpack']) buildTools.add('webpack');
106
- if (allDeps['esbuild']) buildTools.add('esbuild');
107
- if (allDeps['rollup']) buildTools.add('rollup');
108
- if (allDeps['turbo']) buildTools.add('turborepo');
109
- if (allDeps['nx']) buildTools.add('nx');
110
-
111
- // Project type heuristics
112
- if (pkg.bin) projectTypes.add('cli');
113
- if (pkg.main && !pkg.bin && frameworks.size === 0) projectTypes.add('library');
114
- }
115
- }
116
- }
117
-
118
- // ── .NET / C# ─────────────────────────────────────────────────────
119
- const csprojFiles = files.filter((f) => f.endsWith('.csproj'));
120
- const slnFiles = files.filter((f) => f.endsWith('.sln'));
121
- if (csprojFiles.length > 0 || slnFiles.length > 0) {
122
- languages.add('csharp');
123
- buildTools.add('dotnet');
124
-
125
- for (const csproj of csprojFiles) {
126
- try {
127
- const content = await fs.readFile(csproj, 'utf-8');
128
- if (content.includes('Microsoft.NET.Sdk.Web')) {
129
- frameworks.add('aspnet');
130
- projectTypes.add('backend');
131
- }
132
- if (content.includes('Microsoft.NET.Sdk.BlazorWebAssembly') || content.includes('Blazor')) {
133
- frameworks.add('blazor');
134
- projectTypes.add('frontend');
135
- }
136
- } catch {}
137
- }
138
- }
139
-
140
- // ── Python ────────────────────────────────────────────────────────
141
- const pyprojectTomls = fileMap.get('pyproject.toml') || [];
142
- const requirementsTxts = fileMap.get('requirements.txt') || [];
143
- const setupPys = fileMap.get('setup.py') || [];
144
-
145
- if (pyprojectTomls.length > 0 || requirementsTxts.length > 0 || setupPys.length > 0) {
146
- languages.add('python');
147
-
148
- for (const reqFile of [...requirementsTxts, ...pyprojectTomls]) {
149
- try {
150
- const content = await fs.readFile(reqFile, 'utf-8');
151
- const lower = content.toLowerCase();
152
- if (lower.includes('django')) { frameworks.add('django'); projectTypes.add('backend'); }
153
- if (lower.includes('flask')) { frameworks.add('flask'); projectTypes.add('backend'); }
154
- if (lower.includes('fastapi')) { frameworks.add('fastapi'); projectTypes.add('backend'); }
155
- } catch {}
156
- }
157
-
158
- if (pyprojectTomls.length > 0) buildTools.add('pyproject');
159
- if (setupPys.length > 0) buildTools.add('setuptools');
160
- }
161
-
162
- // ── Go ────────────────────────────────────────────────────────────
163
- const goMods = fileMap.get('go.mod') || [];
164
- if (goMods.length > 0) {
165
- languages.add('go');
166
- buildTools.add('go');
167
-
168
- for (const goMod of goMods) {
169
- try {
170
- const content = await fs.readFile(goMod, 'utf-8');
171
- if (content.includes('github.com/gin-gonic/gin')) {
172
- frameworks.add('gin');
173
- projectTypes.add('backend');
174
- }
175
- } catch {}
176
- }
177
- }
178
-
179
- // ── Java ──────────────────────────────────────────────────────────
180
- const poms = fileMap.get('pom.xml') || [];
181
- const gradles = fileMap.get('build.gradle') || [];
182
- const gradleKts = fileMap.get('build.gradle.kts') || [];
183
-
184
- if (poms.length > 0 || gradles.length > 0 || gradleKts.length > 0) {
185
- languages.add('java');
186
- if (poms.length > 0) buildTools.add('maven');
187
- if (gradles.length > 0 || gradleKts.length > 0) buildTools.add('gradle');
188
-
189
- for (const f of [...poms, ...gradles, ...gradleKts]) {
190
- try {
191
- const content = await fs.readFile(f, 'utf-8');
192
- if (content.includes('spring')) {
193
- frameworks.add('spring');
194
- projectTypes.add('backend');
195
- }
196
- } catch {}
197
- }
198
- }
199
-
200
- // ── Rust ──────────────────────────────────────────────────────────
201
- const cargoTomls = fileMap.get('Cargo.toml') || [];
202
- if (cargoTomls.length > 0) {
203
- languages.add('rust');
204
- buildTools.add('cargo');
205
- }
206
-
207
- // ── Ruby ──────────────────────────────────────────────────────────
208
- const gemfiles = fileMap.get('Gemfile') || [];
209
- if (gemfiles.length > 0) {
210
- languages.add('ruby');
211
- buildTools.add('bundler');
212
-
213
- for (const gemfile of gemfiles) {
214
- try {
215
- const content = await fs.readFile(gemfile, 'utf-8');
216
- if (content.includes('rails')) {
217
- frameworks.add('rails');
218
- projectTypes.add('backend');
219
- }
220
- } catch {}
221
- }
222
- }
223
-
224
- // ── PHP ───────────────────────────────────────────────────────────
225
- const composerJsons = fileMap.get('composer.json') || [];
226
- if (composerJsons.length > 0) {
227
- languages.add('php');
228
- buildTools.add('composer');
229
-
230
- for (const comp of composerJsons) {
231
- const composer = await readJson(comp);
232
- if (composer) {
233
- const req = composer.require as Record<string, string> | undefined;
234
- if (req?.['laravel/framework']) {
235
- frameworks.add('laravel');
236
- projectTypes.add('backend');
237
- }
238
- }
239
- }
240
- }
241
-
242
- // ── Docker ────────────────────────────────────────────────────────
243
- const dockerfiles = fileMap.get('Dockerfile') || [];
244
- if (dockerfiles.length > 0) {
245
- buildTools.add('docker');
246
- }
247
- const hasCompose = ['docker-compose.yml', 'docker-compose.yaml', 'compose.yaml', 'compose.yml'].some(
248
- (name) => (fileMap.get(name) || []).length > 0
249
- );
250
- if (hasCompose) {
251
- buildTools.add('docker-compose');
252
- }
253
-
254
- } catch {
255
- // Ignore errors during glob/analysis
256
- }
257
-
258
- // Fallback language
259
- if (languages.size === 0) {
260
- languages.add('other');
261
- }
262
-
263
- // Heuristic for overall projectType
264
- let finalProjectType: ProjectType = 'other';
265
- if (projectTypes.has('fullstack') || (projectTypes.has('frontend') && projectTypes.has('backend'))) {
266
- finalProjectType = 'fullstack';
267
- } else if (projectTypes.has('frontend')) {
268
- finalProjectType = 'frontend';
269
- } else if (projectTypes.has('backend')) {
270
- finalProjectType = 'backend';
271
- } else if (projectTypes.has('library')) {
272
- finalProjectType = 'library';
273
- } else if (projectTypes.has('cli')) {
274
- finalProjectType = 'cli';
275
- }
276
-
277
- return {
278
- languages: Array.from(languages),
279
- frameworks: Array.from(frameworks),
280
- buildTools: Array.from(buildTools),
281
- projectType: finalProjectType,
282
- };
283
- }