@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
package/src/core/graph.ts DELETED
@@ -1,344 +0,0 @@
1
- import * as fs from 'node:fs/promises';
2
- import * as path from 'node:path';
3
- import { execa } from 'execa';
4
- import type { WorkspaceContext, RepoInfo } from '../types.js';
5
-
6
- export interface GraphNode {
7
- id: string;
8
- type: 'repo' | 'package' | 'endpoint' | 'port';
9
- name: string;
10
- metadata: Record<string, any>;
11
- }
12
-
13
- export interface GraphEdge {
14
- source: string;
15
- target: string;
16
- type: 'CONTAINS' | 'DEPENDS_ON' | 'EXPOSES' | 'CALLS';
17
- metadata?: Record<string, any>;
18
- }
19
-
20
- export interface WorkspaceGraph {
21
- workspaceId: string;
22
- nodes: GraphNode[];
23
- edges: GraphEdge[];
24
- }
25
-
26
- /**
27
- * Builds a structural and API interaction graph across all repos in a workspace.
28
- */
29
- export async function buildWorkspaceGraph(
30
- ctx: WorkspaceContext,
31
- workspacePath: string,
32
- ): Promise<WorkspaceGraph> {
33
- const { feature, repos, analysis } = ctx;
34
- const nodes: GraphNode[] = [];
35
- const edges: GraphEdge[] = [];
36
-
37
- // 1. Add Repository Nodes
38
- for (const repo of repos) {
39
- const a = analysis?.get(repo.path);
40
- nodes.push({
41
- id: `repo:${repo.name}`,
42
- type: 'repo',
43
- name: repo.name,
44
- metadata: {
45
- path: repo.path,
46
- techStack: a?.techStack || null,
47
- description: a?.readmeSummary || '',
48
- },
49
- });
50
- }
51
-
52
- // 2. Add API Endpoint and Port Nodes, and EXPOSES Edges
53
- const allEndpoints: { endpointId: string; method: string; path: string; repoName: string }[] = [];
54
-
55
- if (analysis) {
56
- for (const repo of repos) {
57
- const a = analysis.get(repo.path);
58
- if (!a) continue;
59
-
60
- // Add Ports
61
- for (const p of a.ports) {
62
- const portId = `port:${repo.name}:${p.port}`;
63
- nodes.push({
64
- id: portId,
65
- type: 'port',
66
- name: `${p.port}`,
67
- metadata: {
68
- protocol: p.protocol,
69
- source: p.source,
70
- },
71
- });
72
- edges.push({
73
- source: `repo:${repo.name}`,
74
- target: portId,
75
- type: 'EXPOSES',
76
- });
77
- }
78
-
79
- // Add API Endpoints
80
- for (const ep of a.endpoints) {
81
- const endpointId = `endpoint:${repo.name}:${ep.method}:${ep.path}`;
82
- nodes.push({
83
- id: endpointId,
84
- type: 'endpoint',
85
- name: `${ep.method} ${ep.path}`,
86
- metadata: {
87
- method: ep.method,
88
- path: ep.path,
89
- source: ep.source,
90
- },
91
- });
92
- edges.push({
93
- source: `repo:${repo.name}`,
94
- target: endpointId,
95
- type: 'EXPOSES',
96
- });
97
-
98
- allEndpoints.push({
99
- endpointId,
100
- method: ep.method,
101
- path: ep.path,
102
- repoName: repo.name,
103
- });
104
- }
105
-
106
- // Add package dependencies
107
- for (const dep of a.dependencies) {
108
- const packageId = `package:${dep.type}:${dep.name}`;
109
- if (!nodes.some((n) => n.id === packageId)) {
110
- nodes.push({
111
- id: packageId,
112
- type: 'package',
113
- name: dep.name,
114
- metadata: {
115
- manager: dep.type,
116
- version: dep.version || 'latest',
117
- },
118
- });
119
- }
120
- edges.push({
121
- source: `repo:${repo.name}`,
122
- target: packageId,
123
- type: 'DEPENDS_ON',
124
- });
125
- }
126
- }
127
- }
128
-
129
- // 3. Add inter-repo DEPENDS_ON edges
130
- if (analysis) {
131
- const repoNames = new Map(repos.map((r) => [r.path, r.name]));
132
- const { findInterRepoDependencies } = await import('../analyzers/detect-deps.js');
133
- const interDeps = findInterRepoDependencies(analysis, repoNames);
134
-
135
- for (const [caller, callees] of interDeps) {
136
- for (const callee of callees) {
137
- edges.push({
138
- source: `repo:${caller}`,
139
- target: `repo:${callee}`,
140
- type: 'DEPENDS_ON',
141
- metadata: { relation: 'repo-to-repo' },
142
- });
143
- }
144
- }
145
- }
146
-
147
- // 4. Detect CALLS Edges using git grep inside worktrees
148
- for (const ep of allEndpoints) {
149
- const pathQuery = ep.path;
150
- // Skip very short or generic paths to avoid false positives and noise
151
- if (!pathQuery || pathQuery.length < 4 || pathQuery === '/api' || pathQuery === '/dev') continue;
152
-
153
- for (const repo of repos) {
154
- if (repo.name === ep.repoName) continue; // Skip self
155
-
156
- const worktreePath = path.join(workspacePath, repo.name);
157
- try {
158
- await fs.access(worktreePath);
159
- // Use git grep to find references to this endpoint path in other worktrees
160
- const { stdout } = await execa('git', ['grep', '-l', '-F', pathQuery], {
161
- cwd: worktreePath,
162
- reject: false,
163
- });
164
-
165
- if (stdout && stdout.trim()) {
166
- const files = stdout.split('\n').filter(Boolean);
167
- edges.push({
168
- source: `repo:${repo.name}`,
169
- target: ep.endpointId,
170
- type: 'CALLS',
171
- metadata: {
172
- files,
173
- reason: `References endpoint path '${pathQuery}'`,
174
- },
175
- });
176
- }
177
- } catch {
178
- // Ignore git grep failures
179
- }
180
- }
181
- }
182
-
183
- return {
184
- workspaceId: feature.id,
185
- nodes,
186
- edges,
187
- };
188
- }
189
-
190
- /**
191
- * Builds a Mermaid Flowchart representation of the workspace architecture graph.
192
- */
193
- export function buildMermaidDiagram(graph: WorkspaceGraph): string {
194
- const lines: string[] = ['flowchart TD'];
195
-
196
- lines.push(' classDef repo fill:#3b82f6,stroke:#1d4ed8,stroke-width:2px,color:#fff;');
197
- lines.push(' classDef endpoint fill:#10b981,stroke:#047857,stroke-width:2px,color:#fff;');
198
- lines.push(' classDef port fill:#f59e0b,stroke:#b45309,stroke-width:2px,color:#fff;');
199
- lines.push(' classDef package fill:#8b5cf6,stroke:#6d28d9,stroke-width:2px,color:#fff;');
200
-
201
- // Render Repo nodes
202
- for (const n of graph.nodes) {
203
- if (n.type === 'repo') {
204
- lines.push(` ${n.id}["📦 ${n.name}"]:::repo`);
205
- }
206
- }
207
-
208
- // Render edges between repos
209
- const repoEdges = graph.edges.filter(
210
- (e) => e.source.startsWith('repo:') && e.target.startsWith('repo:'),
211
- );
212
- for (const e of repoEdges) {
213
- lines.push(` ${e.source} -->|depends on| ${e.target}`);
214
- }
215
-
216
- // Render API calls and endpoint interactions
217
- const callsEdges = graph.edges.filter((e) => e.type === 'CALLS');
218
- const referencedEndpointIds = new Set(callsEdges.map((e) => e.target));
219
-
220
- for (const n of graph.nodes) {
221
- if (n.type === 'endpoint' && referencedEndpointIds.has(n.id)) {
222
- lines.push(` ${n.id}["🔌 ${n.name}"]:::endpoint`);
223
- }
224
- }
225
-
226
- for (const e of callsEdges) {
227
- lines.push(` ${e.source} -->|calls| ${e.target}`);
228
- }
229
-
230
- // Render exposures from endpoints to their parent repos
231
- const exposesEdges = graph.edges.filter(
232
- (e) => e.type === 'EXPOSES' && referencedEndpointIds.has(e.target),
233
- );
234
- for (const e of exposesEdges) {
235
- lines.push(` ${e.target} -.->|exposed by| ${e.source}`);
236
- }
237
-
238
- return lines.join('\n');
239
- }
240
-
241
- /**
242
- * Formats the graph as a human/LLM-readable markdown guide.
243
- */
244
- export function generateGraphMarkdownContent(graph: WorkspaceGraph): string {
245
- const repoNodes = graph.nodes.filter((n) => n.type === 'repo');
246
- const mermaid = buildMermaidDiagram(graph);
247
-
248
- const lines: string[] = [
249
- `# Workspace Architecture Graph — ${graph.workspaceId}`,
250
- '',
251
- '> **Token-Efficient Architecture Guide**: This file defines the entities, dependencies,',
252
- '> and API call relationships of your multi-repository workspace. Use this map to navigate',
253
- '> relationships without having to read through all repository directories.',
254
- '',
255
- '## Workspace Relations Diagram',
256
- '',
257
- '```mermaid',
258
- mermaid,
259
- '```',
260
- '',
261
- '## 📦 Repositories',
262
- '',
263
- ];
264
-
265
- for (const repo of repoNodes) {
266
- lines.push(`### ${repo.name}`);
267
- lines.push(`- **Path**: \`${repo.metadata.path}\``);
268
- if (repo.metadata.techStack) {
269
- const ts = repo.metadata.techStack;
270
- lines.push(`- **Languages**: ${ts.languages.join(', ')}`);
271
- if (ts.frameworks.length > 0) {
272
- lines.push(`- **Frameworks**: ${ts.frameworks.join(', ')}`);
273
- }
274
- }
275
-
276
- // Dependencies
277
- const deps = graph.edges
278
- .filter((e) => e.source === repo.id && e.target.startsWith('package:'))
279
- .map((e) => {
280
- const pkgNode = graph.nodes.find((n) => n.id === e.target);
281
- return pkgNode ? `\`${pkgNode.name}\` (${pkgNode.metadata.manager})` : '';
282
- })
283
- .filter(Boolean);
284
-
285
- if (deps.length > 0) {
286
- lines.push(`- **Dependencies**: ${deps.slice(0, 10).join(', ')}${deps.length > 10 ? ` (+${deps.length - 10} more)` : ''}`);
287
- }
288
-
289
- // Exposed APIs
290
- const exposed = graph.edges
291
- .filter((e) => e.source === repo.id && e.target.startsWith('endpoint:'))
292
- .map((e) => {
293
- const ep = graph.nodes.find((n) => n.id === e.target);
294
- return ep ? `\`${ep.name}\`` : '';
295
- })
296
- .filter(Boolean);
297
-
298
- if (exposed.length > 0) {
299
- lines.push(`- **Exposed APIs**: ${exposed.slice(0, 5).join(', ')}${exposed.length > 5 ? ` (+${exposed.length - 5} more)` : ''}`);
300
- }
301
-
302
- // API calls made
303
- const calls = graph.edges
304
- .filter((e) => e.source === repo.id && e.type === 'CALLS')
305
- .map((e) => {
306
- const ep = graph.nodes.find((n) => n.id === e.target);
307
- return ep ? `\`${ep.name}\` (exposed by \`${ep.id.split(':')[1]}\`)` : '';
308
- })
309
- .filter(Boolean);
310
-
311
- if (calls.length > 0) {
312
- lines.push(`- **Calls Endpoints**: ${calls.join(', ')}`);
313
- }
314
-
315
- lines.push('');
316
- }
317
-
318
- return lines.join('\n');
319
- }
320
-
321
- /**
322
- * Builds the graph, writes `nexusflow-graph.json` and `nexusflow-graph.md` to workspace root.
323
- */
324
- export async function generateWorkspaceGraphFiles(
325
- ctx: WorkspaceContext,
326
- workspacePath: string,
327
- ): Promise<void> {
328
- try {
329
- const graph = await buildWorkspaceGraph(ctx, workspacePath);
330
-
331
- // Write JSON file
332
- const jsonPath = path.join(workspacePath, 'nexusflow-graph.json');
333
- await fs.writeFile(jsonPath, JSON.stringify(graph, null, 2), 'utf-8');
334
-
335
- // Write MD file
336
- const mdPath = path.join(workspacePath, 'nexusflow-graph.md');
337
- const mdContent = generateGraphMarkdownContent(graph);
338
- await fs.writeFile(mdPath, mdContent, 'utf-8');
339
-
340
- console.log(' ✔ Generated Workspace Architecture Graph (nexusflow-graph.json / nexusflow-graph.md)');
341
- } catch (error: any) {
342
- console.error(' ✖ Failed to generate workspace architecture graph:', error.message);
343
- }
344
- }
@@ -1,17 +0,0 @@
1
- import type { StoragePort } from '../ports/storage.js';
2
-
3
- export type { StoragePort, StorageAdapterMeta, AdapterConfigField } from '../ports/storage.js';
4
-
5
- export interface PluginRegistryContext {
6
- /** Registers a custom storage provider/adapter. The provider must include a `meta` property. */
7
- registerStorageProvider(name: string, provider: StoragePort): void;
8
-
9
- /** Registers a custom commander CLI subcommand. */
10
- registerCommand(commandBuilder: (program: any) => void): void;
11
- }
12
-
13
- export interface NexusFlowPlugin {
14
- name: string;
15
- version: string;
16
- register(context: PluginRegistryContext): void | Promise<void>;
17
- }
@@ -1,36 +0,0 @@
1
- import * as path from 'node:path';
2
- import type { PluginRegistryContext, NexusFlowPlugin } from './index.js';
3
- import { registerStorageProvider } from '../adapters/registry.js';
4
-
5
- export async function loadPlugins(program: any, pluginsList: string[]): Promise<void> {
6
- const context: PluginRegistryContext = {
7
- registerStorageProvider(name, provider) {
8
- registerStorageProvider(name, provider);
9
- },
10
- registerCommand(commandBuilder) {
11
- commandBuilder(program);
12
- }
13
- };
14
-
15
- for (const pluginPath of pluginsList) {
16
- try {
17
- let resolvedPath = pluginPath;
18
- if (pluginPath.startsWith('.') || path.isAbsolute(pluginPath)) {
19
- resolvedPath = path.resolve(pluginPath);
20
- }
21
-
22
- // Dynamic import works with file:// URLs on Windows
23
- const fileUrl = resolvedPath.startsWith('file://') ? resolvedPath : `file:///${resolvedPath.replace(/\\/g, '/')}`;
24
- const module = await import(fileUrl);
25
- const plugin: NexusFlowPlugin = module.default || module.plugin;
26
-
27
- if (plugin && typeof plugin.register === 'function') {
28
- await plugin.register(context);
29
- } else {
30
- console.warn(`Warning: Plugin at "${pluginPath}" does not export a valid NexusFlowPlugin.`);
31
- }
32
- } catch (error: any) {
33
- console.error(`Failed to load plugin "${pluginPath}":`, error.message);
34
- }
35
- }
36
- }
@@ -1,71 +0,0 @@
1
- /**
2
- * @module core/ports/storage
3
- * Storage Port defining the interface for workspace document persistence.
4
- *
5
- * Adapters implement this interface to provide different storage backends.
6
- * Each adapter is self-describing via the `meta` property, which enables
7
- * automatic discovery in CLI, GUI, and plugin systems.
8
- */
9
-
10
- /** Describes a single configurable field for an adapter. */
11
- export interface AdapterConfigField {
12
- /** Machine-readable key, stored in config.json. */
13
- key: string;
14
- /** Human-readable label for CLI prompts and GUI forms. */
15
- label: string;
16
- /** Value type — 'path' renders a file picker in the GUI. */
17
- type: 'string' | 'boolean' | 'number' | 'path';
18
- /** Whether the field must be set before the adapter can be used. */
19
- required?: boolean;
20
- /** Default value when not explicitly configured. */
21
- default?: unknown;
22
- /** Help text shown in CLI prompts and GUI tooltips. */
23
- description?: string;
24
- }
25
-
26
- /** Metadata that makes an adapter self-describing and discoverable. */
27
- export interface StorageAdapterMeta {
28
- /** Unique machine-readable identifier (e.g. 'obsidian'). */
29
- name: string;
30
- /** Human-readable name for CLI tables and GUI dropdowns (e.g. 'Obsidian Vault'). */
31
- displayName: string;
32
- /** One-line description of what this adapter does. */
33
- description: string;
34
- /** Configuration fields this adapter accepts. Empty array = no config needed. */
35
- configFields: AdapterConfigField[];
36
- }
37
-
38
- export interface StoragePort {
39
- /** Adapter metadata — who am I, what do I need? */
40
- readonly meta: StorageAdapterMeta;
41
-
42
- /** Called once after registration with the user's per-adapter settings. */
43
- configure?(settings: Record<string, unknown>): void;
44
-
45
- /** Writes a workspace context/metadata document. */
46
- writeWorkspaceFile(workspacePath: string, featureId: string, filename: string, content: string): Promise<void>;
47
-
48
- /** Reads a workspace context/metadata document. */
49
- readWorkspaceFile(workspacePath: string, featureId: string, filename: string): Promise<string>;
50
-
51
- /** Checks if a workspace context/metadata document exists. */
52
- workspaceFileExists(workspacePath: string, featureId: string, filename: string): Promise<boolean>;
53
-
54
- /** Resolves the human-readable path or link to the workspace document for the AI assistant. */
55
- resolveWorkspaceFileUrl(workspacePath: string, featureId: string, filename: string): string;
56
-
57
- /** Writes a base-layer context document (stable maps/conventions across workspaces). */
58
- writeBaseFile(workspacePath: string, repoName: string, filename: string, content: string): Promise<void>;
59
-
60
- /** Reads a base-layer context document. */
61
- readBaseFile(workspacePath: string, repoName: string, filename: string): Promise<string>;
62
-
63
- /** Checks if a base-layer context document exists. */
64
- baseFileExists(workspacePath: string, repoName: string, filename: string): Promise<boolean>;
65
-
66
- /** Resolves the human-readable path or link to the base document. */
67
- resolveBaseFileUrl(workspacePath: string, repoName: string, filename: string): string;
68
-
69
- /** Cleanly deletes all workspace-specific documents from the storage backend. */
70
- deleteWorkspace(workspacePath: string, featureId: string): Promise<void>;
71
- }
@@ -1,61 +0,0 @@
1
- import { describe, it, expect, vi, beforeEach } from 'vitest';
2
- import * as fs from 'node:fs/promises';
3
- import * as path from 'node:path';
4
- import { scanForRepos } from './scanner.js';
5
- import * as gitUtils from '../utils/git.js';
6
-
7
- vi.mock('node:fs/promises');
8
- vi.mock('../utils/git.js');
9
-
10
- describe('scanner core module', () => {
11
- beforeEach(() => {
12
- vi.clearAllMocks();
13
- });
14
-
15
- it('should return repository info if the root dir is a git repo', async () => {
16
- vi.mocked(gitUtils.isGitRepo).mockResolvedValue(true);
17
- vi.mocked(gitUtils.detectDefaultBranch).mockResolvedValue('main');
18
-
19
- const result = await scanForRepos('/mock/dev', 2);
20
-
21
- expect(result).toEqual([
22
- { name: 'dev', path: '/mock/dev', defaultBranch: 'main' }
23
- ]);
24
- expect(gitUtils.isGitRepo).toHaveBeenCalledWith('/mock/dev');
25
- });
26
-
27
- it('should recursively scan subdirectories up to limit and return repos found', async () => {
28
- // Root is not a git repo
29
- vi.mocked(gitUtils.isGitRepo).mockImplementation(async (dir) => {
30
- const normalized = dir.replace(/\\/g, '/');
31
- return normalized === '/mock/dev/repo1' || normalized === '/mock/dev/sub/repo2';
32
- });
33
- vi.mocked(gitUtils.detectDefaultBranch).mockResolvedValue('main');
34
-
35
- // Root directory entries
36
- vi.mocked(fs.readdir).mockImplementation(async (dir: any) => {
37
- const normalized = dir.replace(/\\/g, '/');
38
- if (normalized === '/mock/dev') {
39
- return [
40
- { name: 'repo1', isDirectory: () => true },
41
- { name: 'sub', isDirectory: () => true },
42
- { name: 'ignored_file.txt', isDirectory: () => false },
43
- { name: 'node_modules', isDirectory: () => true },
44
- ] as any[];
45
- }
46
- if (normalized === '/mock/dev/sub') {
47
- return [
48
- { name: 'repo2', isDirectory: () => true },
49
- ] as any[];
50
- }
51
- return [];
52
- });
53
-
54
- const result = await scanForRepos('/mock/dev', 2);
55
-
56
- expect(result).toEqual([
57
- { name: 'repo1', path: path.join('/mock/dev', 'repo1'), defaultBranch: 'main' },
58
- { name: 'repo2', path: path.join('/mock/dev', 'sub', 'repo2'), defaultBranch: 'main' }
59
- ]);
60
- });
61
- });
@@ -1,91 +0,0 @@
1
- /**
2
- * @module core/scanner
3
- * Scans a development directory tree for git repositories.
4
- */
5
-
6
- import * as fs from 'node:fs/promises';
7
- import * as path from 'node:path';
8
-
9
- import type { RepoInfo } from '../types.js';
10
- import { detectDefaultBranch, isGitRepo } from '../utils/git.js';
11
-
12
- /** Directory names to skip while scanning. */
13
- const IGNORED_DIRS = new Set(['node_modules', 'workspaces', '.git']);
14
-
15
- /**
16
- * Recursively scans {@link devDir} for directories containing a `.git`
17
- * entry, up to the given {@link depth}.
18
- *
19
- * Skips `node_modules`, `workspaces`, and `.git` directories to keep
20
- * scans fast and relevant.
21
- *
22
- * @param devDir - Absolute path to the root directory to scan.
23
- * @param depth - Maximum directory depth to descend (0 = only devDir itself).
24
- * @returns An array of discovered {@link RepoInfo} objects.
25
- */
26
- export async function scanForRepos(
27
- devDir: string,
28
- depth: number,
29
- ): Promise<RepoInfo[]> {
30
- const repos: RepoInfo[] = [];
31
- await walk(devDir, depth, repos);
32
- return repos;
33
- }
34
-
35
- /**
36
- * Internal recursive walker.
37
- *
38
- * When a directory is itself a git repo it is recorded and its children are
39
- * **not** descended into (a repo inside a repo is unusual and almost always
40
- * unintentional).
41
- */
42
- async function walk(
43
- dir: string,
44
- remainingDepth: number,
45
- results: RepoInfo[],
46
- ): Promise<void> {
47
- // Check if the current directory is a git repo.
48
- if (await isGitRepo(dir)) {
49
- const defaultBranch = await detectDefaultBranch(dir);
50
- results.push({
51
- name: path.basename(dir),
52
- path: dir,
53
- defaultBranch,
54
- });
55
- // Don't recurse into a repo's subdirectories.
56
- return;
57
- }
58
-
59
- if (remainingDepth <= 0) {
60
- return;
61
- }
62
-
63
- // Read children and recurse.
64
- let entries: import('node:fs').Dirent[];
65
- try {
66
- entries = await fs.readdir(dir, { withFileTypes: true });
67
- } catch {
68
- // Permission denied or directory disappeared — skip silently.
69
- return;
70
- }
71
-
72
- const tasks: Promise<void>[] = [];
73
- for (const entry of entries) {
74
- if (!entry.isDirectory()) {
75
- continue;
76
- }
77
-
78
- if (IGNORED_DIRS.has(entry.name)) {
79
- continue;
80
- }
81
-
82
- // Skip hidden directories (except we already handle .git above).
83
- if (entry.name.startsWith('.')) {
84
- continue;
85
- }
86
-
87
- tasks.push(walk(path.join(dir, entry.name), remainingDepth - 1, results));
88
- }
89
-
90
- await Promise.all(tasks);
91
- }
@@ -1,37 +0,0 @@
1
- import { getActiveStorageProvider } from './adapters/registry.js';
2
-
3
- export async function writeWorkspaceFile(workspacePath: string, featureId: string, filename: string, content: string): Promise<void> {
4
- await getActiveStorageProvider().writeWorkspaceFile(workspacePath, featureId, filename, content);
5
- }
6
-
7
- export async function readWorkspaceFile(workspacePath: string, featureId: string, filename: string): Promise<string> {
8
- return await getActiveStorageProvider().readWorkspaceFile(workspacePath, featureId, filename);
9
- }
10
-
11
- export async function workspaceFileExists(workspacePath: string, featureId: string, filename: string): Promise<boolean> {
12
- return await getActiveStorageProvider().workspaceFileExists(workspacePath, featureId, filename);
13
- }
14
-
15
- export function resolveWorkspaceFileUrl(workspacePath: string, featureId: string, filename: string): string {
16
- return getActiveStorageProvider().resolveWorkspaceFileUrl(workspacePath, featureId, filename);
17
- }
18
-
19
- export async function writeBaseFile(workspacePath: string, repoName: string, filename: string, content: string): Promise<void> {
20
- await getActiveStorageProvider().writeBaseFile(workspacePath, repoName, filename, content);
21
- }
22
-
23
- export async function readBaseFile(workspacePath: string, repoName: string, filename: string): Promise<string> {
24
- return await getActiveStorageProvider().readBaseFile(workspacePath, repoName, filename);
25
- }
26
-
27
- export async function baseFileExists(workspacePath: string, repoName: string, filename: string): Promise<boolean> {
28
- return await getActiveStorageProvider().baseFileExists(workspacePath, repoName, filename);
29
- }
30
-
31
- export function resolveBaseFileUrl(workspacePath: string, repoName: string, filename: string): string {
32
- return getActiveStorageProvider().resolveBaseFileUrl(workspacePath, repoName, filename);
33
- }
34
-
35
- export async function deleteWorkspaceFiles(workspacePath: string, featureId: string): Promise<void> {
36
- await getActiveStorageProvider().deleteWorkspace(workspacePath, featureId);
37
- }