@mrpatronz/nexusflow 0.2.0 → 0.2.2
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/analyzers/index.d.ts +2 -0
- package/dist/analyzers/index.d.ts.map +1 -1
- package/dist/analyzers/index.js +9 -1
- package/dist/analyzers/index.js.map +1 -1
- package/dist/analyzers/messaging-analyzer.d.ts +17 -0
- package/dist/analyzers/messaging-analyzer.d.ts.map +1 -0
- package/dist/analyzers/messaging-analyzer.js +229 -0
- package/dist/analyzers/messaging-analyzer.js.map +1 -0
- package/dist/analyzers/readme-summarizer.d.ts.map +1 -1
- package/dist/analyzers/readme-summarizer.js +8 -4
- package/dist/analyzers/readme-summarizer.js.map +1 -1
- package/dist/analyzers/run-analyzer.d.ts +15 -0
- package/dist/analyzers/run-analyzer.d.ts.map +1 -0
- package/dist/analyzers/run-analyzer.js +246 -0
- package/dist/analyzers/run-analyzer.js.map +1 -0
- package/dist/core/config.js +1 -1
- package/dist/core/config.js.map +1 -1
- package/dist/generators/base.d.ts.map +1 -1
- package/dist/generators/base.js +18 -57
- package/dist/generators/base.js.map +1 -1
- package/dist/generators/index.d.ts.map +1 -1
- package/dist/generators/index.js +30 -14
- package/dist/generators/index.js.map +1 -1
- package/dist/generators/map-generator.d.ts +1 -1
- package/dist/generators/map-generator.d.ts.map +1 -1
- package/dist/generators/map-generator.js +157 -54
- package/dist/generators/map-generator.js.map +1 -1
- package/dist/generators/map-generator.test.js +71 -0
- package/dist/generators/map-generator.test.js.map +1 -1
- package/dist/generators/plan-generator.d.ts +2 -2
- package/dist/generators/plan-generator.d.ts.map +1 -1
- package/dist/generators/plan-generator.js +47 -67
- package/dist/generators/plan-generator.js.map +1 -1
- package/dist/generators/skills-generator.d.ts +15 -0
- package/dist/generators/skills-generator.d.ts.map +1 -0
- package/dist/generators/skills-generator.js +225 -0
- package/dist/generators/skills-generator.js.map +1 -0
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +16 -85
- package/dist/mcp/server.js.map +1 -1
- package/dist/server.d.ts +0 -5
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +9 -6
- package/dist/server.js.map +1 -1
- package/dist/types.d.ts +46 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/analyzers/index.ts +9 -1
- package/src/analyzers/messaging-analyzer.ts +254 -0
- package/src/analyzers/readme-summarizer.ts +9 -4
- package/src/analyzers/run-analyzer.ts +269 -0
- package/src/core/config.ts +1 -1
- package/src/generators/base.ts +19 -56
- package/src/generators/index.ts +32 -14
- package/src/generators/map-generator.test.ts +78 -0
- package/src/generators/map-generator.ts +164 -53
- package/src/generators/plan-generator.ts +53 -75
- package/src/generators/skills-generator.ts +255 -0
- package/src/mcp/server.ts +16 -89
- package/src/server.ts +9 -6
- package/src/types.ts +54 -0
|
@@ -15,22 +15,11 @@ import type {
|
|
|
15
15
|
DependencyGraph,
|
|
16
16
|
} from '../types.js';
|
|
17
17
|
|
|
18
|
-
// ─── Constants ────────────────────────────────────────────────────────────
|
|
19
|
-
|
|
20
|
-
/** Repo-name substrings that signal a shared/foundation package. */
|
|
21
|
-
const SHARED_PACKAGE_KEYWORDS = ['shared', 'common', 'contracts', 'types'];
|
|
22
|
-
|
|
23
|
-
/** Project types that act as backend producers. */
|
|
24
|
-
const BACKEND_TYPES = ['api', 'backend', 'service'];
|
|
25
|
-
|
|
26
|
-
/** Project types that act as frontend consumers. */
|
|
27
|
-
const FRONTEND_TYPES = ['frontend', 'webapp', 'app'];
|
|
28
|
-
|
|
29
18
|
// ─── Dependency Graph Builder ─────────────────────────────────────────────
|
|
30
19
|
|
|
31
20
|
/**
|
|
32
|
-
* Build a dependency graph by analysing package dependencies
|
|
33
|
-
*
|
|
21
|
+
* Build a dependency graph by analysing package dependencies
|
|
22
|
+
* across the workspace repos.
|
|
34
23
|
*
|
|
35
24
|
* @param analysis Per-repo analysis results, keyed by repo path.
|
|
36
25
|
* @param repos Metadata for every repo in the workspace.
|
|
@@ -88,67 +77,16 @@ export function buildDependencyGraph(
|
|
|
88
77
|
for (const dep of a.dependencies) {
|
|
89
78
|
const depNameLower = dep.name.toLowerCase();
|
|
90
79
|
|
|
91
|
-
//
|
|
80
|
+
// Direct match with a produced package
|
|
92
81
|
if (packageToRepo.has(depNameLower)) {
|
|
93
82
|
const targetRepo = packageToRepo.get(depNameLower)!;
|
|
94
83
|
if (targetRepo !== repo.name) {
|
|
95
84
|
addEdge(graph, repo.name, targetRepo);
|
|
96
85
|
}
|
|
97
|
-
} else {
|
|
98
|
-
// 2. Check if the dependency contains or is contained by a produced package name
|
|
99
|
-
for (const [prodPkg, targetRepo] of packageToRepo) {
|
|
100
|
-
if (targetRepo === repo.name) continue;
|
|
101
|
-
if (depNameLower.includes(prodPkg) || prodPkg.includes(depNameLower)) {
|
|
102
|
-
addEdge(graph, repo.name, targetRepo);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// ── 2. API relationships (frontend → backend heuristic) ─────────────
|
|
110
|
-
for (const repoA of repos) {
|
|
111
|
-
const analysisA = analysisByName.get(repoA.name);
|
|
112
|
-
if (!analysisA) continue;
|
|
113
|
-
|
|
114
|
-
const typeA = analysisA.techStack.projectType;
|
|
115
|
-
|
|
116
|
-
if (!BACKEND_TYPES.includes(typeA)) continue;
|
|
117
|
-
|
|
118
|
-
for (const repoB of repos) {
|
|
119
|
-
if (repoB.name === repoA.name) continue;
|
|
120
|
-
|
|
121
|
-
const analysisB = analysisByName.get(repoB.name);
|
|
122
|
-
if (!analysisB) continue;
|
|
123
|
-
|
|
124
|
-
const typeB = analysisB.techStack.projectType;
|
|
125
|
-
if (FRONTEND_TYPES.includes(typeB)) {
|
|
126
|
-
// B (frontend) depends on A (backend)
|
|
127
|
-
addEdge(graph, repoB.name, repoA.name);
|
|
128
86
|
}
|
|
129
87
|
}
|
|
130
88
|
}
|
|
131
89
|
|
|
132
|
-
// ── 3. Shared-type packages are always foundation ───────────────────
|
|
133
|
-
for (const repo of repos) {
|
|
134
|
-
const isShared = SHARED_PACKAGE_KEYWORDS.some((kw) =>
|
|
135
|
-
repo.name.toLowerCase().includes(kw),
|
|
136
|
-
);
|
|
137
|
-
if (!isShared) continue;
|
|
138
|
-
|
|
139
|
-
const node = graph.get(repo.name);
|
|
140
|
-
if (!node) continue;
|
|
141
|
-
|
|
142
|
-
// Ensure no outgoing deps (it's a leaf producer)
|
|
143
|
-
node.dependsOn = [];
|
|
144
|
-
|
|
145
|
-
// Every other repo that doesn't already depend on it — add edge
|
|
146
|
-
for (const other of repos) {
|
|
147
|
-
if (other.name === repo.name) continue;
|
|
148
|
-
addEdge(graph, other.name, repo.name);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
90
|
return graph;
|
|
153
91
|
}
|
|
154
92
|
|
|
@@ -297,25 +235,19 @@ export async function generateImplementationPlan(
|
|
|
297
235
|
|
|
298
236
|
md.push('```');
|
|
299
237
|
md.push('');
|
|
238
|
+
md.push('> ⚠️ This diagram is derived from detected package dependencies (`package.json`, `.csproj`, etc.) only.');
|
|
239
|
+
md.push('> If you changed a package, the producing repo must release/build before consumer repos can merge.');
|
|
240
|
+
md.push('');
|
|
300
241
|
|
|
301
242
|
// ── Phase descriptions ──────────────────────────────────────────────
|
|
302
243
|
md.push('## Suggested Implementation Order');
|
|
303
244
|
md.push('');
|
|
304
245
|
|
|
305
|
-
const phaseLabels = [
|
|
306
|
-
'Foundation',
|
|
307
|
-
'Core Services',
|
|
308
|
-
'Integration Layer',
|
|
309
|
-
'Consumers',
|
|
310
|
-
'Final',
|
|
311
|
-
];
|
|
312
|
-
|
|
313
246
|
for (let i = 0; i < phases.length; i++) {
|
|
314
247
|
const phase = phases[i];
|
|
315
|
-
const label = phaseLabels[Math.min(i, phaseLabels.length - 1)];
|
|
316
248
|
const ordinal = ordinalWord(i + 1);
|
|
317
249
|
|
|
318
|
-
md.push(`### Phase ${i + 1}
|
|
250
|
+
md.push(`### Phase ${i + 1}`);
|
|
319
251
|
md.push('');
|
|
320
252
|
md.push(`**Repos:** ${phase.join(', ')}`);
|
|
321
253
|
md.push('');
|
|
@@ -421,6 +353,52 @@ export async function generateImplementationPlan(
|
|
|
421
353
|
}
|
|
422
354
|
md.push('');
|
|
423
355
|
|
|
356
|
+
// ── Cross-Repo Messaging Roll-up ────────────────────────────────────
|
|
357
|
+
md.push('## 📨 Cross-Repo Messaging');
|
|
358
|
+
md.push('');
|
|
359
|
+
md.push('| Publisher Repo | Message | → Subscriber Repo | Handler |');
|
|
360
|
+
md.push('|---|---|---|---|');
|
|
361
|
+
|
|
362
|
+
interface CrossRepoMessage {
|
|
363
|
+
pubRepo: string;
|
|
364
|
+
message: string;
|
|
365
|
+
subRepo: string;
|
|
366
|
+
handler: string;
|
|
367
|
+
}
|
|
368
|
+
const crossRepoMessages: CrossRepoMessage[] = [];
|
|
369
|
+
|
|
370
|
+
for (const [pubPath, pubA] of analysis) {
|
|
371
|
+
if (!pubA.messaging || !pubA.messaging.publishers) continue;
|
|
372
|
+
for (const pub of pubA.messaging.publishers) {
|
|
373
|
+
// Find subscribers in other repos matching this contract type
|
|
374
|
+
for (const [subPath, subA] of analysis) {
|
|
375
|
+
if (subPath === pubPath) continue;
|
|
376
|
+
if (!subA.messaging || !subA.messaging.subscribers) continue;
|
|
377
|
+
for (const sub of subA.messaging.subscribers) {
|
|
378
|
+
const pubContract = pub.contractType.toLowerCase().trim();
|
|
379
|
+
const subContract = sub.contractType.toLowerCase().trim();
|
|
380
|
+
if (pubContract === subContract && pubContract !== 'goservicebusmessage' && pubContract !== 'servicebusmessage') {
|
|
381
|
+
crossRepoMessages.push({
|
|
382
|
+
pubRepo: pubA.name,
|
|
383
|
+
message: pub.contractType,
|
|
384
|
+
subRepo: subA.name,
|
|
385
|
+
handler: sub.handlerFile,
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
if (crossRepoMessages.length > 0) {
|
|
394
|
+
for (const m of crossRepoMessages) {
|
|
395
|
+
md.push(`| \`${m.pubRepo}\` | \`${m.message}\` | \`${m.subRepo}\` | \`${m.handler}\` |`);
|
|
396
|
+
}
|
|
397
|
+
} else {
|
|
398
|
+
md.push('| _No cross-repo messaging detected_ | | | |');
|
|
399
|
+
}
|
|
400
|
+
md.push('');
|
|
401
|
+
|
|
424
402
|
// ── Local Package Development Loop Tip ──────────────────────────────
|
|
425
403
|
md.push('## 💡 Local Package Development Loop');
|
|
426
404
|
md.push('');
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module generators/skills-generator
|
|
3
|
+
* Generates harness-specific agent skills/rules (e.g. for Claude, Cursor, Copilot, Codex)
|
|
4
|
+
* dynamically based on workspace analysis.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import * as fse from 'fs-extra';
|
|
8
|
+
import * as path from 'node:path';
|
|
9
|
+
import type { AIAssistant, WorkspaceContext, ProjectAnalysis } from '../types.js';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Checks if the workspace has cross-repo package dependencies.
|
|
13
|
+
*/
|
|
14
|
+
function hasCrossRepoDependencies(analysis: Map<string, ProjectAnalysis>): boolean {
|
|
15
|
+
const produced = new Set<string>();
|
|
16
|
+
for (const [, a] of analysis) {
|
|
17
|
+
if (a.produces) {
|
|
18
|
+
for (const p of a.produces) {
|
|
19
|
+
produced.add(p.name.toLowerCase());
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
for (const [, a] of analysis) {
|
|
25
|
+
for (const dep of a.dependencies) {
|
|
26
|
+
if (produced.has(dep.name.toLowerCase())) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Checks if any workspace project produces packages that have consumer repos.
|
|
36
|
+
*/
|
|
37
|
+
function hasProducedPackagesWithConsumers(analysis: Map<string, ProjectAnalysis>): boolean {
|
|
38
|
+
return hasCrossRepoDependencies(analysis); // Same logic: at least one consumer depends on a producer
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Generates local package loop skill instructions.
|
|
43
|
+
*/
|
|
44
|
+
function getLocalPackageLoopSkill(analysis: Map<string, ProjectAnalysis>): string {
|
|
45
|
+
let pkgManagerInfo = '';
|
|
46
|
+
const hasNuget = Array.from(analysis.values()).some(a => a.techStack.languages.includes('csharp'));
|
|
47
|
+
const hasNpm = Array.from(analysis.values()).some(a => a.techStack.languages.includes('typescript') || a.techStack.languages.includes('javascript'));
|
|
48
|
+
|
|
49
|
+
if (hasNuget) {
|
|
50
|
+
pkgManagerInfo += `### NuGet / C# local loop:
|
|
51
|
+
1. **Pack locally**: Run \`dotnet pack -c Release -o ./local-packages\` inside the producing project folder.
|
|
52
|
+
2. **Add local feed**: Ensure the consumer project's directory has a local NuGet feed configured pointing to the \`local-packages\` directory at the workspace root.
|
|
53
|
+
3. **Reference local version**: Update the consumer's package reference in its \`.csproj\` to point to the local version (e.g., \`1.0.0-local\`).
|
|
54
|
+
4. **Revert**: Ensure you revert the package reference to the official release version before submitting code.
|
|
55
|
+
`;
|
|
56
|
+
}
|
|
57
|
+
if (hasNpm) {
|
|
58
|
+
pkgManagerInfo += `### npm / JS/TS local loop:
|
|
59
|
+
1. **Pack locally**: Run \`npm pack\` inside the producing package directory.
|
|
60
|
+
2. **Copy / Reference**: Copy the generated \`.tgz\` file to a \`local-packages/\` directory.
|
|
61
|
+
3. **Reference local version**: Run \`npm install ../local-packages/my-package-1.0.0.tgz\` or reference it in \`package.json\`.
|
|
62
|
+
4. **Revert**: Revert the local reference to the official registry package before submitting code.
|
|
63
|
+
`;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return `# Local Package Development Loop
|
|
67
|
+
|
|
68
|
+
This skill guides the AI assistant through local package testing across repositories in this workspace.
|
|
69
|
+
|
|
70
|
+
## Workflow
|
|
71
|
+
|
|
72
|
+
When modifying a shared package in one repository, you must test its effect on downstream consumer repositories before pushing.
|
|
73
|
+
|
|
74
|
+
${pkgManagerInfo}
|
|
75
|
+
|
|
76
|
+
## Guidelines
|
|
77
|
+
- **Leave a TODO comment**: Always write a \`// TODO: Revert local package loop reference\` comment in the consumer code so you don't commit temporary local reference modifications.
|
|
78
|
+
- **Do not commit local-packages**: The \`local-packages/\` folder is workspace-local and must not be committed to Git.
|
|
79
|
+
`;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Generates release ordering skill instructions.
|
|
84
|
+
*/
|
|
85
|
+
function getReleaseOrderingSkill(ctx: WorkspaceContext): string {
|
|
86
|
+
const { analysis } = ctx;
|
|
87
|
+
const lines: string[] = [];
|
|
88
|
+
|
|
89
|
+
lines.push('# Release and Merge Ordering Guidelines');
|
|
90
|
+
lines.push('');
|
|
91
|
+
lines.push('This guideline answers what repositories must be merged and released in what order when cross-repo dependencies are modified.');
|
|
92
|
+
lines.push('');
|
|
93
|
+
lines.push('## Dependency Chains');
|
|
94
|
+
|
|
95
|
+
if (analysis) {
|
|
96
|
+
for (const [path, a] of analysis) {
|
|
97
|
+
if (a.produces && a.produces.length > 0) {
|
|
98
|
+
for (const p of a.produces) {
|
|
99
|
+
const consumers: string[] = [];
|
|
100
|
+
for (const [otherPath, otherA] of analysis) {
|
|
101
|
+
if (otherPath === path) continue;
|
|
102
|
+
for (const dep of otherA.dependencies) {
|
|
103
|
+
if (dep.name.toLowerCase() === p.name.toLowerCase()) {
|
|
104
|
+
consumers.push(otherA.name);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (consumers.length > 0) {
|
|
109
|
+
lines.push(`- **Product**: \`${p.name}\``);
|
|
110
|
+
lines.push(` - **Producer**: \`${a.name}\` (Must build and release first)`);
|
|
111
|
+
lines.push(` - **Consumers**: ${consumers.map(c => `\`${c}\``).join(', ')} (Must be bumped and released after the producer)`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
lines.push('');
|
|
119
|
+
lines.push('## Reversion Check');
|
|
120
|
+
lines.push('- Before merging a consumer branch, verify that all local package loop references are replaced by official versions.');
|
|
121
|
+
|
|
122
|
+
return lines.join('\n');
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Generates local runtime verifier instructions.
|
|
127
|
+
*/
|
|
128
|
+
function getVerifierSkill(ctx: WorkspaceContext): string {
|
|
129
|
+
const { analysis } = ctx;
|
|
130
|
+
const lines: string[] = [];
|
|
131
|
+
|
|
132
|
+
lines.push('# Workspace Local Runtime Verifier');
|
|
133
|
+
lines.push('');
|
|
134
|
+
lines.push('Guidelines to safely launch, mock, and verify services locally in this workspace.');
|
|
135
|
+
lines.push('');
|
|
136
|
+
|
|
137
|
+
let hasInfraWarnings = false;
|
|
138
|
+
|
|
139
|
+
if (analysis) {
|
|
140
|
+
for (const [, a] of analysis) {
|
|
141
|
+
if (a.runConfig && a.runConfig.sharedInfraWarnings.length > 0) {
|
|
142
|
+
if (!hasInfraWarnings) {
|
|
143
|
+
lines.push('## ⚠️ Shared Infrastructure Warnings');
|
|
144
|
+
hasInfraWarnings = true;
|
|
145
|
+
}
|
|
146
|
+
for (const warning of a.runConfig.sharedInfraWarnings) {
|
|
147
|
+
lines.push(`- **${a.name}**: ${warning.warning}`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
lines.push('');
|
|
154
|
+
lines.push('## Verification Recipe');
|
|
155
|
+
lines.push('1. **Check local ports**: Ensure target ports do not conflict.');
|
|
156
|
+
lines.push('2. **Run mocks**: Spin up local databases/caches before starting services.');
|
|
157
|
+
lines.push('3. **Watch out for shared staging environment**: Never publish messages or write data to staging infrastructure while testing locally unless explicitly requested.');
|
|
158
|
+
|
|
159
|
+
return lines.join('\n');
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Deploys skills files to the specified harness's directory structure.
|
|
164
|
+
*/
|
|
165
|
+
async function deploySkill(
|
|
166
|
+
workspacePath: string,
|
|
167
|
+
assistant: AIAssistant,
|
|
168
|
+
skillName: string,
|
|
169
|
+
content: string,
|
|
170
|
+
): Promise<void> {
|
|
171
|
+
const titleMap: Record<string, string> = {
|
|
172
|
+
'nexusflow-local-package-loop': 'Local Package Development Loop',
|
|
173
|
+
'nexusflow-release-ordering': 'Release and Merge Ordering',
|
|
174
|
+
'verifier-workspace': 'Local Runtime Verifier',
|
|
175
|
+
};
|
|
176
|
+
const title = titleMap[skillName] || skillName;
|
|
177
|
+
|
|
178
|
+
if (assistant === 'claude' || assistant === 'antigravity') {
|
|
179
|
+
const skillDir = path.join(workspacePath, '.claude', 'skills', skillName);
|
|
180
|
+
await fse.ensureDir(skillDir);
|
|
181
|
+
await fse.writeFile(path.join(skillDir, 'SKILL.md'), content, 'utf-8');
|
|
182
|
+
} else if (assistant === 'cursor') {
|
|
183
|
+
const ruleDir = path.join(workspacePath, '.cursor', 'rules');
|
|
184
|
+
await fse.ensureDir(ruleDir);
|
|
185
|
+
const mdcContent = `---
|
|
186
|
+
description: "Guidelines and instructions for ${title}"
|
|
187
|
+
alwaysApply: false
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
${content}`;
|
|
191
|
+
await fse.writeFile(path.join(ruleDir, `${skillName}.mdc`), mdcContent, 'utf-8');
|
|
192
|
+
} else if (assistant === 'copilot') {
|
|
193
|
+
const copilotDir = path.join(workspacePath, '.github', 'instructions');
|
|
194
|
+
await fse.ensureDir(copilotDir);
|
|
195
|
+
await fse.writeFile(path.join(copilotDir, `${skillName}.instructions.md`), content, 'utf-8');
|
|
196
|
+
} else if (assistant === 'codex') {
|
|
197
|
+
const codexDir = path.join(workspacePath, '.codex', 'skills', skillName);
|
|
198
|
+
await fse.ensureDir(codexDir);
|
|
199
|
+
await fse.writeFile(path.join(codexDir, 'SKILL.md'), content, 'utf-8');
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Generates custom skills/rules for each selected AI assistant.
|
|
205
|
+
*
|
|
206
|
+
* @param ctx - The workspace context.
|
|
207
|
+
* @param assistants - The active AI assistant harnesses.
|
|
208
|
+
* @param workspacePath - The workspace root directory.
|
|
209
|
+
*/
|
|
210
|
+
export async function generateSkills(
|
|
211
|
+
ctx: WorkspaceContext,
|
|
212
|
+
assistants: AIAssistant[],
|
|
213
|
+
workspacePath: string,
|
|
214
|
+
): Promise<void> {
|
|
215
|
+
const { analysis } = ctx;
|
|
216
|
+
if (!analysis) return;
|
|
217
|
+
|
|
218
|
+
const hasDeps = hasCrossRepoDependencies(analysis);
|
|
219
|
+
const hasProds = hasProducedPackagesWithConsumers(analysis);
|
|
220
|
+
const hasRunConfig = Array.from(analysis.values()).some(a => a.runConfig && a.runConfig.entryPoints.length > 0);
|
|
221
|
+
|
|
222
|
+
const skillsToDeploy: { name: string; content: string }[] = [];
|
|
223
|
+
|
|
224
|
+
if (hasDeps) {
|
|
225
|
+
skillsToDeploy.push({
|
|
226
|
+
name: 'nexusflow-local-package-loop',
|
|
227
|
+
content: getLocalPackageLoopSkill(analysis),
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
if (hasProds) {
|
|
232
|
+
skillsToDeploy.push({
|
|
233
|
+
name: 'nexusflow-release-ordering',
|
|
234
|
+
content: getReleaseOrderingSkill(ctx),
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
if (hasRunConfig) {
|
|
239
|
+
skillsToDeploy.push({
|
|
240
|
+
name: 'verifier-workspace',
|
|
241
|
+
content: getVerifierSkill(ctx),
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
for (const assistant of assistants) {
|
|
246
|
+
for (const skill of skillsToDeploy) {
|
|
247
|
+
try {
|
|
248
|
+
await deploySkill(workspacePath, assistant, skill.name, skill.content);
|
|
249
|
+
} catch (error) {
|
|
250
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
251
|
+
console.error(` ✖ Failed to deploy skill ${skill.name} for ${assistant}: ${msg}`);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
package/src/mcp/server.ts
CHANGED
|
@@ -216,98 +216,25 @@ export async function startMcpServer(workspacePath?: string) {
|
|
|
216
216
|
}
|
|
217
217
|
|
|
218
218
|
if (name === 'get_workspace_graph') {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
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
|
-
}
|
|
219
|
+
return {
|
|
220
|
+
content: [
|
|
221
|
+
{
|
|
222
|
+
type: 'text',
|
|
223
|
+
text: 'This tool has been deprecated. Use nexusflow-plan.md for dependency information.',
|
|
224
|
+
},
|
|
225
|
+
],
|
|
226
|
+
};
|
|
256
227
|
}
|
|
257
228
|
|
|
258
229
|
if (name === 'query_workspace_graph') {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
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
|
-
}
|
|
230
|
+
return {
|
|
231
|
+
content: [
|
|
232
|
+
{
|
|
233
|
+
type: 'text',
|
|
234
|
+
text: 'This tool has been deprecated. Use nexusflow-plan.md for dependency information.',
|
|
235
|
+
},
|
|
236
|
+
],
|
|
237
|
+
};
|
|
311
238
|
}
|
|
312
239
|
|
|
313
240
|
throw new Error(`Tool not found: ${name}`);
|
package/src/server.ts
CHANGED
|
@@ -897,15 +897,18 @@ app.get('/', async (c) => {
|
|
|
897
897
|
// Serve static assets from GUI build folder
|
|
898
898
|
app.use('/*', serveStatic({ root: path.relative(process.cwd(), guiPath) }));
|
|
899
899
|
|
|
900
|
-
/**
|
|
901
|
-
* Starts the local GUI web server.
|
|
902
|
-
*
|
|
903
|
-
* @param port - Port to run on.
|
|
904
|
-
*/
|
|
905
900
|
export function startServer(port = 3000): Promise<{ port: number; server: any }> {
|
|
906
|
-
return new Promise((resolve) => {
|
|
901
|
+
return new Promise((resolve, reject) => {
|
|
907
902
|
const server = serve({ fetch: app.fetch, port }, (info) => {
|
|
908
903
|
resolve({ port: info.port, server });
|
|
904
|
+
}) as import('node:http').Server;
|
|
905
|
+
|
|
906
|
+
server.on('error', (e: any) => {
|
|
907
|
+
if (e.code === 'EADDRINUSE') {
|
|
908
|
+
resolve(startServer(port + 1));
|
|
909
|
+
} else {
|
|
910
|
+
reject(e);
|
|
911
|
+
}
|
|
909
912
|
});
|
|
910
913
|
});
|
|
911
914
|
}
|
package/src/types.ts
CHANGED
|
@@ -248,6 +248,60 @@ export interface ProjectAnalysis {
|
|
|
248
248
|
produces?: { name: string; type: 'npm' | 'nuget' | 'other'; version?: string; contributing?: string[] }[];
|
|
249
249
|
/** NuGet feeds detected in the repo's NuGet.config files. */
|
|
250
250
|
nugetFeeds?: { name: string; url: string }[];
|
|
251
|
+
/** Detected messaging topology. */
|
|
252
|
+
messaging?: MessagingTopology;
|
|
253
|
+
/** Detected run configurations. */
|
|
254
|
+
runConfig?: RunConfig;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export interface MessagePublisher {
|
|
258
|
+
contractType: string;
|
|
259
|
+
topicOrQueue: string;
|
|
260
|
+
publisherFile: string;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
export interface MessageSubscriber {
|
|
264
|
+
contractType: string;
|
|
265
|
+
handlerFile: string;
|
|
266
|
+
registrationFile: string;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export interface MessagingTopology {
|
|
270
|
+
publishers: MessagePublisher[];
|
|
271
|
+
subscribers: MessageSubscriber[];
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
export interface RunConfigEntryPoint {
|
|
275
|
+
projectPath: string;
|
|
276
|
+
type: string;
|
|
277
|
+
command?: string;
|
|
278
|
+
port?: number;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
export interface RunConfigDatabase {
|
|
282
|
+
provider: string;
|
|
283
|
+
host: string;
|
|
284
|
+
configFile: string;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
export interface RunConfigSharedInfraWarning {
|
|
288
|
+
resource: string;
|
|
289
|
+
host: string;
|
|
290
|
+
configFile: string;
|
|
291
|
+
warning: string;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export interface RunConfigSecret {
|
|
295
|
+
file: string;
|
|
296
|
+
lineHint: string;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
export interface RunConfig {
|
|
300
|
+
entryPoints: RunConfigEntryPoint[];
|
|
301
|
+
databases: RunConfigDatabase[];
|
|
302
|
+
sharedInfraWarnings: RunConfigSharedInfraWarning[];
|
|
303
|
+
committedSecrets: RunConfigSecret[];
|
|
304
|
+
externalDependencies: string[];
|
|
251
305
|
}
|
|
252
306
|
|
|
253
307
|
/** An existing AI configuration file found in a repo. */
|