@mrpatronz/nexusflow 0.1.4 → 0.1.6
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/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +26 -0
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/open.d.ts.map +1 -1
- package/dist/commands/open.js +27 -1
- package/dist/commands/open.js.map +1 -1
- package/dist/commands/pack.d.ts +7 -0
- package/dist/commands/pack.d.ts.map +1 -0
- package/dist/commands/pack.js +64 -0
- package/dist/commands/pack.js.map +1 -0
- package/dist/core/graph.d.ts +35 -0
- package/dist/core/graph.d.ts.map +1 -0
- package/dist/core/graph.js +281 -0
- package/dist/core/graph.js.map +1 -0
- package/dist/core/packer.d.ts +13 -0
- package/dist/core/packer.d.ts.map +1 -0
- package/dist/core/packer.js +84 -0
- package/dist/core/packer.js.map +1 -0
- package/dist/core/worktree.d.ts.map +1 -1
- package/dist/core/worktree.js +36 -2
- package/dist/core/worktree.js.map +1 -1
- package/dist/generators/index.d.ts.map +1 -1
- package/dist/generators/index.js +9 -0
- package/dist/generators/index.js.map +1 -1
- package/dist/gui/assets/index-io0N2VQx.js +21 -0
- package/dist/gui/index.html +1 -1
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +125 -0
- package/dist/mcp/server.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +22 -0
- package/dist/server.js.map +1 -1
- package/dist/utils/update-check.js +1 -1
- package/gui/src/App.tsx +21 -1
- package/package.json +3 -2
- package/src/commands/create.ts +29 -0
- package/src/commands/open.ts +29 -1
- package/src/commands/pack.ts +73 -0
- package/src/core/graph.ts +345 -0
- package/src/core/packer.ts +107 -0
- package/src/core/worktree.ts +42 -6
- package/src/generators/index.ts +12 -0
- package/src/index.ts +19 -0
- package/src/mcp/server.ts +131 -0
- package/src/server.ts +25 -0
- package/src/utils/update-check.ts +1 -1
- package/dist/gui/assets/index-DDn7UKEM.js +0 -21
package/src/mcp/server.ts
CHANGED
|
@@ -66,6 +66,42 @@ export async function startMcpServer(workspacePath?: string) {
|
|
|
66
66
|
required: ['serviceName'],
|
|
67
67
|
},
|
|
68
68
|
},
|
|
69
|
+
{
|
|
70
|
+
name: 'get_workspace_graph',
|
|
71
|
+
description: 'Retrieve the structural architecture graph of the NexusFlow workspace. Contains nodes for repos, packages, API endpoints, and exposed ports, plus relation edges (CONTAINS, DEPENDS_ON, EXPOSES, CALLS). Highly token-efficient for global workspace context.',
|
|
72
|
+
inputSchema: {
|
|
73
|
+
type: 'object',
|
|
74
|
+
properties: {
|
|
75
|
+
workspaceId: {
|
|
76
|
+
type: 'string',
|
|
77
|
+
description: 'Optional ID/branchName of the workspace. If omitted, uses the currently active workspace.',
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: 'query_workspace_graph',
|
|
84
|
+
description: 'Query the workspace architecture graph by filtering nodes or edges (e.g., node types like "repo", "package", "endpoint", "port", or edge types like "DEPENDS_ON", "EXPOSES", "CALLS"). Reduces token payload by fetching specific architectural paths.',
|
|
85
|
+
inputSchema: {
|
|
86
|
+
type: 'object',
|
|
87
|
+
properties: {
|
|
88
|
+
nodeType: {
|
|
89
|
+
type: 'string',
|
|
90
|
+
enum: ['repo', 'package', 'endpoint', 'port'],
|
|
91
|
+
description: 'Optional node type to filter.',
|
|
92
|
+
},
|
|
93
|
+
edgeType: {
|
|
94
|
+
type: 'string',
|
|
95
|
+
enum: ['DEPENDS_ON', 'EXPOSES', 'CALLS'],
|
|
96
|
+
description: 'Optional edge/relation type to filter.',
|
|
97
|
+
},
|
|
98
|
+
workspaceId: {
|
|
99
|
+
type: 'string',
|
|
100
|
+
description: 'Optional ID/branchName of the workspace. If omitted, uses the currently active workspace.',
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
},
|
|
69
105
|
],
|
|
70
106
|
};
|
|
71
107
|
});
|
|
@@ -179,6 +215,101 @@ export async function startMcpServer(workspacePath?: string) {
|
|
|
179
215
|
}
|
|
180
216
|
}
|
|
181
217
|
|
|
218
|
+
if (name === 'get_workspace_graph') {
|
|
219
|
+
try {
|
|
220
|
+
const graphPath = path.join(resolvedWorkspacePath, 'nexusflow-graph.json');
|
|
221
|
+
|
|
222
|
+
try {
|
|
223
|
+
await fs.access(graphPath);
|
|
224
|
+
} catch {
|
|
225
|
+
return {
|
|
226
|
+
content: [
|
|
227
|
+
{
|
|
228
|
+
type: 'text',
|
|
229
|
+
text: `Workspace graph file not found at ${graphPath}. Run "nexusflow sync" or rebuild the workspace to generate it.`,
|
|
230
|
+
},
|
|
231
|
+
],
|
|
232
|
+
isError: true,
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
const content = await fs.readFile(graphPath, 'utf8');
|
|
237
|
+
return {
|
|
238
|
+
content: [
|
|
239
|
+
{
|
|
240
|
+
type: 'text',
|
|
241
|
+
text: content,
|
|
242
|
+
},
|
|
243
|
+
],
|
|
244
|
+
};
|
|
245
|
+
} catch (error: any) {
|
|
246
|
+
return {
|
|
247
|
+
content: [
|
|
248
|
+
{
|
|
249
|
+
type: 'text',
|
|
250
|
+
text: `Error reading workspace graph: ${error.message}`,
|
|
251
|
+
},
|
|
252
|
+
],
|
|
253
|
+
isError: true,
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
if (name === 'query_workspace_graph') {
|
|
259
|
+
const nodeType = (args as any).nodeType;
|
|
260
|
+
const edgeType = (args as any).edgeType;
|
|
261
|
+
|
|
262
|
+
try {
|
|
263
|
+
const graphPath = path.join(resolvedWorkspacePath, 'nexusflow-graph.json');
|
|
264
|
+
|
|
265
|
+
try {
|
|
266
|
+
await fs.access(graphPath);
|
|
267
|
+
} catch {
|
|
268
|
+
return {
|
|
269
|
+
content: [
|
|
270
|
+
{
|
|
271
|
+
type: 'text',
|
|
272
|
+
text: `Workspace graph file not found at ${graphPath}. Run "nexusflow sync" or rebuild the workspace to generate it.`,
|
|
273
|
+
},
|
|
274
|
+
],
|
|
275
|
+
isError: true,
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
const content = await fs.readFile(graphPath, 'utf8');
|
|
280
|
+
const graph = JSON.parse(content);
|
|
281
|
+
|
|
282
|
+
let nodes = graph.nodes;
|
|
283
|
+
let edges = graph.edges;
|
|
284
|
+
|
|
285
|
+
if (nodeType) {
|
|
286
|
+
nodes = nodes.filter((n: any) => n.type === nodeType);
|
|
287
|
+
}
|
|
288
|
+
if (edgeType) {
|
|
289
|
+
edges = edges.filter((e: any) => e.type === edgeType);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
return {
|
|
293
|
+
content: [
|
|
294
|
+
{
|
|
295
|
+
type: 'text',
|
|
296
|
+
text: JSON.stringify({ nodes, edges }, null, 2),
|
|
297
|
+
},
|
|
298
|
+
],
|
|
299
|
+
};
|
|
300
|
+
} catch (error: any) {
|
|
301
|
+
return {
|
|
302
|
+
content: [
|
|
303
|
+
{
|
|
304
|
+
type: 'text',
|
|
305
|
+
text: `Error querying workspace graph: ${error.message}`,
|
|
306
|
+
},
|
|
307
|
+
],
|
|
308
|
+
isError: true,
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
182
313
|
throw new Error(`Tool not found: ${name}`);
|
|
183
314
|
});
|
|
184
315
|
|
package/src/server.ts
CHANGED
|
@@ -17,6 +17,7 @@ import { scanForRepos } from './core/scanner.js';
|
|
|
17
17
|
import { createWorkspace, listWorkspaces, loadFeatureConfig } from './core/workspace.js';
|
|
18
18
|
import { analyzeAllRepos } from './analyzers/index.js';
|
|
19
19
|
import { generateContextFiles } from './generators/index.js';
|
|
20
|
+
import { packWorkspace } from './core/packer.js';
|
|
20
21
|
import { detectAIAssistants } from './utils/detect-ai.js';
|
|
21
22
|
import { detectEditors } from './utils/detect-editors.js';
|
|
22
23
|
import { findSessions, getSessionTranscript } from './utils/session-finder.js';
|
|
@@ -606,6 +607,30 @@ app.get('/api/update-status', async (c) => {
|
|
|
606
607
|
}
|
|
607
608
|
});
|
|
608
609
|
|
|
610
|
+
// 18. Pack workspace codebase and download
|
|
611
|
+
app.get('/api/workspace/:id/pack', async (c) => {
|
|
612
|
+
try {
|
|
613
|
+
const id = decodeURIComponent(c.req.param('id'));
|
|
614
|
+
const config = await loadConfig();
|
|
615
|
+
const workspacePath = path.join(config.workspacesDir, id);
|
|
616
|
+
|
|
617
|
+
const feature = await loadFeatureConfig(workspacePath);
|
|
618
|
+
if (!feature) {
|
|
619
|
+
return c.json({ error: 'Workspace configuration not found.' }, 404);
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
const result = await packWorkspace(workspacePath);
|
|
623
|
+
const content = await fs.readFile(result.outputPath, 'utf-8');
|
|
624
|
+
|
|
625
|
+
c.header('Content-Disposition', `attachment; filename="nexusflow-context-${id.replace(/[\/\\ ]/g, '-')}.xml"`);
|
|
626
|
+
c.header('Content-Type', 'application/xml');
|
|
627
|
+
return c.text(content);
|
|
628
|
+
} catch (error) {
|
|
629
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
630
|
+
return c.json({ error: msg }, 500);
|
|
631
|
+
}
|
|
632
|
+
});
|
|
633
|
+
|
|
609
634
|
// Serve index.html explicitly on root endpoint
|
|
610
635
|
app.get('/', async (c) => {
|
|
611
636
|
try {
|