@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,539 +0,0 @@
1
- /**
2
- * @module generators/map-generator
3
- * Generates a nexusflow-map-<repo>.md file for each repository in the workspace.
4
- * Provides a localized, token-efficient architectural map for AI assistants.
5
- */
6
-
7
- import * as fs from 'node:fs/promises';
8
- import * as path from 'node:path';
9
- import { globby } from 'globby';
10
- import { writeWorkspaceFile, readWorkspaceFile, workspaceFileExists, writeBaseFile, readBaseFile, baseFileExists } from '../core/storage.js';
11
- import type { ProjectAnalysis, RepoInfo } from '../types.js';
12
-
13
- interface PatternRule {
14
- name: string;
15
- label: string;
16
- regex: RegExp;
17
- description: string;
18
- }
19
-
20
- const LANG_PATTERNS: Record<string, PatternRule[]> = {
21
- csharp: [
22
- {
23
- name: 'FluentValidation',
24
- label: 'FluentValidation Validator subclasses',
25
- regex: /:\s*AbstractValidator\s*</g,
26
- description: 'Used for domain/command validation rules.'
27
- },
28
- {
29
- name: 'MediatR Handlers',
30
- label: 'MediatR Request Handlers',
31
- regex: /:\s*IRequestHandler\s*</g,
32
- description: 'Used for CQRS command/query handler pattern.'
33
- },
34
- {
35
- name: 'MediatR Requests',
36
- label: 'MediatR Requests/Commands',
37
- regex: /:\s*IRequest\b(?!Handler)/g,
38
- description: 'Used for MediatR command/query dispatching.'
39
- },
40
- {
41
- name: 'AutoMapper Profiles',
42
- label: 'AutoMapper Mapping Profiles',
43
- regex: /:\s*Profile\b/g,
44
- description: 'Used for object-to-object mappings.'
45
- },
46
- {
47
- name: 'DataAnnotations',
48
- label: 'DataAnnotations Validation Attributes',
49
- regex: /using\s+System\.ComponentModel\.DataAnnotations;/g,
50
- description: 'Used for property-level attribute validation.'
51
- }
52
- ],
53
- typescript: [
54
- {
55
- name: 'Zod Schemas',
56
- label: 'Zod Object Schemas',
57
- regex: /z\.object\s*\(/g,
58
- description: 'Used for schema parsing/validation.'
59
- },
60
- {
61
- name: 'NestJS Controllers',
62
- label: 'NestJS Routing Controllers',
63
- regex: /@Controller\s*\(/g,
64
- description: 'Used for controller routing endpoints.'
65
- },
66
- {
67
- name: 'NestJS Injectables',
68
- label: 'NestJS Injectable Services',
69
- regex: /@Injectable\s*\(\)/g,
70
- description: 'Used for dependency injection services.'
71
- },
72
- {
73
- name: 'React Components',
74
- label: 'React Functional Components',
75
- regex: /React\.FC/g,
76
- description: 'Used for component UI views.'
77
- }
78
- ],
79
- javascript: [
80
- {
81
- name: 'Zod Schemas',
82
- label: 'Zod Object Schemas',
83
- regex: /z\.object\s*\(/g,
84
- description: 'Used for schema parsing/validation.'
85
- }
86
- ],
87
- python: [
88
- {
89
- name: 'Pydantic Models',
90
- label: 'Pydantic BaseModel subclasses',
91
- regex: /class\s+\w+\s*\(\s*BaseModel\s*\)/g,
92
- description: 'Used for data schemas and validation.'
93
- },
94
- {
95
- name: 'FastAPI Routers',
96
- label: 'FastAPI APIRouter instances',
97
- regex: /=([\s\S]*?)APIRouter\s*\(/g,
98
- description: 'Used for endpoint routing.'
99
- }
100
- ],
101
- go: [
102
- {
103
- name: 'Go JSON tags',
104
- label: 'Go JSON struct tags',
105
- regex: /`json:"[^"]+"`/g,
106
- description: 'Used for struct serialization/deserialization.'
107
- }
108
- ]
109
- };
110
-
111
- /**
112
- * Generates a `nexusflow-map-<repo>.md` file in the workspace root.
113
- *
114
- * @param repo - The repository metadata.
115
- * @param analysis - The repository analysis result.
116
- * @param workspacePath - Absolute path to the workspace root directory.
117
- */
118
- export async function generateRepoMap(
119
- repo: RepoInfo,
120
- analysis: ProjectAnalysis,
121
- workspacePath: string,
122
- allProducedPackages: Set<string> = new Set(),
123
- ): Promise<void> {
124
- const repoName = repo.name;
125
- const worktreePath = path.join(workspacePath, repoName);
126
-
127
- const md: string[] = [];
128
-
129
- md.push(`# Repository Architecture Map — ${repoName}`);
130
- md.push('');
131
- md.push(`> **Repository Path**: \`${worktreePath}\``);
132
- md.push(`> **Generated At**: ${new Date().toISOString()} (UTC)`);
133
- md.push(`> **Regeneration Command**: Run \`nexusflow refresh\` to update this map.`);
134
- md.push(`> **Note**: Maps are advisory snapshots of the codebase. Always verify route parameters, patterns, and filenames before relying on them.`);
135
- md.push('');
136
-
137
-
138
- // 1. Solution/Project Layout
139
- md.push('## 🏗️ Project Layout');
140
- md.push('');
141
-
142
- try {
143
- const slnFiles = await globby('**/*.sln', {
144
- cwd: worktreePath,
145
- ignore: ['**/node_modules/**', '**/bin/**', '**/obj/**', '**/dist/**', '**/out/**', '**/.git/**'],
146
- });
147
-
148
- const csprojFiles = await globby('**/*.csproj', {
149
- cwd: worktreePath,
150
- ignore: ['**/node_modules/**', '**/bin/**', '**/obj/**', '**/dist/**', '**/out/**', '**/.git/**'],
151
- });
152
-
153
- const packageJsons = await globby('**/package.json', {
154
- cwd: worktreePath,
155
- ignore: ['**/node_modules/**', '**/bin/**', '**/obj/**', '**/dist/**', '**/out/**', '**/.git/**'],
156
- });
157
-
158
- if (slnFiles.length > 0) {
159
- md.push('### .NET Solutions');
160
- for (const sln of slnFiles) {
161
- md.push(`- **Solution**: \`${sln}\``);
162
- }
163
- md.push('');
164
- }
165
-
166
- if (csprojFiles.length > 0) {
167
- md.push('### .NET Projects');
168
- for (const csproj of csprojFiles) {
169
- const isTest = csproj.toLowerCase().includes('test') || csproj.toLowerCase().includes('spec');
170
- const role = isTest ? 'Test Suite' : 'App/Library';
171
- md.push(`- \`${csproj}\` (${role})`);
172
- }
173
- md.push('');
174
- }
175
-
176
- if (packageJsons.length > 0) {
177
- md.push('### npm Packages & Modules');
178
- for (const pj of packageJsons) {
179
- md.push(`- \`${pj}\``);
180
- }
181
- md.push('');
182
- }
183
- } catch {
184
- md.push('_No project layout files discovered or error occurred._');
185
- md.push('');
186
- }
187
-
188
- // 1.5. Messaging Topology
189
- md.push('## 📨 Messaging Topology');
190
- md.push('');
191
- if (analysis.messaging && (analysis.messaging.publishers.length > 0 || analysis.messaging.subscribers.length > 0)) {
192
- if (analysis.messaging.publishers.length > 0) {
193
- md.push('### Publishes');
194
- md.push('| Message Contract | Topic/Queue/Channel | Publisher (file) |');
195
- md.push('|---|---|---|');
196
- for (const p of analysis.messaging.publishers) {
197
- const fileLink = p.publisherFile
198
- ? `[${path.basename(p.publisherFile)}](file:///${path.join(worktreePath, p.publisherFile)})`
199
- : '—';
200
- md.push(`| ${p.contractType} | ${p.topicOrQueue} | ${fileLink} |`);
201
- }
202
- md.push('');
203
- }
204
-
205
- if (analysis.messaging.subscribers.length > 0) {
206
- md.push('### Subscribes');
207
- md.push('| Message Contract | Handler (file) | Registered in |');
208
- md.push('|---|---|---|');
209
- for (const s of analysis.messaging.subscribers) {
210
- const handlerLink = s.handlerFile
211
- ? `[${path.basename(s.handlerFile)}](file:///${path.join(worktreePath, s.handlerFile)})`
212
- : '—';
213
- const regLink = s.registrationFile
214
- ? `[${path.basename(s.registrationFile)}](file:///${path.join(worktreePath, s.registrationFile)})`
215
- : '—';
216
- md.push(`| ${s.contractType} | ${handlerLink} | ${regLink} |`);
217
- }
218
- md.push('');
219
- }
220
- } else {
221
- md.push('_No pub/sub messaging patterns detected in this repository._');
222
- md.push('');
223
- }
224
-
225
- // 2. Extensible Usage Pattern Scanning
226
- md.push('## 💡 Detected Architectural Patterns & Usages');
227
- md.push('');
228
-
229
- const detectedLanguages = analysis.techStack.languages;
230
- const patternExamples = new Map<string, { label: string; firstFile?: string; description: string }>();
231
-
232
- // Initialize examples
233
- for (const lang of detectedLanguages) {
234
- const rules = LANG_PATTERNS[lang] || [];
235
- for (const rule of rules) {
236
- patternExamples.set(rule.name, { label: rule.label, description: rule.description });
237
- }
238
- }
239
-
240
- // Scan files for pattern usage
241
- try {
242
- const extensions = detectedLanguages.map(l => {
243
- if (l === 'csharp') return 'cs';
244
- if (l === 'typescript') return 'ts';
245
- if (l === 'javascript') return 'js';
246
- if (l === 'python') return 'py';
247
- if (l === 'go') return 'go';
248
- return '';
249
- }).filter(ext => ext !== '');
250
-
251
- if (extensions.length > 0) {
252
- const globPattern = extensions.length === 1 ? `**/*.${extensions[0]}` : `**/*.{${extensions.join(',')}}`;
253
- const srcFiles = await globby(globPattern, {
254
- cwd: worktreePath,
255
- ignore: ['**/node_modules/**', '**/bin/**', '**/obj/**', '**/dist/**', '**/out/**', '**/.git/**'],
256
- });
257
-
258
- for (const file of srcFiles) {
259
- const fullPath = path.join(worktreePath, file);
260
- const content = await fs.readFile(fullPath, 'utf-8');
261
-
262
- for (const lang of detectedLanguages) {
263
- const rules = LANG_PATTERNS[lang] || [];
264
- for (const rule of rules) {
265
- const val = patternExamples.get(rule.name)!;
266
- if (val.firstFile) continue; // Already found an example
267
-
268
- rule.regex.lastIndex = 0;
269
- if (rule.regex.test(content)) {
270
- val.firstFile = file.replace(/\\/g, '/');
271
- }
272
- }
273
- }
274
- }
275
- }
276
- } catch {
277
- // Ignore errors
278
- }
279
-
280
- md.push('### Static Analysis Findings');
281
- let hasFindings = false;
282
- if (patternExamples.size > 0) {
283
- for (const [, v] of patternExamples) {
284
- if (v.firstFile) {
285
- hasFindings = true;
286
- const fileLink = `[${path.basename(v.firstFile)}](file:///${path.join(worktreePath, v.firstFile).replace(/\\/g, '/')})`;
287
- md.push(`- **${v.label}** example: ${fileLink} _(${v.description})_`);
288
- }
289
- }
290
- }
291
- if (!hasFindings) {
292
- md.push('_No architectural usage patterns detected via static analysis._');
293
- }
294
- md.push('');
295
-
296
- md.push('### Packages Present (Dependencies)');
297
- // Filter dependencies: only show internal packages produced by repos in this workspace,
298
- // or those matching a common organization namespace prefix (e.g. if one package is MyOrg.Common, then MyOrg.*).
299
- const internalPrefixes = Array.from(allProducedPackages).map(p => {
300
- const parts = p.split('.');
301
- return parts.length > 1 ? parts[0] + '.' : null;
302
- }).filter((p): p is string => p !== null);
303
-
304
- const filteredDeps = analysis.dependencies.filter(dep => {
305
- const depNameLower = dep.name.toLowerCase();
306
- if (allProducedPackages.has(depNameLower)) return true;
307
- return internalPrefixes.some(prefix => depNameLower.startsWith(prefix));
308
- });
309
-
310
- if (filteredDeps.length > 0) {
311
- for (const dep of filteredDeps) {
312
- md.push(`- \`${dep.name}\` (${dep.version || 'unknown version'})`);
313
- }
314
- } else {
315
- md.push('_No cross-repo or organization-internal package dependencies detected._');
316
- }
317
- md.push('');
318
-
319
- // 3. Endpoint Inventory
320
- md.push('## 🔌 API Endpoints');
321
- md.push('');
322
- if (analysis.endpoints.length > 0) {
323
- md.push('| Endpoint Group (Router/Module/File) | Route Prefix / Pattern | Verbs | Source File |');
324
- md.push('|:---|:---|:---|:---|');
325
-
326
- // Group endpoints by source file
327
- const grouped = new Map<string, typeof analysis.endpoints>();
328
- for (const ep of analysis.endpoints) {
329
- const src = ep.source || 'Unknown';
330
- if (!grouped.has(src)) {
331
- grouped.set(src, []);
332
- }
333
- grouped.get(src)!.push(ep);
334
- }
335
-
336
- const findCommonPrefix = (paths: string[]): string => {
337
- if (paths.length === 0) return '';
338
- if (paths.length === 1) return paths[0]!;
339
- const sorted = [...paths].sort();
340
- const first = sorted[0]!.split('/');
341
- const last = sorted[sorted.length - 1]!.split('/');
342
- const common: string[] = [];
343
- for (let i = 0; i < first.length; i++) {
344
- if (first[i] === last[i]) {
345
- common.push(first[i]!);
346
- } else {
347
- break;
348
- }
349
- }
350
- const prefix = common.join('/');
351
- return prefix || '/';
352
- };
353
-
354
- for (const [src, eps] of grouped) {
355
- const groupName = src !== 'Unknown' ? path.basename(src, path.extname(src)) : 'Inferred';
356
- const paths = eps.map(e => e.path);
357
- const commonPrefix = findCommonPrefix(paths);
358
- const verbs = Array.from(new Set(eps.map(e => e.method.toUpperCase()))).join(', ');
359
- const sourceLink = src !== 'Unknown'
360
- ? `[${path.basename(src)}](file:///${path.join(worktreePath, src).replace(/\\/g, '/')})`
361
- : '—';
362
- md.push(`| ${groupName} | \`${commonPrefix}\` | \`${verbs}\` | ${sourceLink} |`);
363
- }
364
- } else {
365
- md.push('_No endpoints detected._');
366
- }
367
- md.push('');
368
-
369
- // 4. Test Landscape
370
- md.push('## 🧪 Test Landscape & Command');
371
- md.push('');
372
- const testFrameworks: string[] = [];
373
- let testCommand = '';
374
-
375
- for (const dep of analysis.dependencies) {
376
- const name = dep.name.toLowerCase();
377
- if (name.includes('xunit')) testFrameworks.push('xUnit');
378
- if (name.includes('mstest') || name.includes('microsoft.testplatform')) testFrameworks.push('MSTest');
379
- if (name.includes('nunit')) testFrameworks.push('NUnit');
380
- if (name.includes('jest')) testFrameworks.push('Jest');
381
- if (name.includes('vitest')) testFrameworks.push('Vitest');
382
- if (name.includes('cypress')) testFrameworks.push('Cypress');
383
- if (name.includes('playwright')) testFrameworks.push('Playwright');
384
- }
385
-
386
- if (analysis.techStack.languages.includes('csharp')) {
387
- testCommand = 'dotnet test';
388
- try {
389
- const slns = await globby('**/*.sln', {
390
- cwd: worktreePath,
391
- ignore: ['**/node_modules/**', '**/bin/**', '**/obj/**', '**/dist/**', '**/out/**', '**/.git/**'],
392
- });
393
- if (slns.length > 0) {
394
- testCommand = `dotnet test ${slns[0]}`;
395
- }
396
- } catch {}
397
- } else if (analysis.techStack.languages.includes('typescript') || analysis.techStack.languages.includes('javascript')) {
398
- testCommand = 'npm test';
399
- }
400
-
401
- if (testFrameworks.length > 0) {
402
- md.push(`- **Frameworks**: ${testFrameworks.join(', ')}`);
403
- } else {
404
- md.push('- **Frameworks**: None explicitly detected');
405
- }
406
- if (testCommand) {
407
- md.push(`- **Run Command**: \`${testCommand}\``);
408
- }
409
- md.push('');
410
-
411
- // 4.5. Running Locally
412
- md.push('## ▶️ Running Locally');
413
- md.push('');
414
- if (analysis.runConfig) {
415
- const { entryPoints, databases, sharedInfraWarnings, committedSecrets } = analysis.runConfig;
416
-
417
- if (entryPoints.length > 0) {
418
- md.push('### Entry Points');
419
- for (const ep of entryPoints) {
420
- md.push(`- **${ep.type.toUpperCase()} App**: \`${ep.command || 'dotnet run'}\` (configured in \`${ep.projectPath}\`)`);
421
- }
422
- md.push('');
423
- }
424
-
425
- if (databases.length > 0) {
426
- md.push('### Databases & Data Stores');
427
- md.push('| Provider | Target Host | Config File |');
428
- md.push('|---|---|---|');
429
- for (const db of databases) {
430
- md.push(`| ${db.provider} | ${db.host} | \`${db.configFile}\` |`);
431
- }
432
- md.push('');
433
- }
434
-
435
- if (sharedInfraWarnings.length > 0) {
436
- md.push('### ⚠️ Shared Infrastructure Warnings');
437
- for (const w of sharedInfraWarnings) {
438
- md.push(`- ${w.warning}`);
439
- }
440
- md.push('');
441
- }
442
-
443
- if (committedSecrets.length > 0) {
444
- md.push('### 🔒 Potential Committed Secrets');
445
- for (const s of committedSecrets) {
446
- md.push(`- **Warning**: Possible plaintext secret/key/password found in \`${s.file}\` (key hint: \`${s.lineHint}\`)`);
447
- }
448
- md.push('');
449
- }
450
- } else {
451
- md.push('_No run configurations detected._');
452
- md.push('');
453
- }
454
-
455
- // 5. Custom Skills
456
- md.push('## 🛠️ Custom Agent Skills');
457
- md.push('');
458
- try {
459
- const skills = await globby('**/SKILL.md', {
460
- cwd: worktreePath,
461
- absolute: true,
462
- ignore: ['**/node_modules/**', '**/bin/**', '**/obj/**', '**/dist/**', '**/out/**', '**/.git/**'],
463
- });
464
-
465
- if (skills.length > 0) {
466
- md.push('The following custom agent skills are available in this repository:');
467
- for (const skill of skills) {
468
- const relativeSkill = path.relative(worktreePath, skill);
469
- const skillName = path.basename(path.dirname(skill));
470
- md.push(`- **${skillName}**: [${relativeSkill}](file:///${skill})`);
471
- }
472
- } else {
473
- md.push('_No custom agent skills found in this repository._');
474
- }
475
- } catch {
476
- md.push('_No custom agent skills found in this repository._');
477
- }
478
- md.push('');
479
-
480
- // 6. AI Configurations
481
- md.push('## 📄 AI Assistant Configurations');
482
- md.push('');
483
- if (analysis.existingAIConfigs.length > 0) {
484
- md.push('Incorporate instructions from these local configurations:');
485
- for (const config of analysis.existingAIConfigs) {
486
- md.push(`- [${config.relativePath}](file:///${path.join(worktreePath, config.relativePath)}) (${config.assistant})`);
487
- }
488
- } else {
489
- md.push('_No pre-existing AI configurations found in this repository._');
490
- }
491
- md.push('');
492
-
493
- // 7. Project-Specific Conventions (Agent-Defined)
494
- md.push('## 📝 Discovered Conventions');
495
- md.push('');
496
-
497
- const featureId = path.basename(workspacePath);
498
- const conventionsFilename = `nexusflow-conventions-${repoName}.md`;
499
- let customConventions = '';
500
-
501
- const conventionsExist = await workspaceFileExists(workspacePath, featureId, conventionsFilename);
502
-
503
- if (!conventionsExist) {
504
- const starterContent = `# Repository Conventions — ${repoName}
505
-
506
- Use this file to record project-specific coding conventions, patterns, gotchas, and constraints learned during development.
507
- Future AI assistant sessions will read these conventions from the repository map.
508
-
509
- ## Coding Patterns
510
- <!-- E.g., Use ErrorContent structure for errors instead of plain strings -->
511
-
512
- - None recorded yet.
513
-
514
- ## Gotchas & Watch-outs
515
- <!-- E.g., Non-nullable enum required attributes gotchas -->
516
-
517
- - None recorded yet.
518
- `;
519
- try {
520
- await writeBaseFile(workspacePath, repoName, conventionsFilename, starterContent);
521
- customConventions = starterContent.replace(/^#\s+.+\n?/, '').trim();
522
- } catch {}
523
- } else {
524
- try {
525
- customConventions = await readBaseFile(workspacePath, repoName, conventionsFilename);
526
- customConventions = customConventions.replace(/^#\s+.+\n?/, '').trim();
527
- } catch {}
528
- }
529
-
530
- if (customConventions) {
531
- md.push(customConventions);
532
- md.push('');
533
- } else {
534
- md.push('- None recorded yet.');
535
- md.push('');
536
- }
537
-
538
- await writeBaseFile(workspacePath, repoName, `nexusflow-map-${repoName}.md`, md.join('\n'));
539
- }