@mrpatronz/nexusflow 0.2.18 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (236) hide show
  1. package/README.md +27 -3
  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/commands.test.js +20 -6
  7. package/dist/commands/commands.test.js.map +1 -1
  8. package/dist/commands/commit.d.ts +2 -0
  9. package/dist/commands/commit.d.ts.map +1 -1
  10. package/dist/commands/commit.js +27 -5
  11. package/dist/commands/commit.js.map +1 -1
  12. package/dist/commands/diff.d.ts +9 -2
  13. package/dist/commands/diff.d.ts.map +1 -1
  14. package/dist/commands/diff.js +36 -12
  15. package/dist/commands/diff.js.map +1 -1
  16. package/dist/commands/doctor.js +2 -2
  17. package/dist/commands/doctor.js.map +1 -1
  18. package/dist/commands/handoff.js +2 -2
  19. package/dist/commands/handoff.js.map +1 -1
  20. package/dist/commands/refresh.d.ts +4 -2
  21. package/dist/commands/refresh.d.ts.map +1 -1
  22. package/dist/commands/refresh.js +20 -36
  23. package/dist/commands/refresh.js.map +1 -1
  24. package/dist/commands/schedule.d.ts +35 -0
  25. package/dist/commands/schedule.d.ts.map +1 -0
  26. package/dist/commands/schedule.js +151 -0
  27. package/dist/commands/schedule.js.map +1 -0
  28. package/dist/commands/sync.d.ts.map +1 -1
  29. package/dist/commands/sync.js +58 -50
  30. package/dist/commands/sync.js.map +1 -1
  31. package/dist/core/analysis-cache.d.ts +58 -0
  32. package/dist/core/analysis-cache.d.ts.map +1 -0
  33. package/dist/core/analysis-cache.js +116 -0
  34. package/dist/core/analysis-cache.js.map +1 -0
  35. package/dist/core/analysis-cache.test.d.ts +2 -0
  36. package/dist/core/analysis-cache.test.d.ts.map +1 -0
  37. package/dist/core/analysis-cache.test.js +108 -0
  38. package/dist/core/analysis-cache.test.js.map +1 -0
  39. package/dist/core/refresh.d.ts +41 -0
  40. package/dist/core/refresh.d.ts.map +1 -0
  41. package/dist/core/refresh.js +60 -0
  42. package/dist/core/refresh.js.map +1 -0
  43. package/dist/core/scheduler.d.ts +117 -0
  44. package/dist/core/scheduler.d.ts.map +1 -0
  45. package/dist/core/scheduler.js +247 -0
  46. package/dist/core/scheduler.js.map +1 -0
  47. package/dist/core/scheduler.test.d.ts +2 -0
  48. package/dist/core/scheduler.test.d.ts.map +1 -0
  49. package/dist/core/scheduler.test.js +111 -0
  50. package/dist/core/scheduler.test.js.map +1 -0
  51. package/dist/core/sync.d.ts +50 -0
  52. package/dist/core/sync.d.ts.map +1 -0
  53. package/dist/core/sync.js +92 -0
  54. package/dist/core/sync.js.map +1 -0
  55. package/dist/core/workspace-state.d.ts +51 -0
  56. package/dist/core/workspace-state.d.ts.map +1 -0
  57. package/dist/core/workspace-state.js +108 -0
  58. package/dist/core/workspace-state.js.map +1 -0
  59. package/dist/core/workspace-state.test.d.ts +2 -0
  60. package/dist/core/workspace-state.test.d.ts.map +1 -0
  61. package/dist/core/workspace-state.test.js +84 -0
  62. package/dist/core/workspace-state.test.js.map +1 -0
  63. package/dist/generators/index.d.ts +7 -1
  64. package/dist/generators/index.d.ts.map +1 -1
  65. package/dist/generators/index.js +14 -1
  66. package/dist/generators/index.js.map +1 -1
  67. package/dist/gui/assets/index-Bdbld6yY.css +1 -0
  68. package/dist/gui/assets/index-D8iJPvnk.js +26 -0
  69. package/dist/gui/index.html +2 -2
  70. package/dist/index.js +107 -4
  71. package/dist/index.js.map +1 -1
  72. package/dist/mcp/server.d.ts.map +1 -1
  73. package/dist/mcp/server.js +42 -0
  74. package/dist/mcp/server.js.map +1 -1
  75. package/dist/server.d.ts.map +1 -1
  76. package/dist/server.js +175 -13
  77. package/dist/server.js.map +1 -1
  78. package/dist/server.test.js +66 -0
  79. package/dist/server.test.js.map +1 -1
  80. package/dist/types.d.ts +31 -0
  81. package/dist/types.d.ts.map +1 -1
  82. package/dist/utils/multi-git.d.ts +54 -8
  83. package/dist/utils/multi-git.d.ts.map +1 -1
  84. package/dist/utils/multi-git.js +129 -21
  85. package/dist/utils/multi-git.js.map +1 -1
  86. package/dist/utils/multi-git.test.d.ts +2 -0
  87. package/dist/utils/multi-git.test.d.ts.map +1 -0
  88. package/dist/utils/multi-git.test.js +125 -0
  89. package/dist/utils/multi-git.test.js.map +1 -0
  90. package/package.json +13 -1
  91. package/.agents/skills/ccc/SKILL.md +0 -71
  92. package/.agents/skills/ccc/references/management.md +0 -110
  93. package/.agents/skills/ccc/references/settings.md +0 -126
  94. package/.github/dependabot.yml +0 -52
  95. package/.github/workflows/ci.yml +0 -44
  96. package/.github/workflows/dependabot-merge.yml +0 -53
  97. package/.github/workflows/release-desktop.yml +0 -67
  98. package/.github/workflows/release-npm.yml +0 -65
  99. package/.github/workflows/release-vscode.yml +0 -61
  100. package/.vscode/launch.json +0 -17
  101. package/.vscode/tasks.json +0 -17
  102. package/GETTING_STARTED.md +0 -114
  103. package/desktop/build-installer.js +0 -228
  104. package/desktop/build.js +0 -118
  105. package/desktop/installer/nexusflow.iss +0 -35
  106. package/desktop/neutralino.config.json +0 -39
  107. package/desktop/package-lock.json +0 -1060
  108. package/desktop/package.json +0 -14
  109. package/dist/gui/assets/index-CB-jWded.css +0 -1
  110. package/dist/gui/assets/index-DDXpZZu3.js +0 -25
  111. package/extension/media/icon.svg +0 -1
  112. package/extension/package-lock.json +0 -6044
  113. package/extension/package.json +0 -117
  114. package/extension/src/extension.ts +0 -653
  115. package/extension/tsconfig.json +0 -21
  116. package/gui/README.md +0 -73
  117. package/gui/e2e/wizard.spec.ts +0 -346
  118. package/gui/eslint.config.js +0 -26
  119. package/gui/index.html +0 -17
  120. package/gui/package-lock.json +0 -3079
  121. package/gui/package.json +0 -36
  122. package/gui/playwright.config.ts +0 -41
  123. package/gui/public/app_logo.png +0 -0
  124. package/gui/public/favicon.svg +0 -1
  125. package/gui/public/icons.svg +0 -24
  126. package/gui/src/App.css +0 -1
  127. package/gui/src/App.tsx +0 -3632
  128. package/gui/src/assets/hero.png +0 -0
  129. package/gui/src/assets/react.svg +0 -1
  130. package/gui/src/assets/vite.svg +0 -1
  131. package/gui/src/features/changes/ChangesViewer.tsx +0 -388
  132. package/gui/src/features/knowledge/KnowledgeBase.tsx +0 -84
  133. package/gui/src/features/onboarding/OnboardingWizard.tsx +0 -230
  134. package/gui/src/features/plan/ImplementationPlan.tsx +0 -32
  135. package/gui/src/features/services/ServiceConsole.tsx +0 -250
  136. package/gui/src/features/sessions/SessionHistory.tsx +0 -195
  137. package/gui/src/features/workspace/WorkspaceList.tsx +0 -666
  138. package/gui/src/index.css +0 -152
  139. package/gui/src/main.tsx +0 -94
  140. package/gui/src/types.ts +0 -62
  141. package/gui/tsconfig.app.json +0 -25
  142. package/gui/tsconfig.json +0 -7
  143. package/gui/tsconfig.node.json +0 -24
  144. package/gui/vite.config.ts +0 -12
  145. package/resources/workflows/plan-implement-review.md +0 -8
  146. package/resources/workflows/research-verify.md +0 -6
  147. package/resources/workflows/solo-developer.md +0 -3
  148. package/scripts/simulate-workspaces.ts +0 -55
  149. package/skills-lock.json +0 -11
  150. package/src/analyzers/detect-apis.ts +0 -290
  151. package/src/analyzers/detect-deps.ts +0 -315
  152. package/src/analyzers/detect-existing.ts +0 -74
  153. package/src/analyzers/detect-ports.ts +0 -110
  154. package/src/analyzers/index.ts +0 -97
  155. package/src/analyzers/messaging-analyzer.ts +0 -254
  156. package/src/analyzers/readme-summarizer.ts +0 -102
  157. package/src/analyzers/run-analyzer.ts +0 -269
  158. package/src/analyzers/tech-stack.ts +0 -283
  159. package/src/commands/adapter.ts +0 -348
  160. package/src/commands/add-repo.ts +0 -156
  161. package/src/commands/commands.test.ts +0 -156
  162. package/src/commands/commit.ts +0 -131
  163. package/src/commands/config.ts +0 -52
  164. package/src/commands/create.ts +0 -204
  165. package/src/commands/desktop.ts +0 -128
  166. package/src/commands/diff.ts +0 -125
  167. package/src/commands/doctor.ts +0 -370
  168. package/src/commands/handoff.ts +0 -266
  169. package/src/commands/init.ts +0 -134
  170. package/src/commands/list.ts +0 -46
  171. package/src/commands/logs.ts +0 -63
  172. package/src/commands/mcp.ts +0 -94
  173. package/src/commands/open.ts +0 -129
  174. package/src/commands/refresh.ts +0 -137
  175. package/src/commands/remove.ts +0 -98
  176. package/src/commands/start.ts +0 -117
  177. package/src/commands/status.ts +0 -54
  178. package/src/commands/stop.ts +0 -55
  179. package/src/commands/sync.ts +0 -147
  180. package/src/commands/tui.ts +0 -484
  181. package/src/commands/ui.ts +0 -111
  182. package/src/core/adapters/local-storage.ts +0 -66
  183. package/src/core/adapters/obsidian-storage.ts +0 -151
  184. package/src/core/adapters/registry.ts +0 -44
  185. package/src/core/adapters/storage.test.ts +0 -174
  186. package/src/core/adapters/vault-storage.ts +0 -86
  187. package/src/core/config.test.ts +0 -96
  188. package/src/core/config.ts +0 -140
  189. package/src/core/graph.ts +0 -344
  190. package/src/core/plugins/index.ts +0 -17
  191. package/src/core/plugins/loader.ts +0 -36
  192. package/src/core/ports/storage.ts +0 -71
  193. package/src/core/scanner.test.ts +0 -61
  194. package/src/core/scanner.ts +0 -91
  195. package/src/core/storage.ts +0 -37
  196. package/src/core/workspace.ts +0 -487
  197. package/src/core/worktree.ts +0 -120
  198. package/src/generators/antigravity.ts +0 -32
  199. package/src/generators/base.ts +0 -243
  200. package/src/generators/claude.ts +0 -34
  201. package/src/generators/codex.ts +0 -48
  202. package/src/generators/copilot.ts +0 -56
  203. package/src/generators/cursor.ts +0 -44
  204. package/src/generators/diff-context.ts +0 -75
  205. package/src/generators/index.ts +0 -322
  206. package/src/generators/map-generator.test.ts +0 -159
  207. package/src/generators/map-generator.ts +0 -539
  208. package/src/generators/plan-generator.ts +0 -483
  209. package/src/generators/skills-generator.ts +0 -259
  210. package/src/index.ts +0 -539
  211. package/src/mcp/server.ts +0 -294
  212. package/src/orchestration/detect.ts +0 -313
  213. package/src/orchestration/index.ts +0 -7
  214. package/src/orchestration/runner.ts +0 -283
  215. package/src/server.test.ts +0 -618
  216. package/src/server.ts +0 -1314
  217. package/src/types.ts +0 -415
  218. package/src/utils/detect-ai.test.ts +0 -44
  219. package/src/utils/detect-ai.ts +0 -84
  220. package/src/utils/detect-editors.test.ts +0 -48
  221. package/src/utils/detect-editors.ts +0 -57
  222. package/src/utils/git.test.ts +0 -74
  223. package/src/utils/git.ts +0 -117
  224. package/src/utils/local-ai.test.ts +0 -130
  225. package/src/utils/local-ai.ts +0 -116
  226. package/src/utils/multi-git.ts +0 -313
  227. package/src/utils/prompts.ts +0 -209
  228. package/src/utils/session-finder.ts +0 -483
  229. package/src/utils/system-scanner.test.ts +0 -89
  230. package/src/utils/system-scanner.ts +0 -96
  231. package/src/utils/update-check.ts +0 -286
  232. package/src/utils/workflow-advisor.ts +0 -118
  233. package/src/utils/workflows.test.ts +0 -114
  234. package/src/utils/workflows.ts +0 -178
  235. package/tsconfig.json +0 -19
  236. 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
- }