@mrpatronz/nexusflow 0.1.2 → 0.1.4
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/mcp.d.ts +3 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/mcp.js +88 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/core/workspace.d.ts.map +1 -1
- package/dist/core/workspace.js +13 -0
- package/dist/core/workspace.js.map +1 -1
- package/dist/core/worktree.d.ts.map +1 -1
- package/dist/core/worktree.js +21 -3
- package/dist/core/worktree.js.map +1 -1
- package/dist/generators/base.d.ts.map +1 -1
- package/dist/generators/base.js +8 -0
- package/dist/generators/base.js.map +1 -1
- package/dist/gui/assets/index-DDn7UKEM.js +21 -0
- package/dist/gui/assets/index-DPPCFG2H.css +2 -0
- package/dist/gui/index.html +2 -2
- package/dist/index.js +44 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp/server.d.ts +2 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +172 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +22 -6
- package/dist/server.js.map +1 -1
- package/dist/types.d.ts +4 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/update-check.d.ts +27 -0
- package/dist/utils/update-check.d.ts.map +1 -0
- package/dist/utils/update-check.js +128 -0
- package/dist/utils/update-check.js.map +1 -0
- package/gui/src/App.tsx +55 -1
- package/package.json +2 -1
- package/src/commands/mcp.ts +92 -0
- package/src/core/workspace.ts +14 -0
- package/src/core/worktree.ts +20 -3
- package/src/generators/base.ts +8 -0
- package/src/index.ts +46 -2
- package/src/mcp/server.ts +187 -0
- package/src/server.ts +22 -6
- package/src/types.ts +6 -0
- package/src/utils/update-check.ts +147 -0
- package/dist/gui/assets/index-B9Ph2bHH.css +0 -2
- package/dist/gui/assets/index-s4nRkpqY.js +0 -21
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,0CAA0C;AAC1C,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,aAAa,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEpF,4EAA4E;AAC5E,MAAM,WAAW,eAAe;IAC9B,uDAAuD;IACvD,OAAO,EAAE,MAAM,CAAC;IAEhB,iDAAiD;IACjD,MAAM,EAAE,MAAM,CAAC;IAEf,wEAAwE;IACxE,aAAa,EAAE,MAAM,CAAC;IAEtB,qEAAqE;IACrE,gBAAgB,EAAE,WAAW,GAAG,IAAI,CAAC;IAErC,uEAAuE;IACvE,SAAS,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,0CAA0C;AAC1C,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,aAAa,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEpF,4EAA4E;AAC5E,MAAM,WAAW,eAAe;IAC9B,uDAAuD;IACvD,OAAO,EAAE,MAAM,CAAC;IAEhB,iDAAiD;IACjD,MAAM,EAAE,MAAM,CAAC;IAEf,wEAAwE;IACxE,aAAa,EAAE,MAAM,CAAC;IAEtB,qEAAqE;IACrE,gBAAgB,EAAE,WAAW,GAAG,IAAI,CAAC;IAErC,uEAAuE;IACvE,SAAS,EAAE,MAAM,CAAC;IAElB,8CAA8C;IAC9C,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,gDAAgD;IAChD,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,2DAA2D;AAC3D,MAAM,WAAW,UAAU;IACzB,sCAAsC;IACtC,IAAI,EAAE,WAAW,CAAC;IAElB,6CAA6C;IAC7C,WAAW,EAAE,MAAM,CAAC;IAEpB,6CAA6C;IAC7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AC;IACpB,8CAA8C;IAC9C,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,iDAAiD;AACjD,MAAM,MAAM,eAAe,GAAG,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module utils/update-check
|
|
3
|
+
* Checks for updates to the NexusFlow package on the NPM registry.
|
|
4
|
+
*/
|
|
5
|
+
export interface UpdateStatus {
|
|
6
|
+
currentVersion: string;
|
|
7
|
+
latestVersion: string;
|
|
8
|
+
updateAvailable: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Resolves the current package version by searching for package.json upward
|
|
12
|
+
* from the directory of the executing code.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getCurrentVersion(): string;
|
|
15
|
+
/**
|
|
16
|
+
* Checks for updates from the NPM registry.
|
|
17
|
+
* Employs a 24-hour cache unless forced.
|
|
18
|
+
*
|
|
19
|
+
* @param force - If true, ignores the 24-hour cache and fetches immediately.
|
|
20
|
+
* @returns The update status, or null if the check fails (e.g. offline).
|
|
21
|
+
*/
|
|
22
|
+
export declare function checkForUpdates(force?: boolean): Promise<UpdateStatus | null>;
|
|
23
|
+
/**
|
|
24
|
+
* Prints a clean, premium terminal notification banner if an update is available.
|
|
25
|
+
*/
|
|
26
|
+
export declare function printUpdateBanner(status: UpdateStatus): void;
|
|
27
|
+
//# sourceMappingURL=update-check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-check.d.ts","sourceRoot":"","sources":["../../src/utils/update-check.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,MAAM,WAAW,YAAY;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAoB1C;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,CAAC,KAAK,UAAQ,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAmDjF;AAqBD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAoB5D"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module utils/update-check
|
|
3
|
+
* Checks for updates to the NexusFlow package on the NPM registry.
|
|
4
|
+
*/
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
import * as fs from 'node:fs';
|
|
7
|
+
import * as path from 'node:path';
|
|
8
|
+
import chalk from 'chalk';
|
|
9
|
+
import { loadConfig, saveConfig } from '../core/config.js';
|
|
10
|
+
/**
|
|
11
|
+
* Resolves the current package version by searching for package.json upward
|
|
12
|
+
* from the directory of the executing code.
|
|
13
|
+
*/
|
|
14
|
+
export function getCurrentVersion() {
|
|
15
|
+
try {
|
|
16
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
17
|
+
const __dirname = path.dirname(__filename);
|
|
18
|
+
let currentDir = __dirname;
|
|
19
|
+
for (let i = 0; i < 5; i++) {
|
|
20
|
+
const packageJsonPath = path.join(currentDir, 'package.json');
|
|
21
|
+
if (fs.existsSync(packageJsonPath)) {
|
|
22
|
+
const pkg = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
|
|
23
|
+
return pkg.version;
|
|
24
|
+
}
|
|
25
|
+
const parentDir = path.dirname(currentDir);
|
|
26
|
+
if (parentDir === currentDir)
|
|
27
|
+
break;
|
|
28
|
+
currentDir = parentDir;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
// Fallback if filesystem access fails
|
|
33
|
+
}
|
|
34
|
+
return '0.1.3'; // Sensible fallback (active release)
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Checks for updates from the NPM registry.
|
|
38
|
+
* Employs a 24-hour cache unless forced.
|
|
39
|
+
*
|
|
40
|
+
* @param force - If true, ignores the 24-hour cache and fetches immediately.
|
|
41
|
+
* @returns The update status, or null if the check fails (e.g. offline).
|
|
42
|
+
*/
|
|
43
|
+
export async function checkForUpdates(force = false) {
|
|
44
|
+
const currentVersion = getCurrentVersion();
|
|
45
|
+
const config = await loadConfig();
|
|
46
|
+
const now = Date.now();
|
|
47
|
+
const lastCheck = config.lastUpdateCheck ? new Date(config.lastUpdateCheck).getTime() : 0;
|
|
48
|
+
const ONE_DAY_MS = 24 * 60 * 60 * 1000;
|
|
49
|
+
// Use cached result if within 24 hours and not forced
|
|
50
|
+
if (!force && lastCheck && (now - lastCheck < ONE_DAY_MS) && config.latestVersion) {
|
|
51
|
+
return {
|
|
52
|
+
currentVersion,
|
|
53
|
+
latestVersion: config.latestVersion,
|
|
54
|
+
updateAvailable: isNewerVersion(currentVersion, config.latestVersion),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
try {
|
|
58
|
+
// Query NPM registry latest endpoint
|
|
59
|
+
const response = await fetch('https://registry.npmjs.org/@mrpatronz/nexusflow/latest', {
|
|
60
|
+
signal: AbortSignal.timeout(3000), // 3-second timeout to prevent blocking CLI/server
|
|
61
|
+
});
|
|
62
|
+
if (!response.ok) {
|
|
63
|
+
throw new Error(`NPM registry returned status ${response.status}`);
|
|
64
|
+
}
|
|
65
|
+
const data = await response.json();
|
|
66
|
+
const latestVersion = data.version;
|
|
67
|
+
// Cache results
|
|
68
|
+
config.lastUpdateCheck = new Date().toISOString();
|
|
69
|
+
config.latestVersion = latestVersion;
|
|
70
|
+
await saveConfig(config);
|
|
71
|
+
return {
|
|
72
|
+
currentVersion,
|
|
73
|
+
latestVersion,
|
|
74
|
+
updateAvailable: isNewerVersion(currentVersion, latestVersion),
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
// Fallback: If offline or check fails, return cached version status if available
|
|
79
|
+
if (config.latestVersion) {
|
|
80
|
+
return {
|
|
81
|
+
currentVersion,
|
|
82
|
+
latestVersion: config.latestVersion,
|
|
83
|
+
updateAvailable: isNewerVersion(currentVersion, config.latestVersion),
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Simple semver comparison (checks major.minor.patch).
|
|
91
|
+
*/
|
|
92
|
+
function isNewerVersion(current, latest) {
|
|
93
|
+
if (current === latest)
|
|
94
|
+
return false;
|
|
95
|
+
const currentParts = current.split('.').map(Number);
|
|
96
|
+
const latestParts = latest.split('.').map(Number);
|
|
97
|
+
for (let i = 0; i < 3; i++) {
|
|
98
|
+
const curr = currentParts[i] || 0;
|
|
99
|
+
const lat = latestParts[i] || 0;
|
|
100
|
+
if (lat > curr)
|
|
101
|
+
return true;
|
|
102
|
+
if (curr > lat)
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Prints a clean, premium terminal notification banner if an update is available.
|
|
109
|
+
*/
|
|
110
|
+
export function printUpdateBanner(status) {
|
|
111
|
+
if (!status.updateAvailable)
|
|
112
|
+
return;
|
|
113
|
+
const msg = `Update available: ${chalk.red(status.currentVersion)} → ${chalk.green(status.latestVersion)}`;
|
|
114
|
+
const runMsg = `Run ${chalk.cyan('npm install -g @mrpatronz/nexusflow')} to update!`;
|
|
115
|
+
const cleanMsg = `Update available: ${status.currentVersion} → ${status.latestVersion}`;
|
|
116
|
+
const cleanRunMsg = `Run npm install -g @mrpatronz/nexusflow to update!`;
|
|
117
|
+
const width = Math.max(cleanMsg.length, cleanRunMsg.length) + 2;
|
|
118
|
+
const padMsg = ' '.repeat(width - cleanMsg.length);
|
|
119
|
+
const padRunMsg = ' '.repeat(width - cleanRunMsg.length);
|
|
120
|
+
const border = '─'.repeat(width);
|
|
121
|
+
console.log();
|
|
122
|
+
console.log(chalk.yellow(`┌${border}┐`));
|
|
123
|
+
console.log(chalk.yellow(`│ ${msg}${padMsg} │`));
|
|
124
|
+
console.log(chalk.yellow(`│ ${runMsg}${padRunMsg} │`));
|
|
125
|
+
console.log(chalk.yellow(`└${border}┘`));
|
|
126
|
+
console.log();
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=update-check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-check.js","sourceRoot":"","sources":["../../src/utils/update-check.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAQ3D;;;GAGG;AACH,MAAM,UAAU,iBAAiB;IAC/B,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAClD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAE3C,IAAI,UAAU,GAAG,SAAS,CAAC;QAC3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAC3B,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;YAC9D,IAAI,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;gBACnC,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC,CAAC;gBAClE,OAAO,GAAG,CAAC,OAAO,CAAC;YACrB,CAAC;YACD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;YAC3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AS,IAAI,CAAC,CAAC,CAAC;IACvD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC;IACzC,OAAO,CAAC,GAAG,EAAE,CAAC;AAChB,CAAC"}
|
package/gui/src/App.tsx
CHANGED
|
@@ -99,6 +99,14 @@ export default function App() {
|
|
|
99
99
|
const [configLoading, setConfigLoading] = useState(true);
|
|
100
100
|
const [configExists, setConfigExists] = useState<boolean>(true);
|
|
101
101
|
const [saveStatus, setSaveStatus] = useState<'success' | 'error' | null>(null);
|
|
102
|
+
|
|
103
|
+
// Update Check State
|
|
104
|
+
const [updateStatus, setUpdateStatus] = useState<{
|
|
105
|
+
currentVersion: string;
|
|
106
|
+
latestVersion: string;
|
|
107
|
+
updateAvailable: boolean;
|
|
108
|
+
} | null>(null);
|
|
109
|
+
const [appVersion, setAppVersion] = useState('0.1.3');
|
|
102
110
|
const [defaultPaths, setDefaultPaths] = useState<{ devDir: string; workspacesDir: string } | null>(null);
|
|
103
111
|
|
|
104
112
|
// Repos & Tools
|
|
@@ -183,6 +191,7 @@ export default function App() {
|
|
|
183
191
|
fetchAIAssistants();
|
|
184
192
|
fetchEditors();
|
|
185
193
|
fetchWorkspaces();
|
|
194
|
+
fetchUpdateStatus();
|
|
186
195
|
}, []);
|
|
187
196
|
|
|
188
197
|
// Poll logs and services status when active workspace is open
|
|
@@ -252,6 +261,21 @@ export default function App() {
|
|
|
252
261
|
|
|
253
262
|
// ─── API Fetches ────────────────────────────────────────────────────────
|
|
254
263
|
|
|
264
|
+
const fetchUpdateStatus = async () => {
|
|
265
|
+
try {
|
|
266
|
+
const res = await fetch(`${API_BASE}/api/update-status`);
|
|
267
|
+
if (res.ok) {
|
|
268
|
+
const data = await res.json();
|
|
269
|
+
setUpdateStatus(data);
|
|
270
|
+
if (data.currentVersion) {
|
|
271
|
+
setAppVersion(data.currentVersion);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
} catch (e) {
|
|
275
|
+
console.error('Failed to fetch update status:', e);
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
|
|
255
279
|
const fetchConfig = async () => {
|
|
256
280
|
try {
|
|
257
281
|
const res = await fetch(`${API_BASE}/api/config`);
|
|
@@ -992,7 +1016,7 @@ Core Instructions:
|
|
|
992
1016
|
</ul>
|
|
993
1017
|
</nav>
|
|
994
1018
|
<div className="pt-6 border-t border-gray-800/60 text-[11px] text-gray-500 text-center">
|
|
995
|
-
NexusFlow Engine
|
|
1019
|
+
NexusFlow Engine v{appVersion}
|
|
996
1020
|
</div>
|
|
997
1021
|
</aside>
|
|
998
1022
|
|
|
@@ -1005,6 +1029,36 @@ Core Instructions:
|
|
|
1005
1029
|
</div>
|
|
1006
1030
|
) : (
|
|
1007
1031
|
<>
|
|
1032
|
+
{/* Update Notification Banner */}
|
|
1033
|
+
{updateStatus && updateStatus.updateAvailable && (
|
|
1034
|
+
<div className="mb-6 p-4 bg-gradient-to-r from-amber-500/10 to-orange-600/10 border border-amber-500/30 rounded-xl shadow-lg flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 backdrop-blur-sm">
|
|
1035
|
+
<div className="flex items-center gap-3">
|
|
1036
|
+
<div className="w-10 h-10 rounded-lg bg-amber-500/10 border border-amber-500/20 flex items-center justify-center text-amber-400 shrink-0">
|
|
1037
|
+
<Sparkles size={20} />
|
|
1038
|
+
</div>
|
|
1039
|
+
<div>
|
|
1040
|
+
<h4 className="text-sm font-bold text-amber-300">
|
|
1041
|
+
A new version of NexusFlow is available!
|
|
1042
|
+
</h4>
|
|
1043
|
+
<p className="text-xs text-gray-400 mt-0.5">
|
|
1044
|
+
Upgrade from v{updateStatus.currentVersion} to v{updateStatus.latestVersion} to get the latest features and bug fixes.
|
|
1045
|
+
</p>
|
|
1046
|
+
</div>
|
|
1047
|
+
</div>
|
|
1048
|
+
<div className="flex items-center gap-3 shrink-0">
|
|
1049
|
+
<button
|
|
1050
|
+
onClick={() => {
|
|
1051
|
+
navigator.clipboard.writeText('npm install -g @mrpatronz/nexusflow');
|
|
1052
|
+
alert('Update command copied to clipboard!');
|
|
1053
|
+
}}
|
|
1054
|
+
className="px-4 py-2 bg-amber-500 hover:bg-amber-600 text-[#060813] font-bold text-xs rounded-lg transition-all shadow-md shadow-amber-500/10 cursor-pointer flex items-center gap-1.5"
|
|
1055
|
+
>
|
|
1056
|
+
Copy Update Command
|
|
1057
|
+
</button>
|
|
1058
|
+
</div>
|
|
1059
|
+
</div>
|
|
1060
|
+
)}
|
|
1061
|
+
|
|
1008
1062
|
{/* View 0: Getting Started Guide */}
|
|
1009
1063
|
{view === 'guide' && config && (
|
|
1010
1064
|
<div className="max-w-4xl mx-auto">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrpatronz/nexusflow",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Combine multiple repos into a workspace with rich AI assistant context",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@hono/node-server": "^2.0.4",
|
|
35
35
|
"@inquirer/prompts": "^7.0.0",
|
|
36
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
36
37
|
"chalk": "^5.3.0",
|
|
37
38
|
"commander": "^13.0.0",
|
|
38
39
|
"execa": "^9.5.0",
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import * as os from 'node:os';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
import * as fs from 'node:fs/promises';
|
|
4
|
+
import chalk from 'chalk';
|
|
5
|
+
import { startMcpServer } from '../mcp/server.js';
|
|
6
|
+
|
|
7
|
+
export async function mcpRunCommand(workspace?: string) {
|
|
8
|
+
// If not provided, it attempts to use process.cwd() or waits for workspaceId in MCP calls.
|
|
9
|
+
// The startMcpServer function handles this.
|
|
10
|
+
await startMcpServer(workspace);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export async function mcpSetupCommand() {
|
|
14
|
+
console.log(chalk.blue.bold('\nSetting up NexusFlow MCP Server for AI Assistants...'));
|
|
15
|
+
|
|
16
|
+
const isWin = os.platform() === 'win32';
|
|
17
|
+
const isMac = os.platform() === 'darwin';
|
|
18
|
+
const home = os.homedir();
|
|
19
|
+
|
|
20
|
+
const configPaths = [
|
|
21
|
+
// Cursor
|
|
22
|
+
path.join(home, '.cursor', 'mcp.json'),
|
|
23
|
+
// VS Code Insiders (for Antigravity/Copilot)
|
|
24
|
+
isWin
|
|
25
|
+
? path.join(home, 'AppData', 'Roaming', 'Code - Insiders', 'User', 'mcp.json')
|
|
26
|
+
: isMac
|
|
27
|
+
? path.join(home, 'Library', 'Application Support', 'Code - Insiders', 'User', 'mcp.json')
|
|
28
|
+
: path.join(home, '.config', 'Code - Insiders', 'User', 'mcp.json'),
|
|
29
|
+
// VS Code (Stable)
|
|
30
|
+
isWin
|
|
31
|
+
? path.join(home, 'AppData', 'Roaming', 'Code', 'User', 'mcp.json')
|
|
32
|
+
: isMac
|
|
33
|
+
? path.join(home, 'Library', 'Application Support', 'Code', 'User', 'mcp.json')
|
|
34
|
+
: path.join(home, '.config', 'Code', 'User', 'mcp.json'),
|
|
35
|
+
// Claude Desktop
|
|
36
|
+
isWin
|
|
37
|
+
? path.join(home, 'AppData', 'Roaming', 'Claude', 'claude_desktop_config.json')
|
|
38
|
+
: isMac
|
|
39
|
+
? path.join(home, 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json')
|
|
40
|
+
: ''
|
|
41
|
+
].filter(Boolean);
|
|
42
|
+
|
|
43
|
+
const mcpConfig = {
|
|
44
|
+
command: 'npx',
|
|
45
|
+
args: ['-y', '@mrpatronz/nexusflow', 'mcp', 'run']
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
let updatedCount = 0;
|
|
49
|
+
|
|
50
|
+
for (const configPath of configPaths) {
|
|
51
|
+
if (!configPath) continue;
|
|
52
|
+
try {
|
|
53
|
+
let configData: any = { mcpServers: {} };
|
|
54
|
+
|
|
55
|
+
try {
|
|
56
|
+
await fs.access(configPath);
|
|
57
|
+
const raw = await fs.readFile(configPath, 'utf8');
|
|
58
|
+
// Handle empty or invalid files gracefully
|
|
59
|
+
if (raw.trim()) {
|
|
60
|
+
configData = JSON.parse(raw);
|
|
61
|
+
}
|
|
62
|
+
if (!configData.mcpServers) configData.mcpServers = {};
|
|
63
|
+
} catch (e) {
|
|
64
|
+
// File doesn't exist, we will create it if the directory exists
|
|
65
|
+
const dir = path.dirname(configPath);
|
|
66
|
+
try {
|
|
67
|
+
await fs.access(dir);
|
|
68
|
+
} catch {
|
|
69
|
+
// Directory doesn't exist, skip this environment
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
configData.mcpServers['nexusflow'] = mcpConfig;
|
|
75
|
+
|
|
76
|
+
await fs.writeFile(configPath, JSON.stringify(configData, null, 2), 'utf8');
|
|
77
|
+
console.log(chalk.green(` ✓ Configured MCP in: ${configPath}`));
|
|
78
|
+
updatedCount++;
|
|
79
|
+
} catch (e: any) {
|
|
80
|
+
console.log(chalk.gray(` - Skipped ${configPath} (${e.message})`));
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (updatedCount > 0) {
|
|
85
|
+
console.log(chalk.green.bold(`\nSuccessfully configured ${updatedCount} AI environments!`));
|
|
86
|
+
console.log(chalk.white('You may need to restart your editor or Claude Desktop for the changes to take effect.'));
|
|
87
|
+
} else {
|
|
88
|
+
console.log(chalk.yellow('\nCould not find any standard configuration files to update.'));
|
|
89
|
+
console.log('You can manually add this configuration to your mcp.json:');
|
|
90
|
+
console.log(JSON.stringify({ mcpServers: { nexusflow: mcpConfig } }, null, 2));
|
|
91
|
+
}
|
|
92
|
+
}
|
package/src/core/workspace.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import * as fs from 'node:fs/promises';
|
|
9
9
|
import * as path from 'node:path';
|
|
10
|
+
import { execa } from 'execa';
|
|
10
11
|
|
|
11
12
|
import type { Feature, RepoInfo } from '../types.js';
|
|
12
13
|
import { createWorktree } from './worktree.js';
|
|
@@ -47,6 +48,19 @@ export async function createWorkspace(
|
|
|
47
48
|
// Ensure the workspace directory exists.
|
|
48
49
|
await fs.mkdir(workspacePath, { recursive: true });
|
|
49
50
|
|
|
51
|
+
// Initialize git repository at workspace root to prevent AI assistants (like Claude)
|
|
52
|
+
// from climbing up to parent git repositories (main/master).
|
|
53
|
+
try {
|
|
54
|
+
await execa('git', ['init'], { cwd: workspacePath });
|
|
55
|
+
|
|
56
|
+
// Write a .gitignore to ignore the sub-repositories
|
|
57
|
+
const gitignoreContent = repos.map((repo) => `/${repo.name}/`).join('\n') + '\n';
|
|
58
|
+
await fs.writeFile(path.join(workspacePath, '.gitignore'), gitignoreContent, 'utf-8');
|
|
59
|
+
} catch (error) {
|
|
60
|
+
// Silently ignore or log warning if git init fails
|
|
61
|
+
console.warn('Warning: Failed to initialize git repository at workspace root:', error);
|
|
62
|
+
}
|
|
63
|
+
|
|
50
64
|
// Create a worktree for each repo inside the workspace.
|
|
51
65
|
for (const repo of repos) {
|
|
52
66
|
const worktreeTarget = path.join(workspacePath, repo.name);
|
package/src/core/worktree.ts
CHANGED
|
@@ -23,13 +23,30 @@ export async function createWorktree(
|
|
|
23
23
|
branchName: string,
|
|
24
24
|
baseBranch: string,
|
|
25
25
|
): Promise<void> {
|
|
26
|
+
let fetched = false;
|
|
26
27
|
// Fetch latest remote state.
|
|
27
|
-
|
|
28
|
+
try {
|
|
29
|
+
await execa('git', ['fetch', 'origin'], { cwd: repoPath });
|
|
30
|
+
fetched = true;
|
|
31
|
+
} catch {
|
|
32
|
+
// Silently ignore fetch failures (e.g., offline or no remote origin)
|
|
33
|
+
}
|
|
28
34
|
|
|
29
|
-
//
|
|
35
|
+
// Determine starting point: remote branch if fetched successfully and exists, else local branch.
|
|
36
|
+
let startPoint = baseBranch;
|
|
37
|
+
if (fetched) {
|
|
38
|
+
try {
|
|
39
|
+
await execa('git', ['rev-parse', '--verify', `origin/${baseBranch}`], { cwd: repoPath });
|
|
40
|
+
startPoint = `origin/${baseBranch}`;
|
|
41
|
+
} catch {
|
|
42
|
+
// remote tracking branch does not exist, fallback to local branch
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Create the worktree with a new branch based on the start point.
|
|
30
47
|
await execa(
|
|
31
48
|
'git',
|
|
32
|
-
['worktree', 'add', targetPath, '-b', branchName,
|
|
49
|
+
['worktree', 'add', targetPath, '-b', branchName, startPoint],
|
|
33
50
|
{ cwd: repoPath },
|
|
34
51
|
);
|
|
35
52
|
}
|
package/src/generators/base.ts
CHANGED
|
@@ -176,6 +176,14 @@ Once you have created \`nexusflow-overview.md\` and compiled your questions, ask
|
|
|
176
176
|
|
|
177
177
|
## Guidelines
|
|
178
178
|
|
|
179
|
+
- **Multi-Repo Workspace Structure**: This workspace is a multi-repository developer environment where each project subdirectory (e.g. \`my-api\`, \`my-frontend\`) is a separate Git worktree checked out on the feature branch \`\${feature.branchName}\`.
|
|
180
|
+
- **All code changes** must be made within the appropriate project subdirectories.
|
|
181
|
+
- **Git commands** (like \`git status\`, \`git add\`, \`git commit\`, \`git push\`) must be run inside the specific project subdirectories (e.g. \`cd my-api && git commit -m "..."\`), NOT in the workspace root.
|
|
182
|
+
- **Project commands** (like \`npm install\`, \`npm run build\`, \`npm run test\`) must be run inside the project subdirectories.
|
|
183
|
+
- **Global helpers**: Alternatively, you can run NexusFlow CLI commands from the workspace root:
|
|
184
|
+
- \`nexusflow diff\` — view changes across all sub-repositories.
|
|
185
|
+
- \`nexusflow commit\` — commit and push changes across modified repositories.
|
|
186
|
+
- \`nexusflow sync\` — rebase all repositories with their default base branches.
|
|
179
187
|
- **Workspace Knowledge**: Read \`nexusflow-knowledge.md\` at the start of every session. It serves as the persistent memory for this feature. Before ending your session, append significant architecture decisions, discovered gotchas, and checklist progress to \`nexusflow-knowledge.md\`. Never delete or overwrite existing knowledge/decisions — only append.
|
|
180
188
|
- **Implementation Plan**: Refer to \`nexusflow-plan.md\` for the suggested implementation order based on dependency analysis. Follow the phased implementation order to avoid blocking yourself on cross-repo dependencies.
|
|
181
189
|
- Read each project's existing \`README.md\` and any doc files before proposing changes.
|
package/src/index.ts
CHANGED
|
@@ -23,7 +23,8 @@ import { uiCommand } from './commands/ui.js';
|
|
|
23
23
|
import { syncCommand } from './commands/sync.js';
|
|
24
24
|
import { commitCommand } from './commands/commit.js';
|
|
25
25
|
import { diffCommand } from './commands/diff.js';
|
|
26
|
-
|
|
26
|
+
import { mcpRunCommand, mcpSetupCommand } from './commands/mcp.js';
|
|
27
|
+
import { getCurrentVersion, checkForUpdates, printUpdateBanner } from './utils/update-check.js';
|
|
27
28
|
|
|
28
29
|
const program = new Command();
|
|
29
30
|
|
|
@@ -32,7 +33,7 @@ program
|
|
|
32
33
|
.description(
|
|
33
34
|
'Combine multiple repos into a workspace with rich AI assistant context',
|
|
34
35
|
)
|
|
35
|
-
.version(
|
|
36
|
+
.version(getCurrentVersion());
|
|
36
37
|
|
|
37
38
|
program
|
|
38
39
|
.command('create')
|
|
@@ -233,5 +234,48 @@ program
|
|
|
233
234
|
}
|
|
234
235
|
});
|
|
235
236
|
|
|
237
|
+
const mcp = program.command('mcp').description('Manage the NexusFlow MCP Server for AI assistants');
|
|
238
|
+
|
|
239
|
+
mcp
|
|
240
|
+
.command('run')
|
|
241
|
+
.description('Start the NexusFlow MCP Server (typically called automatically by AI assistants)')
|
|
242
|
+
.argument('[workspace]', 'Path to workspace (auto-detects from CWD)')
|
|
243
|
+
.action(async (workspace?: string) => {
|
|
244
|
+
try {
|
|
245
|
+
await mcpRunCommand(workspace);
|
|
246
|
+
} catch (error) {
|
|
247
|
+
console.error(error);
|
|
248
|
+
process.exit(1);
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
mcp
|
|
253
|
+
.command('setup')
|
|
254
|
+
.description('Automatically configure your AI environments (Claude Desktop, Cursor, VS Code) to use the NexusFlow MCP Server')
|
|
255
|
+
.action(async () => {
|
|
256
|
+
try {
|
|
257
|
+
await mcpSetupCommand();
|
|
258
|
+
} catch (error) {
|
|
259
|
+
console.error(error);
|
|
260
|
+
process.exit(1);
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
program.hook('postAction', async (thisCommand, actionCommand) => {
|
|
265
|
+
// Skip update check for MCP run to prevent contaminating stdout stream
|
|
266
|
+
if (actionCommand.name() === 'run' && actionCommand.parent?.name() === 'mcp') {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
try {
|
|
271
|
+
const status = await checkForUpdates();
|
|
272
|
+
if (status) {
|
|
273
|
+
printUpdateBanner(status);
|
|
274
|
+
}
|
|
275
|
+
} catch {
|
|
276
|
+
// Silently ignore to prevent crashing CLI
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
|
|
236
280
|
program.parse();
|
|
237
281
|
|