@mrpatronz/nexusflow 0.2.17 → 0.2.18
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.
- package/.agents/skills/ccc/SKILL.md +71 -0
- package/.agents/skills/ccc/references/management.md +110 -0
- package/.agents/skills/ccc/references/settings.md +126 -0
- package/.github/dependabot.yml +52 -52
- package/.github/workflows/ci.yml +44 -0
- package/.github/workflows/dependabot-merge.yml +53 -53
- package/.github/workflows/release-desktop.yml +67 -0
- package/.github/workflows/release-npm.yml +65 -0
- package/.github/workflows/release-vscode.yml +61 -0
- package/.vscode/launch.json +17 -17
- package/.vscode/tasks.json +17 -17
- package/GETTING_STARTED.md +114 -114
- package/README.md +364 -336
- package/desktop/build-installer.js +228 -228
- package/desktop/build.js +118 -118
- package/desktop/installer/nexusflow.iss +35 -35
- package/desktop/neutralino.config.json +38 -38
- package/desktop/package-lock.json +1060 -1060
- package/desktop/package.json +14 -14
- package/dist/commands/adapter.d.ts +27 -0
- package/dist/commands/adapter.d.ts.map +1 -0
- package/dist/commands/adapter.js +318 -0
- package/dist/commands/adapter.js.map +1 -0
- package/dist/commands/add-repo.d.ts.map +1 -1
- package/dist/commands/add-repo.js +0 -1
- package/dist/commands/add-repo.js.map +1 -1
- package/dist/commands/commands.test.js +2 -2
- package/dist/commands/commands.test.js.map +1 -1
- package/dist/commands/config.d.ts +22 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +50 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +14 -17
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +11 -0
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/refresh.d.ts +1 -0
- package/dist/commands/refresh.d.ts.map +1 -1
- package/dist/commands/refresh.js +2 -14
- package/dist/commands/refresh.js.map +1 -1
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +0 -5
- package/dist/commands/sync.js.map +1 -1
- package/dist/commands/tui.d.ts.map +1 -1
- package/dist/commands/tui.js +63 -10
- package/dist/commands/tui.js.map +1 -1
- package/dist/core/adapters/local-storage.d.ts +14 -0
- package/dist/core/adapters/local-storage.d.ts.map +1 -0
- package/dist/core/adapters/local-storage.js +58 -0
- package/dist/core/adapters/local-storage.js.map +1 -0
- package/dist/core/adapters/obsidian-storage.d.ts +28 -0
- package/dist/core/adapters/obsidian-storage.d.ts.map +1 -0
- package/dist/core/adapters/obsidian-storage.js +135 -0
- package/dist/core/adapters/obsidian-storage.js.map +1 -0
- package/dist/core/adapters/registry.d.ts +8 -0
- package/dist/core/adapters/registry.d.ts.map +1 -0
- package/dist/core/adapters/registry.js +37 -0
- package/dist/core/adapters/registry.js.map +1 -0
- package/dist/core/adapters/storage.test.d.ts +2 -0
- package/dist/core/adapters/storage.test.d.ts.map +1 -0
- package/dist/core/adapters/storage.test.js +106 -0
- package/dist/core/adapters/storage.test.js.map +1 -0
- package/dist/core/adapters/vault-storage.d.ts +16 -0
- package/dist/core/adapters/vault-storage.d.ts.map +1 -0
- package/dist/core/adapters/vault-storage.js +77 -0
- package/dist/core/adapters/vault-storage.js.map +1 -0
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +28 -4
- package/dist/core/config.js.map +1 -1
- package/dist/core/plugins/index.d.ts +14 -0
- package/dist/core/plugins/index.d.ts.map +1 -0
- package/dist/core/plugins/index.js +2 -0
- package/dist/core/plugins/index.js.map +1 -0
- package/dist/core/plugins/loader.d.ts +2 -0
- package/dist/core/plugins/loader.d.ts.map +1 -0
- package/dist/core/plugins/loader.js +34 -0
- package/dist/core/plugins/loader.js.map +1 -0
- package/dist/core/ports/storage.d.ts +59 -0
- package/dist/core/ports/storage.d.ts.map +1 -0
- package/dist/core/ports/storage.js +10 -0
- package/dist/core/ports/storage.js.map +1 -0
- package/dist/core/storage.d.ts +10 -0
- package/dist/core/storage.d.ts.map +1 -0
- package/dist/core/storage.js +29 -0
- package/dist/core/storage.js.map +1 -0
- package/dist/core/workspace.d.ts.map +1 -1
- package/dist/core/workspace.js +110 -16
- package/dist/core/workspace.js.map +1 -1
- package/dist/generators/base.d.ts.map +1 -1
- package/dist/generators/base.js +80 -79
- package/dist/generators/base.js.map +1 -1
- package/dist/generators/codex.js +11 -11
- package/dist/generators/copilot.js +17 -17
- package/dist/generators/cursor.js +5 -5
- package/dist/generators/diff-context.d.ts +6 -0
- package/dist/generators/diff-context.d.ts.map +1 -0
- package/dist/generators/diff-context.js +68 -0
- package/dist/generators/diff-context.js.map +1 -0
- package/dist/generators/index.d.ts +1 -1
- package/dist/generators/index.d.ts.map +1 -1
- package/dist/generators/index.js +125 -68
- package/dist/generators/index.js.map +1 -1
- package/dist/generators/map-generator.d.ts.map +1 -1
- package/dist/generators/map-generator.js +21 -25
- package/dist/generators/map-generator.js.map +1 -1
- package/dist/generators/plan-generator.d.ts.map +1 -1
- package/dist/generators/plan-generator.js +3 -5
- package/dist/generators/plan-generator.js.map +1 -1
- package/dist/generators/skills-generator.js +28 -28
- package/dist/gui/assets/index-CB-jWded.css +1 -0
- package/dist/gui/assets/index-DDXpZZu3.js +25 -0
- package/dist/gui/icons.svg +24 -24
- package/dist/gui/index.html +18 -18
- package/dist/index.js +131 -20
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +46 -43
- package/dist/server.js.map +1 -1
- package/dist/server.test.js +105 -48
- package/dist/server.test.js.map +1 -1
- package/dist/types.d.ts +7 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/local-ai.d.ts.map +1 -1
- package/dist/utils/local-ai.js +7 -3
- package/dist/utils/local-ai.js.map +1 -1
- package/dist/utils/update-check.d.ts.map +1 -1
- package/dist/utils/update-check.js +0 -28
- package/dist/utils/update-check.js.map +1 -1
- package/dist/utils/workflow-advisor.d.ts +16 -0
- package/dist/utils/workflow-advisor.d.ts.map +1 -0
- package/dist/utils/workflow-advisor.js +100 -0
- package/dist/utils/workflow-advisor.js.map +1 -0
- package/extension/package-lock.json +6044 -2673
- package/extension/package.json +117 -108
- package/extension/src/extension.ts +653 -631
- package/extension/tsconfig.json +21 -21
- package/gui/README.md +73 -73
- package/gui/e2e/wizard.spec.ts +346 -346
- package/gui/eslint.config.js +26 -26
- package/gui/index.html +17 -17
- package/gui/package-lock.json +3079 -3079
- package/gui/package.json +36 -36
- package/gui/playwright.config.ts +41 -41
- package/gui/public/icons.svg +24 -24
- package/gui/src/App.css +1 -1
- package/gui/src/App.tsx +3632 -3407
- package/gui/src/assets/vite.svg +1 -1
- package/gui/src/features/changes/ChangesViewer.tsx +388 -388
- package/gui/src/features/knowledge/KnowledgeBase.tsx +84 -84
- package/gui/src/features/onboarding/OnboardingWizard.tsx +230 -230
- package/gui/src/features/plan/ImplementationPlan.tsx +32 -32
- package/gui/src/features/services/ServiceConsole.tsx +250 -250
- package/gui/src/features/sessions/SessionHistory.tsx +195 -195
- package/gui/src/features/workspace/WorkspaceList.tsx +666 -666
- package/gui/src/index.css +152 -152
- package/gui/src/main.tsx +94 -94
- package/gui/src/types.ts +62 -62
- package/gui/tsconfig.app.json +25 -25
- package/gui/tsconfig.json +7 -7
- package/gui/tsconfig.node.json +24 -24
- package/gui/vite.config.ts +12 -12
- package/package.json +55 -56
- package/resources/workflows/plan-implement-review.md +8 -8
- package/resources/workflows/research-verify.md +6 -6
- package/resources/workflows/solo-developer.md +3 -3
- package/scripts/simulate-workspaces.ts +55 -55
- package/skills-lock.json +11 -0
- package/src/analyzers/detect-apis.ts +290 -290
- package/src/analyzers/detect-deps.ts +315 -315
- package/src/analyzers/detect-existing.ts +74 -74
- package/src/analyzers/detect-ports.ts +110 -110
- package/src/analyzers/index.ts +97 -97
- package/src/analyzers/messaging-analyzer.ts +254 -254
- package/src/analyzers/readme-summarizer.ts +102 -102
- package/src/analyzers/run-analyzer.ts +269 -269
- package/src/analyzers/tech-stack.ts +283 -283
- package/src/commands/adapter.ts +348 -0
- package/src/commands/add-repo.ts +156 -157
- package/src/commands/commands.test.ts +156 -155
- package/src/commands/commit.ts +131 -131
- package/src/commands/config.ts +52 -0
- package/src/commands/create.ts +204 -207
- package/src/commands/desktop.ts +128 -128
- package/src/commands/diff.ts +125 -125
- package/src/commands/doctor.ts +370 -357
- package/src/commands/handoff.ts +266 -266
- package/src/commands/init.ts +134 -134
- package/src/commands/list.ts +46 -46
- package/src/commands/logs.ts +63 -63
- package/src/commands/mcp.ts +94 -92
- package/src/commands/open.ts +129 -129
- package/src/commands/refresh.ts +137 -147
- package/src/commands/remove.ts +98 -98
- package/src/commands/start.ts +117 -117
- package/src/commands/status.ts +54 -54
- package/src/commands/stop.ts +55 -55
- package/src/commands/sync.ts +147 -151
- package/src/commands/tui.ts +484 -424
- package/src/commands/ui.ts +111 -111
- package/src/core/adapters/local-storage.ts +66 -0
- package/src/core/adapters/obsidian-storage.ts +151 -0
- package/src/core/adapters/registry.ts +44 -0
- package/src/core/adapters/storage.test.ts +174 -0
- package/src/core/adapters/vault-storage.ts +86 -0
- package/src/core/config.test.ts +96 -96
- package/src/core/config.ts +140 -115
- package/src/core/graph.ts +344 -344
- package/src/core/plugins/index.ts +17 -0
- package/src/core/plugins/loader.ts +36 -0
- package/src/core/ports/storage.ts +71 -0
- package/src/core/scanner.test.ts +61 -61
- package/src/core/scanner.ts +91 -91
- package/src/core/storage.ts +37 -0
- package/src/core/workspace.ts +487 -380
- package/src/core/worktree.ts +120 -120
- package/src/generators/antigravity.ts +32 -32
- package/src/generators/base.ts +243 -240
- package/src/generators/claude.ts +34 -34
- package/src/generators/codex.ts +48 -48
- package/src/generators/copilot.ts +56 -56
- package/src/generators/cursor.ts +44 -44
- package/src/generators/diff-context.ts +75 -0
- package/src/generators/index.ts +322 -250
- package/src/generators/map-generator.test.ts +159 -159
- package/src/generators/map-generator.ts +539 -542
- package/src/generators/plan-generator.ts +483 -481
- package/src/generators/skills-generator.ts +259 -259
- package/src/index.ts +539 -426
- package/src/mcp/server.ts +294 -294
- package/src/orchestration/detect.ts +313 -313
- package/src/orchestration/index.ts +7 -7
- package/src/orchestration/runner.ts +283 -283
- package/src/server.test.ts +618 -555
- package/src/server.ts +1314 -1308
- package/src/types.ts +415 -408
- package/src/utils/detect-ai.test.ts +44 -44
- package/src/utils/detect-ai.ts +84 -84
- package/src/utils/detect-editors.test.ts +48 -48
- package/src/utils/detect-editors.ts +57 -57
- package/src/utils/git.test.ts +74 -74
- package/src/utils/git.ts +117 -117
- package/src/utils/local-ai.test.ts +130 -130
- package/src/utils/local-ai.ts +116 -111
- package/src/utils/multi-git.ts +313 -313
- package/src/utils/prompts.ts +209 -209
- package/src/utils/session-finder.ts +483 -483
- package/src/utils/system-scanner.test.ts +89 -89
- package/src/utils/system-scanner.ts +96 -96
- package/src/utils/update-check.ts +286 -309
- package/src/utils/workflow-advisor.ts +118 -0
- package/src/utils/workflows.test.ts +114 -114
- package/src/utils/workflows.ts +178 -178
- package/tsconfig.json +19 -19
- package/vitest.config.ts +14 -14
- package/.github/workflows/release.yml +0 -112
- package/dist/commands/pack.d.ts +0 -7
- package/dist/commands/pack.d.ts.map +0 -1
- package/dist/commands/pack.js +0 -64
- package/dist/commands/pack.js.map +0 -1
- package/dist/core/packer.d.ts +0 -14
- package/dist/core/packer.d.ts.map +0 -1
- package/dist/core/packer.js +0 -87
- package/dist/core/packer.js.map +0 -1
- package/dist/core/packer.test.d.ts +0 -2
- package/dist/core/packer.test.d.ts.map +0 -1
- package/dist/core/packer.test.js +0 -82
- package/dist/core/packer.test.js.map +0 -1
- package/dist/gui/assets/index-Ct3qq-X4.js +0 -25
- package/dist/gui/assets/index-P_ZrgHXg.css +0 -1
- package/src/commands/pack.ts +0 -73
- package/src/core/packer.test.ts +0 -99
- package/src/core/packer.ts +0 -107
|
@@ -1,542 +1,539 @@
|
|
|
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
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
* @param
|
|
115
|
-
* @param
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
md.push(
|
|
130
|
-
md.push(
|
|
131
|
-
md.push(`> **
|
|
132
|
-
md.push(`> **
|
|
133
|
-
md.push(`> **
|
|
134
|
-
md.push(
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
md.push('');
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
md.push('');
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
md.push('');
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
md.push('
|
|
194
|
-
md.push('
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
md.push('
|
|
207
|
-
md.push('
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
md.push('');
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
md.push('');
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
const
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
if (l === '
|
|
244
|
-
if (l === '
|
|
245
|
-
if (l === '
|
|
246
|
-
if (l === '
|
|
247
|
-
return '';
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
const
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
const
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
//
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
md.push('');
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
md.push('
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
if (paths.length ===
|
|
338
|
-
|
|
339
|
-
const
|
|
340
|
-
const
|
|
341
|
-
const
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
const
|
|
356
|
-
const
|
|
357
|
-
const
|
|
358
|
-
const
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
md.push('');
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
if (name.includes('
|
|
378
|
-
if (name.includes('
|
|
379
|
-
if (name.includes('
|
|
380
|
-
if (name.includes('
|
|
381
|
-
if (name.includes('
|
|
382
|
-
if (name.includes('
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
md.push('');
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
md.push('
|
|
427
|
-
md.push('
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
md.push('');
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
md.push('');
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
const
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
md.push('');
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
md.push('');
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
let
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
md.push('');
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
const outPath = path.join(workspacePath, `nexusflow-map-${repoName}.md`);
|
|
541
|
-
await fs.writeFile(outPath, md.join('\n'), 'utf-8');
|
|
542
|
-
}
|
|
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
|
+
}
|