@memoraone/mcp 0.1.41 → 0.1.43
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/cli.cjs +654 -661
- package/dist/daemon.cjs +110 -71
- package/dist/index.cjs +110 -73
- package/dist/pluginPairing.cjs +10046 -0
- package/package.json +8 -1
package/dist/cli.cjs
CHANGED
|
@@ -231,9 +231,16 @@ var require_package = __commonJS({
|
|
|
231
231
|
"package.json"(exports2, module2) {
|
|
232
232
|
module2.exports = {
|
|
233
233
|
name: "@memoraone/mcp",
|
|
234
|
-
version: "0.1.
|
|
234
|
+
version: "0.1.43",
|
|
235
235
|
type: "module",
|
|
236
236
|
main: "dist/index.cjs",
|
|
237
|
+
exports: {
|
|
238
|
+
".": "./dist/index.cjs",
|
|
239
|
+
"./plugin-pairing": "./dist/pluginPairing.cjs",
|
|
240
|
+
"./dist/*": "./dist/*",
|
|
241
|
+
"./dist-bin/*": "./dist-bin/*",
|
|
242
|
+
"./package.json": "./package.json"
|
|
243
|
+
},
|
|
237
244
|
bin: {
|
|
238
245
|
"memoraone-mcp": "dist-bin/memoraone-mcp.cjs"
|
|
239
246
|
},
|
|
@@ -524,7 +531,7 @@ async function acquireLocalLock(lockName, options = {}) {
|
|
|
524
531
|
`[memoraone-mcp] Failed to acquire lock ${lockName} after ${maxRetries} retries`
|
|
525
532
|
);
|
|
526
533
|
}
|
|
527
|
-
await new Promise((
|
|
534
|
+
await new Promise((resolve40) => setTimeout(resolve40, retryDelayMs));
|
|
528
535
|
continue;
|
|
529
536
|
}
|
|
530
537
|
throw err;
|
|
@@ -1085,9 +1092,9 @@ var init_memoraClient = __esm({
|
|
|
1085
1092
|
});
|
|
1086
1093
|
|
|
1087
1094
|
// src/localState/localConnectClient.ts
|
|
1088
|
-
async function requestJson(baseUrl, method,
|
|
1095
|
+
async function requestJson(baseUrl, method, path44, options = {}) {
|
|
1089
1096
|
const fetchImpl = options.fetchImpl ?? fetch;
|
|
1090
|
-
const url = `${baseUrl.replace(/\/+$/, "")}${
|
|
1097
|
+
const url = `${baseUrl.replace(/\/+$/, "")}${path44.startsWith("/") ? path44 : `/${path44}`}`;
|
|
1091
1098
|
const res = await fetchImpl(url, {
|
|
1092
1099
|
method,
|
|
1093
1100
|
headers: {
|
|
@@ -1161,8 +1168,10 @@ async function redeemLocalConnectCode(apiUrl, body, options = {}) {
|
|
|
1161
1168
|
recovered: Boolean(data.recovered)
|
|
1162
1169
|
};
|
|
1163
1170
|
}
|
|
1171
|
+
var path8;
|
|
1164
1172
|
var init_localConnectClient = __esm({
|
|
1165
1173
|
"src/localState/localConnectClient.ts"() {
|
|
1174
|
+
path8 = __toESM(require("path"), 1);
|
|
1166
1175
|
init_memoraClient();
|
|
1167
1176
|
}
|
|
1168
1177
|
});
|
|
@@ -1186,7 +1195,7 @@ var init_tokenRefreshCoordinator = __esm({
|
|
|
1186
1195
|
|
|
1187
1196
|
// src/localState/resolveLocalBinding.ts
|
|
1188
1197
|
async function detectLegacyM1Warning(workspaceRoot) {
|
|
1189
|
-
const candidate =
|
|
1198
|
+
const candidate = path9.join(path9.resolve(workspaceRoot), CANONICAL_M1_FILENAME);
|
|
1190
1199
|
try {
|
|
1191
1200
|
await fs6.access(candidate);
|
|
1192
1201
|
return candidate;
|
|
@@ -1195,7 +1204,7 @@ async function detectLegacyM1Warning(workspaceRoot) {
|
|
|
1195
1204
|
}
|
|
1196
1205
|
}
|
|
1197
1206
|
async function ensureRepositoryBindingForRoot(workspaceRoot, options = {}) {
|
|
1198
|
-
const resolved =
|
|
1207
|
+
const resolved = path9.resolve(workspaceRoot);
|
|
1199
1208
|
const identity = await captureRootFilesystemIdentity(resolved, options.identityDeps);
|
|
1200
1209
|
const legacyM1WarningPath = await detectLegacyM1Warning(resolved);
|
|
1201
1210
|
const index = await loadPathIndex(options.homeDir);
|
|
@@ -1203,7 +1212,7 @@ async function ensureRepositoryBindingForRoot(workspaceRoot, options = {}) {
|
|
|
1203
1212
|
if (lookup.kind === "path") {
|
|
1204
1213
|
const record = await readBindingRecord(lookup.repositoryBindingId, options.homeDir);
|
|
1205
1214
|
if (record && identityMatchesStored(record.filesystemIdentity, identity)) {
|
|
1206
|
-
if (
|
|
1215
|
+
if (path9.resolve(record.workspaceRoot) !== resolved) {
|
|
1207
1216
|
const updated = {
|
|
1208
1217
|
...record,
|
|
1209
1218
|
workspaceRoot: resolved,
|
|
@@ -1265,7 +1274,7 @@ async function ensureRepositoryBindingForRoot(workspaceRoot, options = {}) {
|
|
|
1265
1274
|
};
|
|
1266
1275
|
}
|
|
1267
1276
|
async function resolveLocalBinding(workspaceRoot, options = {}) {
|
|
1268
|
-
const resolved =
|
|
1277
|
+
const resolved = path9.resolve(workspaceRoot);
|
|
1269
1278
|
const { repositoryBindingId, legacyM1WarningPath } = await ensureRepositoryBindingForRoot(
|
|
1270
1279
|
resolved,
|
|
1271
1280
|
{ ...options, createIfMissing: false }
|
|
@@ -1313,11 +1322,11 @@ async function resolveLocalBinding(workspaceRoot, options = {}) {
|
|
|
1313
1322
|
legacyM1WarningPath
|
|
1314
1323
|
};
|
|
1315
1324
|
}
|
|
1316
|
-
var fs6,
|
|
1325
|
+
var fs6, path9;
|
|
1317
1326
|
var init_resolveLocalBinding = __esm({
|
|
1318
1327
|
"src/localState/resolveLocalBinding.ts"() {
|
|
1319
1328
|
fs6 = __toESM(require("fs/promises"), 1);
|
|
1320
|
-
|
|
1329
|
+
path9 = __toESM(require("path"), 1);
|
|
1321
1330
|
init_projectBinding();
|
|
1322
1331
|
init_bindingStore();
|
|
1323
1332
|
init_installationCredentials();
|
|
@@ -1349,7 +1358,7 @@ function toResolvedBinding(local) {
|
|
|
1349
1358
|
};
|
|
1350
1359
|
}
|
|
1351
1360
|
async function warnLegacyM1IfPresent(workspaceRoot) {
|
|
1352
|
-
const candidate =
|
|
1361
|
+
const candidate = path10.join(path10.resolve(workspaceRoot), CANONICAL_M1_FILENAME);
|
|
1353
1362
|
try {
|
|
1354
1363
|
await fs7.access(candidate);
|
|
1355
1364
|
process.stderr.write(
|
|
@@ -1408,7 +1417,7 @@ function normalizeWorkspaceSearchRoots(workspaceRoot) {
|
|
|
1408
1417
|
if (raw === void 0) continue;
|
|
1409
1418
|
const trimmed = String(raw).trim();
|
|
1410
1419
|
if (trimmed === "") continue;
|
|
1411
|
-
const resolved =
|
|
1420
|
+
const resolved = path10.resolve(trimmed);
|
|
1412
1421
|
if (!seen.has(resolved)) {
|
|
1413
1422
|
seen.add(resolved);
|
|
1414
1423
|
out.push(resolved);
|
|
@@ -1419,17 +1428,17 @@ function normalizeWorkspaceSearchRoots(workspaceRoot) {
|
|
|
1419
1428
|
function bindingRelevantValuesMatch(a, b) {
|
|
1420
1429
|
const envA = a.environment ?? void 0;
|
|
1421
1430
|
const envB = b.environment ?? void 0;
|
|
1422
|
-
return a.repositoryBindingId === b.repositoryBindingId && a.projectId.trim().toLowerCase() === b.projectId.trim().toLowerCase() &&
|
|
1431
|
+
return a.repositoryBindingId === b.repositoryBindingId && a.projectId.trim().toLowerCase() === b.projectId.trim().toLowerCase() && path10.resolve(a.workspaceRoot) === path10.resolve(b.workspaceRoot) && (a.installationPublicId ?? void 0) === (b.installationPublicId ?? void 0) && envA === envB && a.status === b.status;
|
|
1423
1432
|
}
|
|
1424
|
-
async function reconcileResolvedBindingWithDisk(cached) {
|
|
1433
|
+
async function reconcileResolvedBindingWithDisk(cached, options = {}) {
|
|
1425
1434
|
const repositoryBindingId = assertRepositoryBindingId(cached.repositoryBindingId);
|
|
1426
|
-
const record = await readBindingRecord(repositoryBindingId);
|
|
1435
|
+
const record = await readBindingRecord(repositoryBindingId, options.homeDir);
|
|
1427
1436
|
if (!record) {
|
|
1428
1437
|
throw new ReconnectRequiredError(
|
|
1429
1438
|
`[memoraone-mcp] Cached binding missing for ${repositoryBindingId}. Run: memoraone-mcp connect <code>`
|
|
1430
1439
|
);
|
|
1431
1440
|
}
|
|
1432
|
-
const workspaceRoot =
|
|
1441
|
+
const workspaceRoot = path10.resolve(record.workspaceRoot);
|
|
1433
1442
|
const identity = await captureRootFilesystemIdentity(workspaceRoot);
|
|
1434
1443
|
if (!identitiesMatch(record.filesystemIdentity, identity)) {
|
|
1435
1444
|
throw new ReconnectRequiredError(
|
|
@@ -1512,11 +1521,11 @@ function decodeResolvedBinding(value) {
|
|
|
1512
1521
|
status
|
|
1513
1522
|
};
|
|
1514
1523
|
}
|
|
1515
|
-
var fs7,
|
|
1524
|
+
var fs7, path10, uuidRegex, CANONICAL_M1_FILENAME;
|
|
1516
1525
|
var init_projectBinding = __esm({
|
|
1517
1526
|
"src/projectBinding.ts"() {
|
|
1518
1527
|
fs7 = __toESM(require("fs/promises"), 1);
|
|
1519
|
-
|
|
1528
|
+
path10 = __toESM(require("path"), 1);
|
|
1520
1529
|
init_resolveLocalBinding();
|
|
1521
1530
|
init_bindingStore();
|
|
1522
1531
|
init_rootFilesystemIdentity();
|
|
@@ -1590,7 +1599,7 @@ function isDaemonBindingMismatchError(err) {
|
|
|
1590
1599
|
}
|
|
1591
1600
|
function formatBindingMismatchError(socketPath, sidecar, expected, detail) {
|
|
1592
1601
|
const lines = [
|
|
1593
|
-
`[memoraone-mcp] Daemon socket binding mismatch at ${
|
|
1602
|
+
`[memoraone-mcp] Daemon socket binding mismatch at ${path11.basename(socketPath)}.`,
|
|
1594
1603
|
` socket: binding=${sidecar.repositoryBindingId} project=${sidecar.projectId} workspace=${sidecar.workspaceRoot}`,
|
|
1595
1604
|
` session: binding=${expected.repositoryBindingId} project=${expected.projectId} workspace=${expected.workspaceRoot}`
|
|
1596
1605
|
];
|
|
@@ -1625,11 +1634,11 @@ function verifyDaemonSidecarBinding(socketPath, expected, env2 = process.env, id
|
|
|
1625
1634
|
}
|
|
1626
1635
|
return sidecar;
|
|
1627
1636
|
}
|
|
1628
|
-
var fs8,
|
|
1637
|
+
var fs8, path11;
|
|
1629
1638
|
var init_bindingSidecar = __esm({
|
|
1630
1639
|
"src/bindingSidecar.ts"() {
|
|
1631
1640
|
fs8 = __toESM(require("fs"), 1);
|
|
1632
|
-
|
|
1641
|
+
path11 = __toESM(require("path"), 1);
|
|
1633
1642
|
init_bindingIdentity();
|
|
1634
1643
|
init_projectBinding();
|
|
1635
1644
|
init_socketPaths();
|
|
@@ -1654,8 +1663,8 @@ function getEnvWorkspaceRootCandidates() {
|
|
|
1654
1663
|
const raw = process.env.WORKSPACE_FOLDER_PATHS;
|
|
1655
1664
|
const parts = [];
|
|
1656
1665
|
if (raw !== void 0 && raw.trim() !== "") {
|
|
1657
|
-
for (const p of raw.split(
|
|
1658
|
-
parts.push(
|
|
1666
|
+
for (const p of raw.split(path12.delimiter).map((s) => s.trim()).filter(Boolean)) {
|
|
1667
|
+
parts.push(path12.resolve(p));
|
|
1659
1668
|
}
|
|
1660
1669
|
}
|
|
1661
1670
|
parts.push(process.cwd());
|
|
@@ -1679,7 +1688,7 @@ function extractWorkspaceRootsFromInitialize(params) {
|
|
|
1679
1688
|
if (uri === void 0 || uri.trim() === "") {
|
|
1680
1689
|
return;
|
|
1681
1690
|
}
|
|
1682
|
-
const resolved =
|
|
1691
|
+
const resolved = path12.resolve(uriToPath(uri));
|
|
1683
1692
|
if (!seen.has(resolved)) {
|
|
1684
1693
|
seen.add(resolved);
|
|
1685
1694
|
roots.push(resolved);
|
|
@@ -1701,7 +1710,7 @@ function getRepoScopedWorkspaceHint(env2 = process.env) {
|
|
|
1701
1710
|
if (raw === void 0 || raw.trim() === "") {
|
|
1702
1711
|
return null;
|
|
1703
1712
|
}
|
|
1704
|
-
return
|
|
1713
|
+
return path12.resolve(raw.trim());
|
|
1705
1714
|
}
|
|
1706
1715
|
function formatWorkspaceAmbiguityError(bindings) {
|
|
1707
1716
|
const lines = bindings.map(
|
|
@@ -1777,8 +1786,8 @@ async function resolveBindingFromInitializeParams(params, options = {}) {
|
|
|
1777
1786
|
const rootsListUris = options.rootsListUris ?? [];
|
|
1778
1787
|
const rootsListPaths = rootsListUris.map((uri) => uriToPath(uri)).filter(Boolean);
|
|
1779
1788
|
if (rootsListPaths.length > 1 && repoHint !== null) {
|
|
1780
|
-
const hintResolved =
|
|
1781
|
-
const matchingRoot = rootsListPaths.find((root) =>
|
|
1789
|
+
const hintResolved = path12.resolve(repoHint);
|
|
1790
|
+
const matchingRoot = rootsListPaths.find((root) => path12.resolve(root) === hintResolved);
|
|
1782
1791
|
if (!matchingRoot) {
|
|
1783
1792
|
throw new Error(formatRepoHintNotInRootsListError(repoHint, rootsListPaths));
|
|
1784
1793
|
}
|
|
@@ -1803,10 +1812,10 @@ async function resolveBindingFromInitializeParams(params, options = {}) {
|
|
|
1803
1812
|
respectExplicitM1Path: options.respectExplicitM1Path
|
|
1804
1813
|
});
|
|
1805
1814
|
}
|
|
1806
|
-
var
|
|
1815
|
+
var path12, import_node_url, MEMORAONE_WORKSPACE_ROOT_ENV;
|
|
1807
1816
|
var init_initializeBinding = __esm({
|
|
1808
1817
|
"src/initializeBinding.ts"() {
|
|
1809
|
-
|
|
1818
|
+
path12 = __toESM(require("path"), 1);
|
|
1810
1819
|
import_node_url = require("url");
|
|
1811
1820
|
init_bindingIdentity();
|
|
1812
1821
|
init_projectBinding();
|
|
@@ -1825,34 +1834,34 @@ async function pathExists(filePath) {
|
|
|
1825
1834
|
}
|
|
1826
1835
|
}
|
|
1827
1836
|
async function findMonorepoCliFrom(startDir) {
|
|
1828
|
-
let current =
|
|
1829
|
-
const root =
|
|
1837
|
+
let current = path13.resolve(startDir);
|
|
1838
|
+
const root = path13.parse(current).root;
|
|
1830
1839
|
while (true) {
|
|
1831
|
-
const candidate =
|
|
1840
|
+
const candidate = path13.join(current, MONOREPO_CLI_REL);
|
|
1832
1841
|
if (await pathExists(candidate)) {
|
|
1833
|
-
return
|
|
1842
|
+
return path13.resolve(candidate);
|
|
1834
1843
|
}
|
|
1835
1844
|
if (current === root) break;
|
|
1836
|
-
current =
|
|
1845
|
+
current = path13.dirname(current);
|
|
1837
1846
|
}
|
|
1838
1847
|
return null;
|
|
1839
1848
|
}
|
|
1840
1849
|
async function resolveFromRunningScript() {
|
|
1841
1850
|
if (!process.argv[1]) return null;
|
|
1842
|
-
const script =
|
|
1843
|
-
const base =
|
|
1851
|
+
const script = path13.resolve(process.argv[1]);
|
|
1852
|
+
const base = path13.basename(script);
|
|
1844
1853
|
if ((base === "cli.cjs" || base === "cli.ts" || base === "memoraone-mcp.cjs") && await pathExists(script)) {
|
|
1845
1854
|
return script;
|
|
1846
1855
|
}
|
|
1847
|
-
const here =
|
|
1856
|
+
const here = path13.dirname(script);
|
|
1848
1857
|
const candidates = [
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1858
|
+
path13.join(here, "cli.cjs"),
|
|
1859
|
+
path13.join(here, "..", "dist", "cli.cjs"),
|
|
1860
|
+
path13.join(here, "..", "..", "dist", "cli.cjs")
|
|
1852
1861
|
];
|
|
1853
1862
|
for (const candidate of candidates) {
|
|
1854
1863
|
if (await pathExists(candidate)) {
|
|
1855
|
-
return
|
|
1864
|
+
return path13.resolve(candidate);
|
|
1856
1865
|
}
|
|
1857
1866
|
}
|
|
1858
1867
|
return null;
|
|
@@ -1871,7 +1880,7 @@ async function resolveBuiltCliPathAsync(options) {
|
|
|
1871
1880
|
searchDirs.push(process.cwd());
|
|
1872
1881
|
const seen = /* @__PURE__ */ new Set();
|
|
1873
1882
|
for (const dir of searchDirs) {
|
|
1874
|
-
const key =
|
|
1883
|
+
const key = path13.resolve(dir);
|
|
1875
1884
|
if (seen.has(key)) continue;
|
|
1876
1885
|
seen.add(key);
|
|
1877
1886
|
const found = await findMonorepoCliFrom(key);
|
|
@@ -1882,12 +1891,12 @@ async function resolveBuiltCliPathAsync(options) {
|
|
|
1882
1891
|
}
|
|
1883
1892
|
return null;
|
|
1884
1893
|
}
|
|
1885
|
-
var fs9,
|
|
1894
|
+
var fs9, path13, MONOREPO_CLI_REL;
|
|
1886
1895
|
var init_resolveBuiltCliPath = __esm({
|
|
1887
1896
|
"src/resolveBuiltCliPath.ts"() {
|
|
1888
1897
|
fs9 = __toESM(require("fs/promises"), 1);
|
|
1889
|
-
|
|
1890
|
-
MONOREPO_CLI_REL =
|
|
1898
|
+
path13 = __toESM(require("path"), 1);
|
|
1899
|
+
MONOREPO_CLI_REL = path13.join("packages", "mcp", "dist", "cli.cjs");
|
|
1891
1900
|
}
|
|
1892
1901
|
});
|
|
1893
1902
|
|
|
@@ -1922,7 +1931,7 @@ function looksLikeLocalMonorepoCliPath(scriptPath) {
|
|
|
1922
1931
|
if (normalized.includes("/node_modules/@memoraone/mcp/")) return false;
|
|
1923
1932
|
if (normalized.includes("/.npm/_npx/")) return false;
|
|
1924
1933
|
if (normalized.includes("/_npx/")) return false;
|
|
1925
|
-
const base =
|
|
1934
|
+
const base = path14.basename(normalized);
|
|
1926
1935
|
if (base === "cli.ts" || base === "cli.cjs" || base === "memoraone-mcp.cjs") {
|
|
1927
1936
|
if (normalized.includes("/packages/mcp/dist/") || normalized.includes("/packages/mcp/dist-bin/") || normalized.includes("/packages/mcp/src/")) {
|
|
1928
1937
|
return true;
|
|
@@ -1943,7 +1952,7 @@ function channelFromEnv(env2) {
|
|
|
1943
1952
|
async function resolvePackageExecutionMode(options = {}) {
|
|
1944
1953
|
if (options.executionMode) return options.executionMode;
|
|
1945
1954
|
const env2 = options.env ?? process.env;
|
|
1946
|
-
const scriptPath = options.scriptPath !== void 0 ? options.scriptPath : process.argv[1] ?
|
|
1955
|
+
const scriptPath = options.scriptPath !== void 0 ? options.scriptPath : process.argv[1] ? path14.resolve(process.argv[1]) : null;
|
|
1947
1956
|
if (scriptPath && looksLikePublishedPackagePath(scriptPath)) {
|
|
1948
1957
|
const channel2 = channelFromEnv(env2) ?? npmPackageChannelFromApiUrl(options.apiUrl);
|
|
1949
1958
|
return { kind: "published", channel: channel2 };
|
|
@@ -1952,7 +1961,7 @@ async function resolvePackageExecutionMode(options = {}) {
|
|
|
1952
1961
|
return { kind: "local", cliPath: scriptPath };
|
|
1953
1962
|
}
|
|
1954
1963
|
if (options.cliPath) {
|
|
1955
|
-
return { kind: "local", cliPath:
|
|
1964
|
+
return { kind: "local", cliPath: path14.resolve(options.cliPath) };
|
|
1956
1965
|
}
|
|
1957
1966
|
const resolveCli = options.resolveBuiltCliPath ?? resolveBuiltCliPathAsync;
|
|
1958
1967
|
const builtCli = await resolveCli();
|
|
@@ -1988,10 +1997,10 @@ function formatIdeSetupRepairHint(workspaceRoot, mode) {
|
|
|
1988
1997
|
const stagingFlag = mode.channel === "staging" ? " --staging" : "";
|
|
1989
1998
|
return `Repair with (no new connect code): npx -y ${spec} setup-ide-files --all${stagingFlag} --force --workspace-root ${workspaceRoot}`;
|
|
1990
1999
|
}
|
|
1991
|
-
var
|
|
2000
|
+
var path14, PROD_API_URL, STAGING_API_URL, STAGING_API_URL_PREFIX;
|
|
1992
2001
|
var init_packageExecutionMode = __esm({
|
|
1993
2002
|
"src/packageExecutionMode.ts"() {
|
|
1994
|
-
|
|
2003
|
+
path14 = __toESM(require("path"), 1);
|
|
1995
2004
|
init_resolveBuiltCliPath();
|
|
1996
2005
|
PROD_API_URL = "https://api.memoraone.com";
|
|
1997
2006
|
STAGING_API_URL = "https://memora-api-staging-phbtrzocjq-uk.a.run.app";
|
|
@@ -2005,7 +2014,14 @@ function normalizeMemoraoneServerName(name) {
|
|
|
2005
2014
|
}
|
|
2006
2015
|
function isMemoraoneOwnedServerName(name) {
|
|
2007
2016
|
if (typeof name !== "string" || name.trim() === "") return false;
|
|
2008
|
-
|
|
2017
|
+
const trimmed = name.trim();
|
|
2018
|
+
return OWNED_NAME_NORMALIZED.has(normalizeMemoraoneServerName(trimmed)) || REPOSITORY_SERVER_KEY_RE.test(trimmed);
|
|
2019
|
+
}
|
|
2020
|
+
function memoraoneServerNameForRepositoryBinding(repositoryBindingId) {
|
|
2021
|
+
const id = repositoryBindingId.trim();
|
|
2022
|
+
if (id === "") throw new Error("repository_binding_id is required for global MCP ownership");
|
|
2023
|
+
const suffix = (0, import_node_crypto4.createHash)("sha256").update(id, "utf8").digest("hex").slice(0, 16);
|
|
2024
|
+
return `${MEMORAONE_REPOSITORY_SERVER_NAME_PREFIX}${suffix}`;
|
|
2009
2025
|
}
|
|
2010
2026
|
function collectCommandTokens(entry) {
|
|
2011
2027
|
const tokens = [];
|
|
@@ -2032,6 +2048,12 @@ function envRecordFromEntry(entry) {
|
|
|
2032
2048
|
}
|
|
2033
2049
|
return null;
|
|
2034
2050
|
}
|
|
2051
|
+
function memoraoneWorkspaceRootFromServerEntry(entry) {
|
|
2052
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry)) return void 0;
|
|
2053
|
+
const env2 = envRecordFromEntry(entry);
|
|
2054
|
+
const root = env2?.MEMORAONE_WORKSPACE_ROOT;
|
|
2055
|
+
return typeof root === "string" && root.trim() !== "" ? path15.resolve(root) : void 0;
|
|
2056
|
+
}
|
|
2035
2057
|
function tokensInvokeMemoraone(tokens) {
|
|
2036
2058
|
for (const token of tokens) {
|
|
2037
2059
|
if (MEMORAONE_PACKAGE_SPEC_RE.test(token)) return true;
|
|
@@ -2052,6 +2074,17 @@ function envLooksMemoraoneOwned(env2) {
|
|
|
2052
2074
|
if (typeof env2.MEMORAONE_API_KEY === "string") return true;
|
|
2053
2075
|
return false;
|
|
2054
2076
|
}
|
|
2077
|
+
function entryContainsLegacyCredentialFields(entry) {
|
|
2078
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry)) return false;
|
|
2079
|
+
const value = entry;
|
|
2080
|
+
const env2 = envRecordFromEntry(value);
|
|
2081
|
+
if (env2 && ("MEMORAONE_API_KEY" in env2 || "MEMORAONE_M1_PATH" in env2)) return true;
|
|
2082
|
+
if (value.headers && typeof value.headers === "object" && !Array.isArray(value.headers)) {
|
|
2083
|
+
const headers = value.headers;
|
|
2084
|
+
return Object.keys(headers).some((key) => key.toLowerCase() === "authorization");
|
|
2085
|
+
}
|
|
2086
|
+
return false;
|
|
2087
|
+
}
|
|
2055
2088
|
function isMemoraoneOwnedServerEntry(entry) {
|
|
2056
2089
|
if (!entry || typeof entry !== "object" || Array.isArray(entry)) return false;
|
|
2057
2090
|
const s = entry;
|
|
@@ -2084,6 +2117,55 @@ function replaceMemoraoneOwnedInServerMap(servers, canonical) {
|
|
|
2084
2117
|
next[CANONICAL_MEMORAONE_MCP_SERVER_NAME] = canonical;
|
|
2085
2118
|
return next;
|
|
2086
2119
|
}
|
|
2120
|
+
function replaceMemoraoneRepositoryBindingInServerMap(servers, canonical, ownership) {
|
|
2121
|
+
const generatedTargetKey = memoraoneServerNameForRepositoryBinding(
|
|
2122
|
+
ownership.repositoryBindingId
|
|
2123
|
+
);
|
|
2124
|
+
const targetRoot = path15.resolve(ownership.workspaceRoot);
|
|
2125
|
+
const matchingRootKeys = Object.entries(servers).filter(
|
|
2126
|
+
([key, value]) => REPOSITORY_SERVER_KEY_RE.test(key) && memoraoneWorkspaceRootFromServerEntry(value) === targetRoot
|
|
2127
|
+
).map(([key]) => key).sort();
|
|
2128
|
+
const targetKey = matchingRootKeys.includes(generatedTargetKey) ? generatedTargetKey : matchingRootKeys[0] ?? generatedTargetKey;
|
|
2129
|
+
const staleKeys = new Set(
|
|
2130
|
+
(ownership.replacedRepositoryBindingIds ?? []).map(memoraoneServerNameForRepositoryBinding)
|
|
2131
|
+
);
|
|
2132
|
+
staleKeys.add(generatedTargetKey);
|
|
2133
|
+
staleKeys.delete(targetKey);
|
|
2134
|
+
const next = {};
|
|
2135
|
+
for (const [key, value] of Object.entries(servers)) {
|
|
2136
|
+
if (staleKeys.has(key)) continue;
|
|
2137
|
+
if (matchingRootKeys.includes(key)) continue;
|
|
2138
|
+
if (isMemoraoneOwnedServerName(key) && !REPOSITORY_SERVER_KEY_RE.test(key) && entryContainsLegacyCredentialFields(value)) {
|
|
2139
|
+
continue;
|
|
2140
|
+
}
|
|
2141
|
+
if (isMemoraoneOwnedServerName(key) && !REPOSITORY_SERVER_KEY_RE.test(key) && memoraoneWorkspaceRootFromServerEntry(value) === targetRoot) {
|
|
2142
|
+
continue;
|
|
2143
|
+
}
|
|
2144
|
+
next[key] = value;
|
|
2145
|
+
}
|
|
2146
|
+
next[targetKey] = canonical;
|
|
2147
|
+
return next;
|
|
2148
|
+
}
|
|
2149
|
+
function stripMemoraoneRepositoryBindingFromServerMap(servers, ownership) {
|
|
2150
|
+
const keys = /* @__PURE__ */ new Set([
|
|
2151
|
+
memoraoneServerNameForRepositoryBinding(ownership.repositoryBindingId),
|
|
2152
|
+
...(ownership.replacedRepositoryBindingIds ?? []).map(
|
|
2153
|
+
memoraoneServerNameForRepositoryBinding
|
|
2154
|
+
)
|
|
2155
|
+
]);
|
|
2156
|
+
const targetRoot = path15.resolve(ownership.workspaceRoot);
|
|
2157
|
+
const next = {};
|
|
2158
|
+
const removedKeys = [];
|
|
2159
|
+
for (const [key, value] of Object.entries(servers)) {
|
|
2160
|
+
const matchingWorkspace = isMemoraoneOwnedServerName(key) && memoraoneWorkspaceRootFromServerEntry(value) === targetRoot;
|
|
2161
|
+
if (keys.has(key) || matchingWorkspace) {
|
|
2162
|
+
removedKeys.push(key);
|
|
2163
|
+
} else {
|
|
2164
|
+
next[key] = value;
|
|
2165
|
+
}
|
|
2166
|
+
}
|
|
2167
|
+
return { next, removedKeys };
|
|
2168
|
+
}
|
|
2087
2169
|
function stripMemoraoneOwnedFromServerList(servers) {
|
|
2088
2170
|
const next = [];
|
|
2089
2171
|
let removedCount = 0;
|
|
@@ -2122,10 +2204,14 @@ function canonicalValueMatches(actual, expected) {
|
|
|
2122
2204
|
}
|
|
2123
2205
|
return false;
|
|
2124
2206
|
}
|
|
2125
|
-
var CANONICAL_MEMORAONE_MCP_SERVER_NAME, LEGACY_MEMORAONE_SERVER_NAME_ALIASES, OWNED_NAME_NORMALIZED, MEMORAONE_PACKAGE_SPEC_RE, MEMORAONE_CLI_TOKEN_RE, MEMORAONE_LOCAL_CLI_PATH_RE, MEMORAONE_OWNED_SERVER_NAME_ALIASES;
|
|
2207
|
+
var import_node_crypto4, path15, CANONICAL_MEMORAONE_MCP_SERVER_NAME, MEMORAONE_REPOSITORY_SERVER_NAME_PREFIX, REPOSITORY_SERVER_KEY_RE, LEGACY_MEMORAONE_SERVER_NAME_ALIASES, OWNED_NAME_NORMALIZED, MEMORAONE_PACKAGE_SPEC_RE, MEMORAONE_CLI_TOKEN_RE, MEMORAONE_LOCAL_CLI_PATH_RE, MEMORAONE_OWNED_SERVER_NAME_ALIASES;
|
|
2126
2208
|
var init_memoraoneMcpOwnership = __esm({
|
|
2127
2209
|
"src/memoraoneMcpOwnership.ts"() {
|
|
2210
|
+
import_node_crypto4 = require("crypto");
|
|
2211
|
+
path15 = __toESM(require("path"), 1);
|
|
2128
2212
|
CANONICAL_MEMORAONE_MCP_SERVER_NAME = "memoraone";
|
|
2213
|
+
MEMORAONE_REPOSITORY_SERVER_NAME_PREFIX = "memoraone-";
|
|
2214
|
+
REPOSITORY_SERVER_KEY_RE = /^memoraone-[0-9a-f]{16}$/;
|
|
2129
2215
|
LEGACY_MEMORAONE_SERVER_NAME_ALIASES = [
|
|
2130
2216
|
"memoraone",
|
|
2131
2217
|
"memora-one",
|
|
@@ -2168,7 +2254,7 @@ function buildMemoraoneCursorMcpServer(options) {
|
|
|
2168
2254
|
env2.MEMORAONE_IDE_TYPE = ideType;
|
|
2169
2255
|
}
|
|
2170
2256
|
if (options.workspaceRoot !== void 0) {
|
|
2171
|
-
env2[MEMORAONE_WORKSPACE_ROOT_ENV] =
|
|
2257
|
+
env2[MEMORAONE_WORKSPACE_ROOT_ENV] = path16.resolve(options.workspaceRoot);
|
|
2172
2258
|
}
|
|
2173
2259
|
if (options.environment === "local") {
|
|
2174
2260
|
if (!options.cliPath) {
|
|
@@ -2204,7 +2290,7 @@ function stripLeadingLineComments(text) {
|
|
|
2204
2290
|
return text.split("\n").filter((line) => !/^\s*\/\//.test(line)).join("\n");
|
|
2205
2291
|
}
|
|
2206
2292
|
function getKnownCursorGlobalMcpConfigCandidates(homeDir) {
|
|
2207
|
-
return [
|
|
2293
|
+
return [path16.join(homeDir, ".cursor", "mcp.json")];
|
|
2208
2294
|
}
|
|
2209
2295
|
async function detectCursorGlobalMcpConfig(options) {
|
|
2210
2296
|
if (options?.explicitPath) {
|
|
@@ -2267,7 +2353,7 @@ async function resolveNpxPath() {
|
|
|
2267
2353
|
const pathSep = process.platform === "win32" ? ";" : ":";
|
|
2268
2354
|
for (const dir of (process.env.PATH ?? "").split(pathSep)) {
|
|
2269
2355
|
if (!dir) continue;
|
|
2270
|
-
candidates.push(
|
|
2356
|
+
candidates.push(path16.join(dir, npxName));
|
|
2271
2357
|
}
|
|
2272
2358
|
try {
|
|
2273
2359
|
const lookupCmd = process.platform === "win32" ? "where" : "which";
|
|
@@ -2278,7 +2364,7 @@ async function resolveNpxPath() {
|
|
|
2278
2364
|
}
|
|
2279
2365
|
const seen = /* @__PURE__ */ new Set();
|
|
2280
2366
|
for (const candidate of candidates) {
|
|
2281
|
-
const abs =
|
|
2367
|
+
const abs = path16.isAbsolute(candidate) ? candidate : path16.resolve(candidate);
|
|
2282
2368
|
const key = process.platform === "win32" ? abs.toLowerCase() : abs;
|
|
2283
2369
|
if (seen.has(key)) continue;
|
|
2284
2370
|
seen.add(key);
|
|
@@ -2338,7 +2424,7 @@ function mergeClaudeCodeMcpConfigObject(existing, writeOptions) {
|
|
|
2338
2424
|
};
|
|
2339
2425
|
}
|
|
2340
2426
|
function getClaudeCodeMcpConfigPath(repoRoot) {
|
|
2341
|
-
return
|
|
2427
|
+
return path16.join(path16.resolve(repoRoot), ".mcp.json");
|
|
2342
2428
|
}
|
|
2343
2429
|
function isMemoraoneManagedApiUrl(url) {
|
|
2344
2430
|
if (typeof url !== "string" || url.length === 0) return false;
|
|
@@ -2387,7 +2473,7 @@ function memoraoneServerMatches(server, matchOptions) {
|
|
|
2387
2473
|
if (e.MEMORAONE_IDE_TYPE !== "cursor") return false;
|
|
2388
2474
|
const workspaceRoot = e[MEMORAONE_WORKSPACE_ROOT_ENV];
|
|
2389
2475
|
if (matchOptions.repoRoot !== void 0) {
|
|
2390
|
-
return typeof workspaceRoot === "string" &&
|
|
2476
|
+
return typeof workspaceRoot === "string" && path16.resolve(workspaceRoot) === path16.resolve(matchOptions.repoRoot);
|
|
2391
2477
|
}
|
|
2392
2478
|
return workspaceRoot === void 0;
|
|
2393
2479
|
}
|
|
@@ -2422,7 +2508,7 @@ function validateCursorRepoMcpConfig(parsed2, matchOptions) {
|
|
|
2422
2508
|
}
|
|
2423
2509
|
}
|
|
2424
2510
|
function getCursorRepoMcpConfigPath(repoRoot) {
|
|
2425
|
-
return
|
|
2511
|
+
return path16.join(repoRoot, ".cursor", "mcp.json");
|
|
2426
2512
|
}
|
|
2427
2513
|
async function readCursorMcpConfigObject(configPath) {
|
|
2428
2514
|
try {
|
|
@@ -2453,12 +2539,12 @@ async function removeMemoraoneFromCursorGlobalConfig(options) {
|
|
|
2453
2539
|
return { changed: true, backupPath };
|
|
2454
2540
|
}
|
|
2455
2541
|
const next = { ...parsed2, mcpServers };
|
|
2456
|
-
await fs10.mkdir(
|
|
2542
|
+
await fs10.mkdir(path16.dirname(configPath), { recursive: true });
|
|
2457
2543
|
await fs10.writeFile(configPath, JSON.stringify(next, null, 2) + "\n", "utf8");
|
|
2458
2544
|
return { changed: true, backupPath };
|
|
2459
2545
|
}
|
|
2460
2546
|
async function auditCursorMcpConfig(options) {
|
|
2461
|
-
const repoRoot =
|
|
2547
|
+
const repoRoot = path16.resolve(options?.repoRoot ?? process.cwd());
|
|
2462
2548
|
const repoConfigPath = getCursorRepoMcpConfigPath(repoRoot);
|
|
2463
2549
|
const globalDetection = await detectCursorGlobalMcpConfig({
|
|
2464
2550
|
homeDir: options?.homeDir,
|
|
@@ -2560,12 +2646,12 @@ function logCursorMcpCliSummary(info, dryRun, opts) {
|
|
|
2560
2646
|
);
|
|
2561
2647
|
}
|
|
2562
2648
|
}
|
|
2563
|
-
var fs10, os4,
|
|
2649
|
+
var fs10, os4, path16, import_node_child_process2, import_node_util2, execFileAsync2, MEMORAONE_PROD_API_URL, MEMORAONE_LOCAL_API_URL, MEMORAONE_STAGING_API_URL, MEMORAONE_STAGING_API_URL_PREFIX;
|
|
2564
2650
|
var init_cursorGlobalMcpConfig = __esm({
|
|
2565
2651
|
"src/cursorGlobalMcpConfig.ts"() {
|
|
2566
2652
|
fs10 = __toESM(require("fs/promises"), 1);
|
|
2567
2653
|
os4 = __toESM(require("os"), 1);
|
|
2568
|
-
|
|
2654
|
+
path16 = __toESM(require("path"), 1);
|
|
2569
2655
|
import_node_child_process2 = require("child_process");
|
|
2570
2656
|
import_node_util2 = require("util");
|
|
2571
2657
|
init_initializeBinding();
|
|
@@ -2791,7 +2877,7 @@ async function defaultListSocketPaths(projectId) {
|
|
|
2791
2877
|
if (!name.endsWith(".sock") || !isMemoraoneSocketFilename(name)) {
|
|
2792
2878
|
continue;
|
|
2793
2879
|
}
|
|
2794
|
-
const socketPath =
|
|
2880
|
+
const socketPath = path17.join(baseDir, name);
|
|
2795
2881
|
if (projectId === null) {
|
|
2796
2882
|
paths.push(socketPath);
|
|
2797
2883
|
continue;
|
|
@@ -2811,7 +2897,7 @@ async function defaultListSocketPaths(projectId) {
|
|
|
2811
2897
|
return paths.sort();
|
|
2812
2898
|
}
|
|
2813
2899
|
async function defaultListSocketPathsForWorkspaceRoot(workspaceRoot) {
|
|
2814
|
-
const resolvedRoot =
|
|
2900
|
+
const resolvedRoot = path17.resolve(workspaceRoot);
|
|
2815
2901
|
const baseDir = getMcpBaseDir();
|
|
2816
2902
|
let entries;
|
|
2817
2903
|
try {
|
|
@@ -2828,36 +2914,36 @@ async function defaultListSocketPathsForWorkspaceRoot(workspaceRoot) {
|
|
|
2828
2914
|
if (!name.endsWith(".sock") || !isHashSocketFilename(name)) {
|
|
2829
2915
|
continue;
|
|
2830
2916
|
}
|
|
2831
|
-
const socketPath =
|
|
2917
|
+
const socketPath = path17.join(baseDir, name);
|
|
2832
2918
|
const record = readBindingSidecarRecord(socketPath);
|
|
2833
2919
|
if (!record?.workspaceRoot) continue;
|
|
2834
|
-
if (
|
|
2920
|
+
if (path17.resolve(record.workspaceRoot) === resolvedRoot) {
|
|
2835
2921
|
paths.push(socketPath);
|
|
2836
2922
|
}
|
|
2837
2923
|
}
|
|
2838
2924
|
return paths.sort();
|
|
2839
2925
|
}
|
|
2840
2926
|
async function defaultListSocketPathsForM1Path(m1Path) {
|
|
2841
|
-
return defaultListSocketPathsForWorkspaceRoot(
|
|
2927
|
+
return defaultListSocketPathsForWorkspaceRoot(path17.dirname(path17.resolve(m1Path)));
|
|
2842
2928
|
}
|
|
2843
2929
|
async function filterSocketPathsByIdeForCleanup(socketPaths, projectId, ide, workspaceRoot) {
|
|
2844
2930
|
if (ide === void 0) return socketPaths;
|
|
2845
2931
|
const normalizedProjectId = projectId.trim().toLowerCase();
|
|
2846
|
-
const resolvedRoot = workspaceRoot ?
|
|
2932
|
+
const resolvedRoot = workspaceRoot ? path17.resolve(workspaceRoot) : null;
|
|
2847
2933
|
const filtered = [];
|
|
2848
2934
|
for (const socketPath of socketPaths) {
|
|
2849
|
-
const
|
|
2850
|
-
if (isLegacySocketFilename(
|
|
2851
|
-
if (isSocketFilenameForProjectAndIde(
|
|
2935
|
+
const basename31 = path17.basename(socketPath);
|
|
2936
|
+
if (isLegacySocketFilename(basename31)) {
|
|
2937
|
+
if (isSocketFilenameForProjectAndIde(basename31, normalizedProjectId, ide)) {
|
|
2852
2938
|
filtered.push(socketPath);
|
|
2853
2939
|
}
|
|
2854
2940
|
continue;
|
|
2855
2941
|
}
|
|
2856
|
-
if (isHashSocketFilename(
|
|
2942
|
+
if (isHashSocketFilename(basename31)) {
|
|
2857
2943
|
const record = readBindingSidecarRecord(socketPath);
|
|
2858
2944
|
if (!record || record.ideType !== ide) continue;
|
|
2859
2945
|
const sameProject = record.projectId.trim().toLowerCase() === normalizedProjectId;
|
|
2860
|
-
const sameWorkspace = resolvedRoot !== null &&
|
|
2946
|
+
const sameWorkspace = resolvedRoot !== null && path17.resolve(record.workspaceRoot) === resolvedRoot;
|
|
2861
2947
|
if (sameProject || sameWorkspace) {
|
|
2862
2948
|
filtered.push(socketPath);
|
|
2863
2949
|
}
|
|
@@ -2889,7 +2975,7 @@ async function defaultConfirm(message) {
|
|
|
2889
2975
|
}
|
|
2890
2976
|
async function resolveCleanupTarget(cwd2) {
|
|
2891
2977
|
try {
|
|
2892
|
-
const binding = await resolveAuthoritativeBinding([
|
|
2978
|
+
const binding = await resolveAuthoritativeBinding([path17.resolve(cwd2)]);
|
|
2893
2979
|
return {
|
|
2894
2980
|
workspaceRoot: binding.workspaceRoot,
|
|
2895
2981
|
repositoryBindingId: binding.repositoryBindingId,
|
|
@@ -3085,7 +3171,7 @@ async function runCleanup(opts) {
|
|
|
3085
3171
|
projectIds.add(proc.projectId);
|
|
3086
3172
|
}
|
|
3087
3173
|
for (const socketPath of socketPaths) {
|
|
3088
|
-
const id = extractProjectIdFromSocketFilename(
|
|
3174
|
+
const id = extractProjectIdFromSocketFilename(path17.basename(socketPath));
|
|
3089
3175
|
if (id) {
|
|
3090
3176
|
projectIds.add(id);
|
|
3091
3177
|
continue;
|
|
@@ -3268,11 +3354,11 @@ async function cliCleanup(argv) {
|
|
|
3268
3354
|
}
|
|
3269
3355
|
return result.exitCode;
|
|
3270
3356
|
}
|
|
3271
|
-
var fs11,
|
|
3357
|
+
var fs11, path17, readline, import_node_child_process3, import_node_util3, import_node_process, execFileAsync3, DAEMON_PROJECT_ID_RE, DAEMON_BINDING_ID_RE, PROJECT_ID_RE, MEMORAONE_MCP_COMMAND_RE, CLEANUP_PROJECT_ID_REQUIRED_ERROR;
|
|
3272
3358
|
var init_cleanup = __esm({
|
|
3273
3359
|
"src/cleanup.ts"() {
|
|
3274
3360
|
fs11 = __toESM(require("fs/promises"), 1);
|
|
3275
|
-
|
|
3361
|
+
path17 = __toESM(require("path"), 1);
|
|
3276
3362
|
readline = __toESM(require("readline/promises"), 1);
|
|
3277
3363
|
import_node_child_process3 = require("child_process");
|
|
3278
3364
|
import_node_util3 = require("util");
|
|
@@ -3314,17 +3400,17 @@ var init_configUtils = __esm({
|
|
|
3314
3400
|
});
|
|
3315
3401
|
|
|
3316
3402
|
// src/config.ts
|
|
3317
|
-
var process2, fs12,
|
|
3403
|
+
var process2, fs12, path18, dotenv, import_v4, dotenvPath, EnvSchema, requiredEnvVars, missingEnvVars, parsed, resolvedApiUrl, parseBooleanFlag2, config2;
|
|
3318
3404
|
var init_config = __esm({
|
|
3319
3405
|
"src/config.ts"() {
|
|
3320
3406
|
process2 = __toESM(require("process"), 1);
|
|
3321
3407
|
fs12 = __toESM(require("fs"), 1);
|
|
3322
|
-
|
|
3408
|
+
path18 = __toESM(require("path"), 1);
|
|
3323
3409
|
dotenv = __toESM(require("dotenv"), 1);
|
|
3324
3410
|
import_v4 = require("zod/v4");
|
|
3325
3411
|
init_configUtils();
|
|
3326
3412
|
init_socketPaths();
|
|
3327
|
-
dotenvPath =
|
|
3413
|
+
dotenvPath = path18.resolve(process2.cwd(), ".env");
|
|
3328
3414
|
if (fs12.existsSync(dotenvPath)) {
|
|
3329
3415
|
try {
|
|
3330
3416
|
dotenv.config({ path: dotenvPath });
|
|
@@ -3399,7 +3485,7 @@ var init_config = __esm({
|
|
|
3399
3485
|
function resolveRepoFingerprint(cwd2) {
|
|
3400
3486
|
const found = findGitRoot(cwd2);
|
|
3401
3487
|
if (!found) {
|
|
3402
|
-
const fallbackPath =
|
|
3488
|
+
const fallbackPath = path19.resolve(cwd2);
|
|
3403
3489
|
const fingerprint2 = sha256(fallbackPath);
|
|
3404
3490
|
debugLog(`repo fingerprint=${fingerprint2} source=path-fallback`);
|
|
3405
3491
|
return {
|
|
@@ -3421,7 +3507,7 @@ function resolveRepoFingerprint(cwd2) {
|
|
|
3421
3507
|
source: "git-remote"
|
|
3422
3508
|
};
|
|
3423
3509
|
}
|
|
3424
|
-
const fingerprint = sha256(
|
|
3510
|
+
const fingerprint = sha256(path19.resolve(gitRoot));
|
|
3425
3511
|
debugLog(`repo fingerprint=${fingerprint} source=path-fallback`);
|
|
3426
3512
|
return {
|
|
3427
3513
|
fingerprint,
|
|
@@ -3429,11 +3515,11 @@ function resolveRepoFingerprint(cwd2) {
|
|
|
3429
3515
|
source: "path-fallback"
|
|
3430
3516
|
};
|
|
3431
3517
|
}
|
|
3432
|
-
var fs13,
|
|
3518
|
+
var fs13, path19, crypto2, parseBooleanFlag3, debugEnabled2, debugLog, normalizeRemoteUrl, sha256, resolveGitDir, findGitRoot, readOriginRemote;
|
|
3433
3519
|
var init_repoFingerprint = __esm({
|
|
3434
3520
|
"src/repoFingerprint.ts"() {
|
|
3435
3521
|
fs13 = __toESM(require("fs"), 1);
|
|
3436
|
-
|
|
3522
|
+
path19 = __toESM(require("path"), 1);
|
|
3437
3523
|
crypto2 = __toESM(require("crypto"), 1);
|
|
3438
3524
|
parseBooleanFlag3 = (value) => {
|
|
3439
3525
|
if (!value) {
|
|
@@ -3472,7 +3558,7 @@ var init_repoFingerprint = __esm({
|
|
|
3472
3558
|
const match = content.match(/^gitdir:\s*(.+)$/m);
|
|
3473
3559
|
if (match) {
|
|
3474
3560
|
const gitDir = match[1].trim();
|
|
3475
|
-
return
|
|
3561
|
+
return path19.resolve(path19.dirname(gitPath), gitDir);
|
|
3476
3562
|
}
|
|
3477
3563
|
}
|
|
3478
3564
|
} catch {
|
|
@@ -3481,16 +3567,16 @@ var init_repoFingerprint = __esm({
|
|
|
3481
3567
|
return null;
|
|
3482
3568
|
};
|
|
3483
3569
|
findGitRoot = (start) => {
|
|
3484
|
-
let current =
|
|
3570
|
+
let current = path19.resolve(start);
|
|
3485
3571
|
while (true) {
|
|
3486
|
-
const gitPath =
|
|
3572
|
+
const gitPath = path19.join(current, ".git");
|
|
3487
3573
|
if (fs13.existsSync(gitPath)) {
|
|
3488
3574
|
const gitDir = resolveGitDir(gitPath);
|
|
3489
3575
|
if (gitDir) {
|
|
3490
3576
|
return { gitRoot: current, gitDir };
|
|
3491
3577
|
}
|
|
3492
3578
|
}
|
|
3493
|
-
const parent =
|
|
3579
|
+
const parent = path19.dirname(current);
|
|
3494
3580
|
if (parent === current) {
|
|
3495
3581
|
break;
|
|
3496
3582
|
}
|
|
@@ -3499,7 +3585,7 @@ var init_repoFingerprint = __esm({
|
|
|
3499
3585
|
return null;
|
|
3500
3586
|
};
|
|
3501
3587
|
readOriginRemote = (gitDir) => {
|
|
3502
|
-
const configPath =
|
|
3588
|
+
const configPath = path19.join(gitDir, "config");
|
|
3503
3589
|
try {
|
|
3504
3590
|
const content = fs13.readFileSync(configPath, "utf8");
|
|
3505
3591
|
const lines = content.split(/\r?\n/);
|
|
@@ -3542,12 +3628,12 @@ function formatJetBrainsBackupTimestamp(d = /* @__PURE__ */ new Date()) {
|
|
|
3542
3628
|
return `${d.getFullYear()}${pad(d.getMonth() + 1)}${pad(d.getDate())}-${pad(d.getHours())}${pad(d.getMinutes())}${pad(d.getSeconds())}`;
|
|
3543
3629
|
}
|
|
3544
3630
|
function getJetBrainsGlobalMcpConfigPath(homeDir) {
|
|
3545
|
-
return
|
|
3631
|
+
return path20.join(homeDir, ".ai", "mcp", "mcp.json");
|
|
3546
3632
|
}
|
|
3547
3633
|
function getJetBrainsProjectMcpConfigPaths(repoRoot) {
|
|
3548
3634
|
return [
|
|
3549
|
-
{ kind: "project-ai", path:
|
|
3550
|
-
{ kind: "project-ij", path:
|
|
3635
|
+
{ kind: "project-ai", path: path20.join(repoRoot, ".ai", "mcp", "mcp.json") },
|
|
3636
|
+
{ kind: "project-ij", path: path20.join(repoRoot, ".ij", "mcp", "mcp.json") }
|
|
3551
3637
|
];
|
|
3552
3638
|
}
|
|
3553
3639
|
function getKnownJetBrainsMcpConfigLocations(homeDir, repoRoot) {
|
|
@@ -3582,7 +3668,7 @@ function buildMemoraoneJetBrainsMcpServer(options) {
|
|
|
3582
3668
|
apiUrl: options.apiUrl ?? (environment === "local" ? DEV_API_URL : void 0)
|
|
3583
3669
|
}),
|
|
3584
3670
|
MEMORAONE_IDE_TYPE: "jetbrains",
|
|
3585
|
-
[MEMORAONE_WORKSPACE_ROOT_ENV]:
|
|
3671
|
+
[MEMORAONE_WORKSPACE_ROOT_ENV]: path20.resolve(options.workspaceRoot)
|
|
3586
3672
|
};
|
|
3587
3673
|
if (environment === "local" || options.devMode) {
|
|
3588
3674
|
env2.MEMORAONE_DEV_MODE = "1";
|
|
@@ -3596,17 +3682,17 @@ function buildMemoraoneJetBrainsMcpServer(options) {
|
|
|
3596
3682
|
env: env2
|
|
3597
3683
|
};
|
|
3598
3684
|
}
|
|
3599
|
-
function mergeJetBrainsMcpConfigObject(existing, memoraone) {
|
|
3685
|
+
function mergeJetBrainsMcpConfigObject(existing, memoraone, ownership) {
|
|
3600
3686
|
const base = existing && typeof existing === "object" ? { ...existing } : { mcpServers: {} };
|
|
3601
3687
|
const mcpServers = typeof base.mcpServers === "object" && base.mcpServers !== null && !Array.isArray(base.mcpServers) ? { ...base.mcpServers } : {};
|
|
3602
|
-
return { ...base, mcpServers: replaceMemoraoneOwnedInServerMap(mcpServers, memoraone) };
|
|
3688
|
+
return { ...base, mcpServers: ownership ? replaceMemoraoneRepositoryBindingInServerMap(mcpServers, memoraone, ownership) : replaceMemoraoneOwnedInServerMap(mcpServers, memoraone) };
|
|
3603
3689
|
}
|
|
3604
3690
|
async function writeJetBrainsMcpJsonAtomic(filePath, content) {
|
|
3605
|
-
const dir =
|
|
3691
|
+
const dir = path20.dirname(filePath);
|
|
3606
3692
|
await fs14.mkdir(dir, { recursive: true });
|
|
3607
|
-
const tmpPath =
|
|
3693
|
+
const tmpPath = path20.join(
|
|
3608
3694
|
dir,
|
|
3609
|
-
`.${
|
|
3695
|
+
`.${path20.basename(filePath)}.${process.pid}.${(0, import_node_crypto5.randomBytes)(8).toString("hex")}.tmp`
|
|
3610
3696
|
);
|
|
3611
3697
|
try {
|
|
3612
3698
|
await fs14.writeFile(tmpPath, content, "utf8");
|
|
@@ -3622,7 +3708,7 @@ async function writeJetBrainsMcpJsonAtomic(filePath, content) {
|
|
|
3622
3708
|
function memoraoneServerMatches2(server, expected) {
|
|
3623
3709
|
return canonicalValueMatches(server, expected);
|
|
3624
3710
|
}
|
|
3625
|
-
function validateJetBrainsMcpConfig(parsed2, expected) {
|
|
3711
|
+
function validateJetBrainsMcpConfig(parsed2, expected, serverName = CANONICAL_MEMORAONE_MCP_SERVER_NAME) {
|
|
3626
3712
|
if (!parsed2 || typeof parsed2 !== "object") {
|
|
3627
3713
|
throw new Error("[setup-ide-files] JetBrains MCP config must be a JSON object.");
|
|
3628
3714
|
}
|
|
@@ -3630,7 +3716,8 @@ function validateJetBrainsMcpConfig(parsed2, expected) {
|
|
|
3630
3716
|
if (!mcpServers || typeof mcpServers !== "object" || Array.isArray(mcpServers)) {
|
|
3631
3717
|
throw new Error("[setup-ide-files] JetBrains MCP config missing mcpServers object.");
|
|
3632
3718
|
}
|
|
3633
|
-
const
|
|
3719
|
+
const serverMap = mcpServers;
|
|
3720
|
+
const memoraone = serverMap[serverName] ?? Object.values(serverMap).find((entry) => memoraoneServerMatches2(entry, expected));
|
|
3634
3721
|
if (!memoraoneServerMatches2(memoraone, expected)) {
|
|
3635
3722
|
throw new Error(
|
|
3636
3723
|
"[setup-ide-files] JetBrains MCP config mcpServers.memoraone is missing or invalid."
|
|
@@ -3690,20 +3777,20 @@ async function removeMemoraoneFromProjectConfig(options) {
|
|
|
3690
3777
|
return { changed: true, backupPath };
|
|
3691
3778
|
}
|
|
3692
3779
|
const next = { ...parsed2, mcpServers };
|
|
3693
|
-
await fs14.mkdir(
|
|
3780
|
+
await fs14.mkdir(path20.dirname(configPath), { recursive: true });
|
|
3694
3781
|
await fs14.writeFile(configPath, JSON.stringify(next, null, 2) + "\n", "utf8");
|
|
3695
3782
|
return { changed: true, backupPath };
|
|
3696
3783
|
}
|
|
3697
3784
|
async function resolveLocalCliPathAsync() {
|
|
3698
|
-
const here = process.argv[1] ?
|
|
3785
|
+
const here = process.argv[1] ? path20.dirname(path20.resolve(process.argv[1])) : process.cwd();
|
|
3699
3786
|
const candidates = [
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3787
|
+
path20.join(here, "cli.cjs"),
|
|
3788
|
+
path20.join(here, "..", "dist", "cli.cjs"),
|
|
3789
|
+
path20.join(here, "..", "..", "dist", "cli.cjs")
|
|
3703
3790
|
];
|
|
3704
3791
|
for (const candidate of candidates) {
|
|
3705
3792
|
if (await pathExists3(candidate)) {
|
|
3706
|
-
return
|
|
3793
|
+
return path20.resolve(candidate);
|
|
3707
3794
|
}
|
|
3708
3795
|
}
|
|
3709
3796
|
return null;
|
|
@@ -3760,7 +3847,7 @@ function formatOptionalJetBrainsHandshakeUnavailableDetail(detail) {
|
|
|
3760
3847
|
async function verifyJetBrainsMcpHandshake(options) {
|
|
3761
3848
|
const timeoutMs = options.timeoutMs ?? 15e3;
|
|
3762
3849
|
const { server } = options;
|
|
3763
|
-
return new Promise((
|
|
3850
|
+
return new Promise((resolve40) => {
|
|
3764
3851
|
let settled = false;
|
|
3765
3852
|
const finish = (ok, detail, optionalUnavailable) => {
|
|
3766
3853
|
if (settled) return;
|
|
@@ -3770,7 +3857,7 @@ async function verifyJetBrainsMcpHandshake(options) {
|
|
|
3770
3857
|
child.kill();
|
|
3771
3858
|
} catch {
|
|
3772
3859
|
}
|
|
3773
|
-
|
|
3860
|
+
resolve40({ ok, detail, optionalUnavailable });
|
|
3774
3861
|
};
|
|
3775
3862
|
const child = (0, import_node_child_process4.spawn)(server.command, [...server.args], {
|
|
3776
3863
|
env: { ...process.env, ...server.env },
|
|
@@ -3844,7 +3931,7 @@ async function verifyJetBrainsMcpHandshake(options) {
|
|
|
3844
3931
|
async function setupJetBrainsMcpConfig(options) {
|
|
3845
3932
|
const homeDir = options.homeDir ?? os5.homedir();
|
|
3846
3933
|
const globalPath = options.globalConfigPath ?? getJetBrainsGlobalMcpConfigPath(homeDir);
|
|
3847
|
-
const workspaceRoot =
|
|
3934
|
+
const workspaceRoot = path20.resolve(options.repoRoot);
|
|
3848
3935
|
const repairActions = [];
|
|
3849
3936
|
const allLocations = getKnownJetBrainsMcpConfigLocations(homeDir, options.repoRoot);
|
|
3850
3937
|
for (const location of allLocations) {
|
|
@@ -3898,11 +3985,10 @@ async function setupJetBrainsMcpConfig(options) {
|
|
|
3898
3985
|
);
|
|
3899
3986
|
}
|
|
3900
3987
|
}
|
|
3901
|
-
const merged = mergeJetBrainsMcpConfigObject(existing, memoraone);
|
|
3988
|
+
const merged = mergeJetBrainsMcpConfigObject(existing, memoraone, options.ownership);
|
|
3902
3989
|
const body = JSON.stringify(merged, null, 2) + "\n";
|
|
3903
3990
|
if (existed && existing) {
|
|
3904
|
-
|
|
3905
|
-
if (memoraoneServerMatches2(currentMemoraone, memoraone)) {
|
|
3991
|
+
if (canonicalValueMatches(existing, merged)) {
|
|
3906
3992
|
repairActions.push({ type: "wrote-global-config", path: globalPath, outcome: "skipped" });
|
|
3907
3993
|
return { outcome: "skipped", repairActions, memoraone };
|
|
3908
3994
|
}
|
|
@@ -3919,7 +4005,7 @@ async function setupJetBrainsMcpConfig(options) {
|
|
|
3919
4005
|
await writeJetBrainsMcpJsonAtomic(globalPath, body);
|
|
3920
4006
|
const verifyRaw = await fs14.readFile(globalPath, "utf8");
|
|
3921
4007
|
const verifyParsed = JSON.parse(stripLeadingLineComments2(verifyRaw));
|
|
3922
|
-
validateJetBrainsMcpConfig(verifyParsed, memoraone);
|
|
4008
|
+
validateJetBrainsMcpConfig(verifyParsed, memoraone, options.ownership ? memoraoneServerNameForRepositoryBinding(options.ownership.repositoryBindingId) : CANONICAL_MEMORAONE_MCP_SERVER_NAME);
|
|
3923
4009
|
const outcome = existed ? "updated" : "created";
|
|
3924
4010
|
repairActions.push({ type: "wrote-global-config", path: globalPath, outcome });
|
|
3925
4011
|
let verifyOk;
|
|
@@ -3984,13 +4070,13 @@ function logJetBrainsMcpCliSummary(info, dryRun, println = console.log) {
|
|
|
3984
4070
|
"[setup-ide-files] Fully quit JetBrains IDE and reopen this repo for MCP changes to take effect."
|
|
3985
4071
|
);
|
|
3986
4072
|
}
|
|
3987
|
-
var fs14, os5,
|
|
4073
|
+
var fs14, os5, path20, import_node_crypto5, import_node_child_process4, JETBRAINS_DEBUG_ENV_VARS;
|
|
3988
4074
|
var init_jetbrainsMcpConfig = __esm({
|
|
3989
4075
|
"src/jetbrainsMcpConfig.ts"() {
|
|
3990
4076
|
fs14 = __toESM(require("fs/promises"), 1);
|
|
3991
4077
|
os5 = __toESM(require("os"), 1);
|
|
3992
|
-
|
|
3993
|
-
|
|
4078
|
+
path20 = __toESM(require("path"), 1);
|
|
4079
|
+
import_node_crypto5 = require("crypto");
|
|
3994
4080
|
import_node_child_process4 = require("child_process");
|
|
3995
4081
|
init_configUtils();
|
|
3996
4082
|
init_cursorGlobalMcpConfig();
|
|
@@ -4019,10 +4105,10 @@ async function pathExists4(filePath) {
|
|
|
4019
4105
|
}
|
|
4020
4106
|
}
|
|
4021
4107
|
function getWindsurfGlobalMcpConfigPath(homeDir) {
|
|
4022
|
-
return
|
|
4108
|
+
return path21.join(homeDir, ".config", "devin", "mcp_config.json");
|
|
4023
4109
|
}
|
|
4024
4110
|
function getWindsurfLegacyMcpConfigPath(homeDir) {
|
|
4025
|
-
return
|
|
4111
|
+
return path21.join(homeDir, ".codeium", "windsurf", "mcp_config.json");
|
|
4026
4112
|
}
|
|
4027
4113
|
function formatWindsurfBackupTimestamp(d = /* @__PURE__ */ new Date()) {
|
|
4028
4114
|
const pad = (n) => String(n).padStart(2, "0");
|
|
@@ -4036,7 +4122,7 @@ function buildMemoraoneWindsurfMcpServer(options) {
|
|
|
4036
4122
|
apiUrl: options.apiUrl ?? (environment === "local" ? DEV_API_URL : void 0)
|
|
4037
4123
|
}),
|
|
4038
4124
|
MEMORAONE_IDE_TYPE: "windsurf",
|
|
4039
|
-
[MEMORAONE_WORKSPACE_ROOT_ENV]:
|
|
4125
|
+
[MEMORAONE_WORKSPACE_ROOT_ENV]: path21.resolve(options.workspaceRoot)
|
|
4040
4126
|
};
|
|
4041
4127
|
if (environment === "local" || options.devMode) {
|
|
4042
4128
|
env2.MEMORAONE_DEV_MODE = "1";
|
|
@@ -4052,10 +4138,10 @@ function buildMemoraoneWindsurfMcpServer(options) {
|
|
|
4052
4138
|
env: env2
|
|
4053
4139
|
};
|
|
4054
4140
|
}
|
|
4055
|
-
function mergeWindsurfMcpConfigObject(existing, memoraone) {
|
|
4141
|
+
function mergeWindsurfMcpConfigObject(existing, memoraone, ownership) {
|
|
4056
4142
|
const base = existing && typeof existing === "object" ? { ...existing } : { mcpServers: {} };
|
|
4057
4143
|
const mcpServers = typeof base.mcpServers === "object" && base.mcpServers !== null && !Array.isArray(base.mcpServers) ? { ...base.mcpServers } : {};
|
|
4058
|
-
return { ...base, mcpServers: replaceMemoraoneOwnedInServerMap(mcpServers, memoraone) };
|
|
4144
|
+
return { ...base, mcpServers: ownership ? replaceMemoraoneRepositoryBindingInServerMap(mcpServers, memoraone, ownership) : replaceMemoraoneOwnedInServerMap(mcpServers, memoraone) };
|
|
4059
4145
|
}
|
|
4060
4146
|
function stripMemoraoneFromWindsurfConfigObject(existing) {
|
|
4061
4147
|
const base = { ...existing };
|
|
@@ -4071,11 +4157,11 @@ function stripMemoraoneFromWindsurfConfigObject(existing) {
|
|
|
4071
4157
|
return { next: { ...base, mcpServers }, removed: true };
|
|
4072
4158
|
}
|
|
4073
4159
|
async function writeWindsurfMcpJsonAtomic(filePath, content) {
|
|
4074
|
-
const dir =
|
|
4160
|
+
const dir = path21.dirname(filePath);
|
|
4075
4161
|
await fs15.mkdir(dir, { recursive: true });
|
|
4076
|
-
const tmpPath =
|
|
4162
|
+
const tmpPath = path21.join(
|
|
4077
4163
|
dir,
|
|
4078
|
-
`.${
|
|
4164
|
+
`.${path21.basename(filePath)}.${process.pid}.${(0, import_node_crypto6.randomBytes)(8).toString("hex")}.tmp`
|
|
4079
4165
|
);
|
|
4080
4166
|
try {
|
|
4081
4167
|
await fs15.writeFile(tmpPath, content, "utf8");
|
|
@@ -4091,7 +4177,7 @@ async function writeWindsurfMcpJsonAtomic(filePath, content) {
|
|
|
4091
4177
|
function memoraoneServerMatches3(server, expected) {
|
|
4092
4178
|
return canonicalValueMatches(server, expected);
|
|
4093
4179
|
}
|
|
4094
|
-
function validateWindsurfMcpConfig(parsed2, expected) {
|
|
4180
|
+
function validateWindsurfMcpConfig(parsed2, expected, serverName = CANONICAL_MEMORAONE_MCP_SERVER_NAME) {
|
|
4095
4181
|
if (!parsed2 || typeof parsed2 !== "object") {
|
|
4096
4182
|
throw new Error("[setup-ide-files] Devin Desktop MCP config must be a JSON object.");
|
|
4097
4183
|
}
|
|
@@ -4099,7 +4185,8 @@ function validateWindsurfMcpConfig(parsed2, expected) {
|
|
|
4099
4185
|
if (!mcpServers || typeof mcpServers !== "object" || Array.isArray(mcpServers)) {
|
|
4100
4186
|
throw new Error("[setup-ide-files] Devin Desktop MCP config missing mcpServers object.");
|
|
4101
4187
|
}
|
|
4102
|
-
const
|
|
4188
|
+
const serverMap = mcpServers;
|
|
4189
|
+
const memoraone = serverMap[serverName] ?? Object.values(serverMap).find((entry) => memoraoneServerMatches3(entry, expected));
|
|
4103
4190
|
if (!memoraoneServerMatches3(memoraone, expected)) {
|
|
4104
4191
|
throw new Error(
|
|
4105
4192
|
"[setup-ide-files] Devin Desktop MCP config mcpServers.memoraone is missing or invalid."
|
|
@@ -4166,8 +4253,8 @@ async function setupWindsurfMcpConfig(options) {
|
|
|
4166
4253
|
const homeDir = options.homeDir ?? os6.homedir();
|
|
4167
4254
|
const activePath = options.globalConfigPath ?? getWindsurfGlobalMcpConfigPath(homeDir);
|
|
4168
4255
|
const legacyPath = options.legacyConfigPath ?? getWindsurfLegacyMcpConfigPath(homeDir);
|
|
4169
|
-
const samePath =
|
|
4170
|
-
const workspaceRoot =
|
|
4256
|
+
const samePath = path21.resolve(activePath) === path21.resolve(legacyPath);
|
|
4257
|
+
const workspaceRoot = path21.resolve(options.repoRoot);
|
|
4171
4258
|
const memoraone = await buildWindsurfMemoraoneServer({
|
|
4172
4259
|
workspaceRoot,
|
|
4173
4260
|
devMode: options.devMode,
|
|
@@ -4204,14 +4291,17 @@ async function setupWindsurfMcpConfig(options) {
|
|
|
4204
4291
|
);
|
|
4205
4292
|
}
|
|
4206
4293
|
const mergeBase = activeExisted ? activeExisting : legacyExisting;
|
|
4207
|
-
const merged = mergeWindsurfMcpConfigObject(mergeBase, memoraone);
|
|
4294
|
+
const merged = mergeWindsurfMcpConfigObject(mergeBase, memoraone, options.ownership);
|
|
4208
4295
|
const body = JSON.stringify(merged, null, 2) + "\n";
|
|
4209
|
-
const
|
|
4210
|
-
|
|
4296
|
+
const activeAlreadyCorrect = Boolean(
|
|
4297
|
+
activeExisted && activeExisting && canonicalValueMatches(activeExisting, merged)
|
|
4298
|
+
);
|
|
4211
4299
|
let legacyNeedsCleanup = false;
|
|
4212
4300
|
if (legacyExisted && !legacyMalformed && legacyExisting) {
|
|
4213
|
-
|
|
4214
|
-
|
|
4301
|
+
legacyNeedsCleanup = options.ownership ? stripMemoraoneRepositoryBindingFromServerMap(
|
|
4302
|
+
legacyExisting.mcpServers ?? {},
|
|
4303
|
+
options.ownership
|
|
4304
|
+
).removedKeys.length > 0 : extractMemoraone(legacyExisting) !== void 0;
|
|
4215
4305
|
}
|
|
4216
4306
|
if (activeAlreadyCorrect && !legacyNeedsCleanup) {
|
|
4217
4307
|
return {
|
|
@@ -4247,7 +4337,7 @@ async function setupWindsurfMcpConfig(options) {
|
|
|
4247
4337
|
await writeWindsurfMcpJsonAtomic(activePath, body);
|
|
4248
4338
|
const verifyRaw = await fs15.readFile(activePath, "utf8");
|
|
4249
4339
|
const verifyParsed = JSON.parse(stripLeadingLineComments3(verifyRaw));
|
|
4250
|
-
validateWindsurfMcpConfig(verifyParsed, memoraone);
|
|
4340
|
+
validateWindsurfMcpConfig(verifyParsed, memoraone, options.ownership ? memoraoneServerNameForRepositoryBinding(options.ownership.repositoryBindingId) : CANONICAL_MEMORAONE_MCP_SERVER_NAME);
|
|
4251
4341
|
}
|
|
4252
4342
|
let legacyCleanup = "absent";
|
|
4253
4343
|
let warning;
|
|
@@ -4257,7 +4347,11 @@ async function setupWindsurfMcpConfig(options) {
|
|
|
4257
4347
|
warning = `[setup-ide-files] Legacy Windsurf MCP config has invalid JSON and was left unchanged: ${legacyPath}. Devin Desktop active config was written; fix or remove the legacy file to avoid ambiguity.`;
|
|
4258
4348
|
} else if (legacyNeedsCleanup && legacyExisting) {
|
|
4259
4349
|
await backupConfigFile2(legacyPath);
|
|
4260
|
-
const
|
|
4350
|
+
const scoped = options.ownership && legacyExisting.mcpServers && typeof legacyExisting.mcpServers === "object" && !Array.isArray(legacyExisting.mcpServers) ? stripMemoraoneRepositoryBindingFromServerMap(
|
|
4351
|
+
legacyExisting.mcpServers,
|
|
4352
|
+
options.ownership
|
|
4353
|
+
) : null;
|
|
4354
|
+
const { next, removed } = scoped ? { next: { ...legacyExisting, mcpServers: scoped.next }, removed: scoped.removedKeys.length > 0 } : stripMemoraoneFromWindsurfConfigObject(legacyExisting);
|
|
4261
4355
|
if (removed) {
|
|
4262
4356
|
const legacyBody = JSON.stringify(next, null, 2) + "\n";
|
|
4263
4357
|
await writeWindsurfMcpJsonAtomic(legacyPath, legacyBody);
|
|
@@ -4320,13 +4414,13 @@ function logWindsurfMcpCliSummary(info, dryRun, println = console.log) {
|
|
|
4320
4414
|
"[setup-ide-files] Refresh MCP servers in Devin Desktop settings, or restart Devin Desktop, for MCP changes to take effect."
|
|
4321
4415
|
);
|
|
4322
4416
|
}
|
|
4323
|
-
var fs15, os6,
|
|
4417
|
+
var fs15, os6, path21, import_node_crypto6;
|
|
4324
4418
|
var init_windsurfMcpConfig = __esm({
|
|
4325
4419
|
"src/windsurfMcpConfig.ts"() {
|
|
4326
4420
|
fs15 = __toESM(require("fs/promises"), 1);
|
|
4327
4421
|
os6 = __toESM(require("os"), 1);
|
|
4328
|
-
|
|
4329
|
-
|
|
4422
|
+
path21 = __toESM(require("path"), 1);
|
|
4423
|
+
import_node_crypto6 = require("crypto");
|
|
4330
4424
|
init_configUtils();
|
|
4331
4425
|
init_cursorGlobalMcpConfig();
|
|
4332
4426
|
init_initializeBinding();
|
|
@@ -4346,13 +4440,13 @@ async function pathExists5(filePath) {
|
|
|
4346
4440
|
}
|
|
4347
4441
|
}
|
|
4348
4442
|
function getOpenCodeProjectMcpConfigPath(repoRoot) {
|
|
4349
|
-
return
|
|
4443
|
+
return path22.join(path22.resolve(repoRoot), "opencode.json");
|
|
4350
4444
|
}
|
|
4351
4445
|
function getOpenCodeProjectJsoncConfigPath(repoRoot) {
|
|
4352
|
-
return
|
|
4446
|
+
return path22.join(path22.resolve(repoRoot), "opencode.jsonc");
|
|
4353
4447
|
}
|
|
4354
4448
|
function getOpenCodeGlobalMcpConfigPath(homeDir) {
|
|
4355
|
-
return
|
|
4449
|
+
return path22.join(homeDir, ".config", "opencode", "opencode.json");
|
|
4356
4450
|
}
|
|
4357
4451
|
function buildMemoraoneOpenCodeMcpServer(options) {
|
|
4358
4452
|
const environment = options.environment ?? (options.devMode ? "local" : "production");
|
|
@@ -4362,7 +4456,7 @@ function buildMemoraoneOpenCodeMcpServer(options) {
|
|
|
4362
4456
|
apiUrl: options.apiUrl ?? (environment === "local" ? DEV_API_URL : void 0)
|
|
4363
4457
|
}),
|
|
4364
4458
|
MEMORAONE_IDE_TYPE: "opencode",
|
|
4365
|
-
[MEMORAONE_WORKSPACE_ROOT_ENV]:
|
|
4459
|
+
[MEMORAONE_WORKSPACE_ROOT_ENV]: path22.resolve(options.workspaceRoot)
|
|
4366
4460
|
};
|
|
4367
4461
|
if (environment === "local" || options.devMode) {
|
|
4368
4462
|
env2.MEMORAONE_DEV_MODE = "1";
|
|
@@ -4393,11 +4487,11 @@ function mergeOpenCodeMcpConfigObject(existing, memoraone) {
|
|
|
4393
4487
|
return { ...base, mcp: replaceMemoraoneOwnedInServerMap(mcp, memoraone) };
|
|
4394
4488
|
}
|
|
4395
4489
|
async function writeOpenCodeMcpJsonAtomic(filePath, content) {
|
|
4396
|
-
const dir =
|
|
4490
|
+
const dir = path22.dirname(filePath);
|
|
4397
4491
|
await fs16.mkdir(dir, { recursive: true });
|
|
4398
|
-
const tmpPath =
|
|
4492
|
+
const tmpPath = path22.join(
|
|
4399
4493
|
dir,
|
|
4400
|
-
`.${
|
|
4494
|
+
`.${path22.basename(filePath)}.${process.pid}.${(0, import_node_crypto7.randomBytes)(8).toString("hex")}.tmp`
|
|
4401
4495
|
);
|
|
4402
4496
|
try {
|
|
4403
4497
|
await fs16.writeFile(tmpPath, content, "utf8");
|
|
@@ -4476,7 +4570,7 @@ async function buildOpenCodeMemoraoneServer(options) {
|
|
|
4476
4570
|
async function setupOpenCodeMcpConfig(options) {
|
|
4477
4571
|
const projectPath = options.projectConfigPath ?? getOpenCodeProjectMcpConfigPath(options.repoRoot);
|
|
4478
4572
|
const jsoncPath = getOpenCodeProjectJsoncConfigPath(options.repoRoot);
|
|
4479
|
-
const workspaceRoot =
|
|
4573
|
+
const workspaceRoot = path22.resolve(options.repoRoot);
|
|
4480
4574
|
const memoraone = await buildOpenCodeMemoraoneServer({
|
|
4481
4575
|
workspaceRoot,
|
|
4482
4576
|
devMode: options.devMode,
|
|
@@ -4539,12 +4633,12 @@ function logOpenCodeMcpCliSummary(info, dryRun, println = console.log) {
|
|
|
4539
4633
|
"[setup-ide-files] Fully quit OpenCode and reopen this repo for MCP changes to take effect."
|
|
4540
4634
|
);
|
|
4541
4635
|
}
|
|
4542
|
-
var fs16,
|
|
4636
|
+
var fs16, path22, import_node_crypto7, OPENCODE_CONFIG_SCHEMA_URL, OpenCodeMcpJsonParseError, OpenCodeJsoncOnlyError;
|
|
4543
4637
|
var init_opencodeMcpConfig = __esm({
|
|
4544
4638
|
"src/opencodeMcpConfig.ts"() {
|
|
4545
4639
|
fs16 = __toESM(require("fs/promises"), 1);
|
|
4546
|
-
|
|
4547
|
-
|
|
4640
|
+
path22 = __toESM(require("path"), 1);
|
|
4641
|
+
import_node_crypto7 = require("crypto");
|
|
4548
4642
|
init_configUtils();
|
|
4549
4643
|
init_cursorGlobalMcpConfig();
|
|
4550
4644
|
init_initializeBinding();
|
|
@@ -4583,11 +4677,11 @@ async function pathExists6(filePath) {
|
|
|
4583
4677
|
}
|
|
4584
4678
|
}
|
|
4585
4679
|
function getCodexProjectMcpConfigPath(repoRoot) {
|
|
4586
|
-
return
|
|
4680
|
+
return path23.join(path23.resolve(repoRoot), ".codex", "config.toml");
|
|
4587
4681
|
}
|
|
4588
4682
|
function getCodexGlobalMcpConfigPath(homeDir, env2 = process.env) {
|
|
4589
|
-
const codexHome = env2.CODEX_HOME?.trim() ?
|
|
4590
|
-
return
|
|
4683
|
+
const codexHome = env2.CODEX_HOME?.trim() ? path23.resolve(env2.CODEX_HOME) : path23.join(homeDir, ".codex");
|
|
4684
|
+
return path23.join(codexHome, "config.toml");
|
|
4591
4685
|
}
|
|
4592
4686
|
function escapeTomlBasicString(value) {
|
|
4593
4687
|
return '"' + value.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r") + '"';
|
|
@@ -4611,7 +4705,7 @@ function buildMemoraoneCodexMcpServer(options) {
|
|
|
4611
4705
|
apiUrl: options.apiUrl ?? (environment === "local" ? DEV_API_URL : void 0)
|
|
4612
4706
|
}),
|
|
4613
4707
|
MEMORAONE_IDE_TYPE: "codex",
|
|
4614
|
-
[MEMORAONE_WORKSPACE_ROOT_ENV]:
|
|
4708
|
+
[MEMORAONE_WORKSPACE_ROOT_ENV]: path23.resolve(options.workspaceRoot)
|
|
4615
4709
|
};
|
|
4616
4710
|
if (environment === "local" || options.devMode) {
|
|
4617
4711
|
env2.MEMORAONE_DEV_MODE = "1";
|
|
@@ -4838,11 +4932,11 @@ function parseCodexTomlOrThrow(source, configPath) {
|
|
|
4838
4932
|
}
|
|
4839
4933
|
}
|
|
4840
4934
|
async function writeCodexTomlAtomic(filePath, content) {
|
|
4841
|
-
const dir =
|
|
4935
|
+
const dir = path23.dirname(filePath);
|
|
4842
4936
|
await fs17.mkdir(dir, { recursive: true });
|
|
4843
|
-
const tmpPath =
|
|
4937
|
+
const tmpPath = path23.join(
|
|
4844
4938
|
dir,
|
|
4845
|
-
`.${
|
|
4939
|
+
`.${path23.basename(filePath)}.${process.pid}.${(0, import_node_crypto8.randomBytes)(8).toString("hex")}.tmp`
|
|
4846
4940
|
);
|
|
4847
4941
|
try {
|
|
4848
4942
|
await fs17.writeFile(tmpPath, content, "utf8");
|
|
@@ -4897,7 +4991,7 @@ async function buildCodexMemoraoneServer(options) {
|
|
|
4897
4991
|
}
|
|
4898
4992
|
async function setupCodexMcpConfig(options) {
|
|
4899
4993
|
const projectPath = options.projectConfigPath ?? getCodexProjectMcpConfigPath(options.repoRoot);
|
|
4900
|
-
const workspaceRoot =
|
|
4994
|
+
const workspaceRoot = path23.resolve(options.repoRoot);
|
|
4901
4995
|
const memoraone = await buildCodexMemoraoneServer({
|
|
4902
4996
|
workspaceRoot,
|
|
4903
4997
|
devMode: options.devMode,
|
|
@@ -4947,12 +5041,12 @@ function logCodexMcpCliSummary(info, dryRun, println = console.log) {
|
|
|
4947
5041
|
"[setup-ide-files] Trust this project in Codex if prompted, then restart Codex."
|
|
4948
5042
|
);
|
|
4949
5043
|
}
|
|
4950
|
-
var fs17,
|
|
5044
|
+
var fs17, path23, import_node_crypto8, import_smol_toml, CODEX_MCP_SERVER_NAME, CODEX_OWNED_TABLE_PREFIX, CodexMcpTomlParseError, TABLE_HEADER_RE;
|
|
4951
5045
|
var init_codexMcpConfig = __esm({
|
|
4952
5046
|
"src/codexMcpConfig.ts"() {
|
|
4953
5047
|
fs17 = __toESM(require("fs/promises"), 1);
|
|
4954
|
-
|
|
4955
|
-
|
|
5048
|
+
path23 = __toESM(require("path"), 1);
|
|
5049
|
+
import_node_crypto8 = require("crypto");
|
|
4956
5050
|
import_smol_toml = require("smol-toml");
|
|
4957
5051
|
init_configUtils();
|
|
4958
5052
|
init_cursorGlobalMcpConfig();
|
|
@@ -4988,7 +5082,7 @@ async function pathExists7(filePath) {
|
|
|
4988
5082
|
}
|
|
4989
5083
|
}
|
|
4990
5084
|
function getKiroProjectMcpConfigPath(repoRoot) {
|
|
4991
|
-
return
|
|
5085
|
+
return path24.join(path24.resolve(repoRoot), ".kiro", "settings", "mcp.json");
|
|
4992
5086
|
}
|
|
4993
5087
|
function buildMemoraoneKiroMcpServer(options) {
|
|
4994
5088
|
const environment = options.environment ?? (options.devMode ? "local" : "production");
|
|
@@ -4997,7 +5091,7 @@ function buildMemoraoneKiroMcpServer(options) {
|
|
|
4997
5091
|
environment,
|
|
4998
5092
|
apiUrl: options.apiUrl ?? (environment === "local" ? DEV_API_URL : void 0)
|
|
4999
5093
|
}),
|
|
5000
|
-
[MEMORAONE_WORKSPACE_ROOT_ENV]:
|
|
5094
|
+
[MEMORAONE_WORKSPACE_ROOT_ENV]: path24.resolve(options.workspaceRoot)
|
|
5001
5095
|
};
|
|
5002
5096
|
if (environment === "local" || options.devMode) {
|
|
5003
5097
|
env2.MEMORAONE_DEV_MODE = "1";
|
|
@@ -5019,11 +5113,11 @@ function mergeKiroMcpConfigObject(existing, memoraone) {
|
|
|
5019
5113
|
return { ...base, mcpServers: replaceMemoraoneOwnedInServerMap(mcpServers, memoraone) };
|
|
5020
5114
|
}
|
|
5021
5115
|
async function writeKiroMcpJsonAtomic(filePath, content) {
|
|
5022
|
-
const dir =
|
|
5116
|
+
const dir = path24.dirname(filePath);
|
|
5023
5117
|
await fs18.mkdir(dir, { recursive: true });
|
|
5024
|
-
const tmpPath =
|
|
5118
|
+
const tmpPath = path24.join(
|
|
5025
5119
|
dir,
|
|
5026
|
-
`.${
|
|
5120
|
+
`.${path24.basename(filePath)}.${process.pid}.${(0, import_node_crypto9.randomBytes)(8).toString("hex")}.tmp`
|
|
5027
5121
|
);
|
|
5028
5122
|
try {
|
|
5029
5123
|
await fs18.writeFile(tmpPath, content, "utf8");
|
|
@@ -5101,7 +5195,7 @@ async function buildKiroMemoraoneServer(options) {
|
|
|
5101
5195
|
}
|
|
5102
5196
|
async function setupKiroMcpConfig(options) {
|
|
5103
5197
|
const projectPath = options.projectConfigPath ?? getKiroProjectMcpConfigPath(options.repoRoot);
|
|
5104
|
-
const workspaceRoot =
|
|
5198
|
+
const workspaceRoot = path24.resolve(options.repoRoot);
|
|
5105
5199
|
const memoraone = await buildKiroMemoraoneServer({
|
|
5106
5200
|
workspaceRoot,
|
|
5107
5201
|
devMode: options.devMode,
|
|
@@ -5160,12 +5254,12 @@ function logKiroMcpCliSummary(info, dryRun, println = console.log) {
|
|
|
5160
5254
|
"[setup-ide-files] Fully quit Kiro and reopen this repo for MCP changes to take effect."
|
|
5161
5255
|
);
|
|
5162
5256
|
}
|
|
5163
|
-
var fs18,
|
|
5257
|
+
var fs18, path24, import_node_crypto9, KiroMcpJsonParseError;
|
|
5164
5258
|
var init_kiroMcpConfig = __esm({
|
|
5165
5259
|
"src/kiroMcpConfig.ts"() {
|
|
5166
5260
|
fs18 = __toESM(require("fs/promises"), 1);
|
|
5167
|
-
|
|
5168
|
-
|
|
5261
|
+
path24 = __toESM(require("path"), 1);
|
|
5262
|
+
import_node_crypto9 = require("crypto");
|
|
5169
5263
|
init_configUtils();
|
|
5170
5264
|
init_cursorGlobalMcpConfig();
|
|
5171
5265
|
init_initializeBinding();
|
|
@@ -5197,7 +5291,7 @@ async function pathExists8(filePath) {
|
|
|
5197
5291
|
}
|
|
5198
5292
|
}
|
|
5199
5293
|
function getRooCodeProjectMcpConfigPath(repoRoot) {
|
|
5200
|
-
return
|
|
5294
|
+
return path25.join(path25.resolve(repoRoot), ".roo", "mcp.json");
|
|
5201
5295
|
}
|
|
5202
5296
|
function buildMemoraoneRooCodeMcpServer(options) {
|
|
5203
5297
|
const environment = options.environment ?? (options.devMode ? "local" : "production");
|
|
@@ -5207,7 +5301,7 @@ function buildMemoraoneRooCodeMcpServer(options) {
|
|
|
5207
5301
|
apiUrl: options.apiUrl ?? (environment === "local" ? DEV_API_URL : void 0)
|
|
5208
5302
|
}),
|
|
5209
5303
|
MEMORAONE_IDE_TYPE: "roo-code",
|
|
5210
|
-
[MEMORAONE_WORKSPACE_ROOT_ENV]:
|
|
5304
|
+
[MEMORAONE_WORKSPACE_ROOT_ENV]: path25.resolve(options.workspaceRoot)
|
|
5211
5305
|
};
|
|
5212
5306
|
if (environment === "local" || options.devMode) {
|
|
5213
5307
|
env2.MEMORAONE_DEV_MODE = "1";
|
|
@@ -5229,11 +5323,11 @@ function mergeRooCodeMcpConfigObject(existing, memoraone) {
|
|
|
5229
5323
|
return { ...base, mcpServers: replaceMemoraoneOwnedInServerMap(mcpServers, memoraone) };
|
|
5230
5324
|
}
|
|
5231
5325
|
async function writeRooCodeMcpJsonAtomic(filePath, content) {
|
|
5232
|
-
const dir =
|
|
5326
|
+
const dir = path25.dirname(filePath);
|
|
5233
5327
|
await fs19.mkdir(dir, { recursive: true });
|
|
5234
|
-
const tmpPath =
|
|
5328
|
+
const tmpPath = path25.join(
|
|
5235
5329
|
dir,
|
|
5236
|
-
`.${
|
|
5330
|
+
`.${path25.basename(filePath)}.${process.pid}.${(0, import_node_crypto10.randomBytes)(8).toString("hex")}.tmp`
|
|
5237
5331
|
);
|
|
5238
5332
|
try {
|
|
5239
5333
|
await fs19.writeFile(tmpPath, content, "utf8");
|
|
@@ -5311,7 +5405,7 @@ async function buildRooCodeMemoraoneServer(options) {
|
|
|
5311
5405
|
}
|
|
5312
5406
|
async function setupRooCodeMcpConfig(options) {
|
|
5313
5407
|
const projectPath = options.projectConfigPath ?? getRooCodeProjectMcpConfigPath(options.repoRoot);
|
|
5314
|
-
const workspaceRoot =
|
|
5408
|
+
const workspaceRoot = path25.resolve(options.repoRoot);
|
|
5315
5409
|
const memoraone = await buildRooCodeMemoraoneServer({
|
|
5316
5410
|
workspaceRoot,
|
|
5317
5411
|
devMode: options.devMode,
|
|
@@ -5376,12 +5470,12 @@ function logRooCodeMcpCliSummary(info, dryRun, println = console.log) {
|
|
|
5376
5470
|
"[setup-ide-files] Fully quit Roo Code and reopen this repo for MCP changes to take effect."
|
|
5377
5471
|
);
|
|
5378
5472
|
}
|
|
5379
|
-
var fs19,
|
|
5473
|
+
var fs19, path25, import_node_crypto10, RooCodeMcpJsonParseError;
|
|
5380
5474
|
var init_rooCodeMcpConfig = __esm({
|
|
5381
5475
|
"src/rooCodeMcpConfig.ts"() {
|
|
5382
5476
|
fs19 = __toESM(require("fs/promises"), 1);
|
|
5383
|
-
|
|
5384
|
-
|
|
5477
|
+
path25 = __toESM(require("path"), 1);
|
|
5478
|
+
import_node_crypto10 = require("crypto");
|
|
5385
5479
|
init_configUtils();
|
|
5386
5480
|
init_cursorGlobalMcpConfig();
|
|
5387
5481
|
init_initializeBinding();
|
|
@@ -5413,10 +5507,10 @@ async function pathExists9(filePath) {
|
|
|
5413
5507
|
}
|
|
5414
5508
|
}
|
|
5415
5509
|
function getClineCliRootMcpConfigPath(homeDir) {
|
|
5416
|
-
return
|
|
5510
|
+
return path26.join(homeDir, ".cline", "mcp.json");
|
|
5417
5511
|
}
|
|
5418
5512
|
function getClineCliGlobalMcpConfigPath(homeDir) {
|
|
5419
|
-
return
|
|
5513
|
+
return path26.join(homeDir, ".cline", "data", "settings", "cline_mcp_settings.json");
|
|
5420
5514
|
}
|
|
5421
5515
|
function getClineCliMcpConfigPaths(homeDir) {
|
|
5422
5516
|
return {
|
|
@@ -5432,7 +5526,7 @@ function buildMemoraoneClineCliMcpServer(options) {
|
|
|
5432
5526
|
apiUrl: options.apiUrl ?? (environment === "local" ? DEV_API_URL : void 0)
|
|
5433
5527
|
}),
|
|
5434
5528
|
MEMORAONE_IDE_TYPE: "cline-cli",
|
|
5435
|
-
[MEMORAONE_WORKSPACE_ROOT_ENV]:
|
|
5529
|
+
[MEMORAONE_WORKSPACE_ROOT_ENV]: path26.resolve(options.workspaceRoot)
|
|
5436
5530
|
};
|
|
5437
5531
|
if (environment === "local" || options.devMode) {
|
|
5438
5532
|
env2.MEMORAONE_DEV_MODE = "1";
|
|
@@ -5450,17 +5544,20 @@ function buildMemoraoneClineCliMcpServer(options) {
|
|
|
5450
5544
|
env: env2
|
|
5451
5545
|
};
|
|
5452
5546
|
}
|
|
5453
|
-
function mergeClineCliMcpConfigObject(existing, memoraone) {
|
|
5547
|
+
function mergeClineCliMcpConfigObject(existing, memoraone, ownership) {
|
|
5454
5548
|
const base = existing && typeof existing === "object" ? { ...existing } : { mcpServers: {} };
|
|
5455
5549
|
const mcpServers = typeof base.mcpServers === "object" && base.mcpServers !== null && !Array.isArray(base.mcpServers) ? { ...base.mcpServers } : {};
|
|
5456
|
-
return {
|
|
5550
|
+
return {
|
|
5551
|
+
...base,
|
|
5552
|
+
mcpServers: ownership ? replaceMemoraoneRepositoryBindingInServerMap(mcpServers, memoraone, ownership) : replaceMemoraoneOwnedInServerMap(mcpServers, memoraone)
|
|
5553
|
+
};
|
|
5457
5554
|
}
|
|
5458
5555
|
async function writeClineCliMcpJsonAtomic(filePath, content) {
|
|
5459
|
-
const dir =
|
|
5556
|
+
const dir = path26.dirname(filePath);
|
|
5460
5557
|
await fs20.mkdir(dir, { recursive: true });
|
|
5461
|
-
const tmpPath =
|
|
5558
|
+
const tmpPath = path26.join(
|
|
5462
5559
|
dir,
|
|
5463
|
-
`.${
|
|
5560
|
+
`.${path26.basename(filePath)}.${process.pid}.${(0, import_node_crypto11.randomBytes)(8).toString("hex")}.tmp`
|
|
5464
5561
|
);
|
|
5465
5562
|
try {
|
|
5466
5563
|
await fs20.writeFile(tmpPath, content, "utf8");
|
|
@@ -5476,7 +5573,7 @@ async function writeClineCliMcpJsonAtomic(filePath, content) {
|
|
|
5476
5573
|
function memoraoneServerMatches8(server, expected) {
|
|
5477
5574
|
return canonicalValueMatches(server, expected);
|
|
5478
5575
|
}
|
|
5479
|
-
function validateClineCliMcpConfig(parsed2, expected) {
|
|
5576
|
+
function validateClineCliMcpConfig(parsed2, expected, serverName = CANONICAL_MEMORAONE_MCP_SERVER_NAME) {
|
|
5480
5577
|
if (!parsed2 || typeof parsed2 !== "object") {
|
|
5481
5578
|
throw new Error("[setup-ide-files] Cline CLI MCP config must be a JSON object.");
|
|
5482
5579
|
}
|
|
@@ -5484,7 +5581,8 @@ function validateClineCliMcpConfig(parsed2, expected) {
|
|
|
5484
5581
|
if (!mcpServers || typeof mcpServers !== "object" || Array.isArray(mcpServers)) {
|
|
5485
5582
|
throw new Error("[setup-ide-files] Cline CLI MCP config missing mcpServers object.");
|
|
5486
5583
|
}
|
|
5487
|
-
const
|
|
5584
|
+
const serverMap = mcpServers;
|
|
5585
|
+
const memoraone = serverMap[serverName] ?? Object.values(serverMap).find((entry) => memoraoneServerMatches8(entry, expected));
|
|
5488
5586
|
if (!memoraoneServerMatches8(memoraone, expected)) {
|
|
5489
5587
|
throw new Error(
|
|
5490
5588
|
"[setup-ide-files] Cline CLI MCP config mcpServers.memoraone is missing or invalid."
|
|
@@ -5496,7 +5594,7 @@ async function readJsonConfig6(filePath) {
|
|
|
5496
5594
|
if (raw.trim() === "") return null;
|
|
5497
5595
|
return JSON.parse(stripLeadingLineComments6(raw));
|
|
5498
5596
|
}
|
|
5499
|
-
async function prepareClineCliFile(filePath, memoraone) {
|
|
5597
|
+
async function prepareClineCliFile(filePath, memoraone, ownership) {
|
|
5500
5598
|
const existed = await pathExists9(filePath);
|
|
5501
5599
|
let existing = null;
|
|
5502
5600
|
if (existed) {
|
|
@@ -5509,13 +5607,9 @@ async function prepareClineCliFile(filePath, memoraone) {
|
|
|
5509
5607
|
throw new ClineCliMcpJsonParseError(filePath);
|
|
5510
5608
|
}
|
|
5511
5609
|
}
|
|
5512
|
-
const merged = mergeClineCliMcpConfigObject(existing, memoraone);
|
|
5610
|
+
const merged = mergeClineCliMcpConfigObject(existing, memoraone, ownership);
|
|
5513
5611
|
const body = JSON.stringify(merged, null, 2) + "\n";
|
|
5514
|
-
|
|
5515
|
-
if (existed && existing) {
|
|
5516
|
-
const currentMemoraone = existing.mcpServers && typeof existing.mcpServers === "object" && !Array.isArray(existing.mcpServers) ? existing.mcpServers.memoraone : void 0;
|
|
5517
|
-
alreadyCorrect = memoraoneServerMatches8(currentMemoraone, memoraone);
|
|
5518
|
-
}
|
|
5612
|
+
const alreadyCorrect = Boolean(existed && existing && canonicalValueMatches(existing, merged));
|
|
5519
5613
|
return { filePath, existed, existing, merged, body, alreadyCorrect };
|
|
5520
5614
|
}
|
|
5521
5615
|
function outcomeForPrepared(prepared) {
|
|
@@ -5573,7 +5667,7 @@ async function setupClineCliMcpConfig(options) {
|
|
|
5573
5667
|
const defaults = getClineCliMcpConfigPaths(homeDir);
|
|
5574
5668
|
const rootConfigPath = options.rootConfigPath ?? defaults.rootConfigPath;
|
|
5575
5669
|
const settingsConfigPath = options.globalConfigPath ?? defaults.settingsConfigPath;
|
|
5576
|
-
const workspaceRoot =
|
|
5670
|
+
const workspaceRoot = path26.resolve(options.repoRoot);
|
|
5577
5671
|
const memoraone = await buildClineCliMemoraoneServer({
|
|
5578
5672
|
workspaceRoot,
|
|
5579
5673
|
devMode: options.devMode,
|
|
@@ -5583,8 +5677,12 @@ async function setupClineCliMcpConfig(options) {
|
|
|
5583
5677
|
npxPathOverride: options.npxPathOverride,
|
|
5584
5678
|
cliPathOverride: options.cliPathOverride
|
|
5585
5679
|
});
|
|
5586
|
-
const rootPrepared = await prepareClineCliFile(rootConfigPath, memoraone);
|
|
5587
|
-
const settingsPrepared = await prepareClineCliFile(
|
|
5680
|
+
const rootPrepared = await prepareClineCliFile(rootConfigPath, memoraone, options.ownership);
|
|
5681
|
+
const settingsPrepared = await prepareClineCliFile(
|
|
5682
|
+
settingsConfigPath,
|
|
5683
|
+
memoraone,
|
|
5684
|
+
options.ownership
|
|
5685
|
+
);
|
|
5588
5686
|
const rootOutcome = outcomeForPrepared(rootPrepared);
|
|
5589
5687
|
const settingsOutcome = outcomeForPrepared(settingsPrepared);
|
|
5590
5688
|
const outcome = combineClineCliOutcomes(rootOutcome, settingsOutcome);
|
|
@@ -5615,7 +5713,11 @@ async function setupClineCliMcpConfig(options) {
|
|
|
5615
5713
|
await writeClineCliMcpJsonAtomic(prepared.filePath, prepared.body);
|
|
5616
5714
|
const verifyRaw = await fs20.readFile(prepared.filePath, "utf8");
|
|
5617
5715
|
const verifyParsed = JSON.parse(stripLeadingLineComments6(verifyRaw));
|
|
5618
|
-
validateClineCliMcpConfig(
|
|
5716
|
+
validateClineCliMcpConfig(
|
|
5717
|
+
verifyParsed,
|
|
5718
|
+
memoraone,
|
|
5719
|
+
options.ownership ? memoraoneServerNameForRepositoryBinding(options.ownership.repositoryBindingId) : CANONICAL_MEMORAONE_MCP_SERVER_NAME
|
|
5720
|
+
);
|
|
5619
5721
|
}
|
|
5620
5722
|
return {
|
|
5621
5723
|
outcome,
|
|
@@ -5650,13 +5752,13 @@ function logClineCliMcpCliSummary(info, dryRun, println = console.log) {
|
|
|
5650
5752
|
"[setup-ide-files] Fully quit Cline CLI and reopen for MCP changes to take effect."
|
|
5651
5753
|
);
|
|
5652
5754
|
}
|
|
5653
|
-
var fs20, os7,
|
|
5755
|
+
var fs20, os7, path26, import_node_crypto11, CLINE_CLI_MCP_TIMEOUT_SECONDS, ClineCliMcpJsonParseError;
|
|
5654
5756
|
var init_clineCliMcpConfig = __esm({
|
|
5655
5757
|
"src/clineCliMcpConfig.ts"() {
|
|
5656
5758
|
fs20 = __toESM(require("fs/promises"), 1);
|
|
5657
5759
|
os7 = __toESM(require("os"), 1);
|
|
5658
|
-
|
|
5659
|
-
|
|
5760
|
+
path26 = __toESM(require("path"), 1);
|
|
5761
|
+
import_node_crypto11 = require("crypto");
|
|
5660
5762
|
init_configUtils();
|
|
5661
5763
|
init_cursorGlobalMcpConfig();
|
|
5662
5764
|
init_initializeBinding();
|
|
@@ -5689,7 +5791,7 @@ async function pathExists10(filePath) {
|
|
|
5689
5791
|
}
|
|
5690
5792
|
}
|
|
5691
5793
|
function getClaudeDesktopGlobalMcpConfigPath(homeDir) {
|
|
5692
|
-
return
|
|
5794
|
+
return path27.join(
|
|
5693
5795
|
homeDir,
|
|
5694
5796
|
"Library",
|
|
5695
5797
|
"Application Support",
|
|
@@ -5709,7 +5811,7 @@ function buildMemoraoneClaudeDesktopMcpServer(options) {
|
|
|
5709
5811
|
apiUrl: options.apiUrl ?? (environment === "local" ? DEV_API_URL : void 0)
|
|
5710
5812
|
}),
|
|
5711
5813
|
MEMORAONE_IDE_TYPE: "claude-desktop",
|
|
5712
|
-
[MEMORAONE_WORKSPACE_ROOT_ENV]:
|
|
5814
|
+
[MEMORAONE_WORKSPACE_ROOT_ENV]: path27.resolve(options.workspaceRoot)
|
|
5713
5815
|
};
|
|
5714
5816
|
if (environment === "local" || options.devMode) {
|
|
5715
5817
|
env2.MEMORAONE_DEV_MODE = "1";
|
|
@@ -5725,17 +5827,17 @@ function buildMemoraoneClaudeDesktopMcpServer(options) {
|
|
|
5725
5827
|
env: env2
|
|
5726
5828
|
};
|
|
5727
5829
|
}
|
|
5728
|
-
function mergeClaudeDesktopMcpConfigObject(existing, memoraone) {
|
|
5830
|
+
function mergeClaudeDesktopMcpConfigObject(existing, memoraone, ownership) {
|
|
5729
5831
|
const base = existing && typeof existing === "object" ? { ...existing } : { mcpServers: {} };
|
|
5730
5832
|
const mcpServers = typeof base.mcpServers === "object" && base.mcpServers !== null && !Array.isArray(base.mcpServers) ? { ...base.mcpServers } : {};
|
|
5731
|
-
return { ...base, mcpServers: replaceMemoraoneOwnedInServerMap(mcpServers, memoraone) };
|
|
5833
|
+
return { ...base, mcpServers: ownership ? replaceMemoraoneRepositoryBindingInServerMap(mcpServers, memoraone, ownership) : replaceMemoraoneOwnedInServerMap(mcpServers, memoraone) };
|
|
5732
5834
|
}
|
|
5733
5835
|
async function writeClaudeDesktopMcpJsonAtomic(filePath, content) {
|
|
5734
|
-
const dir =
|
|
5836
|
+
const dir = path27.dirname(filePath);
|
|
5735
5837
|
await fs21.mkdir(dir, { recursive: true });
|
|
5736
|
-
const tmpPath =
|
|
5838
|
+
const tmpPath = path27.join(
|
|
5737
5839
|
dir,
|
|
5738
|
-
`.${
|
|
5840
|
+
`.${path27.basename(filePath)}.${process.pid}.${(0, import_node_crypto12.randomBytes)(8).toString("hex")}.tmp`
|
|
5739
5841
|
);
|
|
5740
5842
|
try {
|
|
5741
5843
|
await fs21.writeFile(tmpPath, content, "utf8");
|
|
@@ -5751,7 +5853,7 @@ async function writeClaudeDesktopMcpJsonAtomic(filePath, content) {
|
|
|
5751
5853
|
function memoraoneServerMatches9(server, expected) {
|
|
5752
5854
|
return canonicalValueMatches(server, expected);
|
|
5753
5855
|
}
|
|
5754
|
-
function validateClaudeDesktopMcpConfig(parsed2, expected) {
|
|
5856
|
+
function validateClaudeDesktopMcpConfig(parsed2, expected, serverName = CANONICAL_MEMORAONE_MCP_SERVER_NAME) {
|
|
5755
5857
|
if (!parsed2 || typeof parsed2 !== "object") {
|
|
5756
5858
|
throw new Error("[setup-ide-files] Claude Desktop MCP config must be a JSON object.");
|
|
5757
5859
|
}
|
|
@@ -5759,7 +5861,8 @@ function validateClaudeDesktopMcpConfig(parsed2, expected) {
|
|
|
5759
5861
|
if (!mcpServers || typeof mcpServers !== "object" || Array.isArray(mcpServers)) {
|
|
5760
5862
|
throw new Error("[setup-ide-files] Claude Desktop MCP config missing mcpServers object.");
|
|
5761
5863
|
}
|
|
5762
|
-
const
|
|
5864
|
+
const serverMap = mcpServers;
|
|
5865
|
+
const memoraone = serverMap[serverName] ?? Object.values(serverMap).find((entry) => memoraoneServerMatches9(entry, expected));
|
|
5763
5866
|
if (!memoraoneServerMatches9(memoraone, expected)) {
|
|
5764
5867
|
throw new Error(
|
|
5765
5868
|
"[setup-ide-files] Claude Desktop MCP config mcpServers.memoraone is missing or invalid."
|
|
@@ -5819,7 +5922,7 @@ async function buildClaudeDesktopMemoraoneServer(options) {
|
|
|
5819
5922
|
async function setupClaudeDesktopMcpConfig(options) {
|
|
5820
5923
|
const homeDir = options.homeDir ?? os8.homedir();
|
|
5821
5924
|
const activePath = options.globalConfigPath ?? getClaudeDesktopGlobalMcpConfigPath(homeDir);
|
|
5822
|
-
const workspaceRoot =
|
|
5925
|
+
const workspaceRoot = path27.resolve(options.repoRoot);
|
|
5823
5926
|
const memoraone = await buildClaudeDesktopMemoraoneServer({
|
|
5824
5927
|
workspaceRoot,
|
|
5825
5928
|
devMode: options.devMode,
|
|
@@ -5841,11 +5944,10 @@ async function setupClaudeDesktopMcpConfig(options) {
|
|
|
5841
5944
|
throw new ClaudeDesktopMcpJsonParseError(activePath);
|
|
5842
5945
|
}
|
|
5843
5946
|
}
|
|
5844
|
-
const merged = mergeClaudeDesktopMcpConfigObject(existing, memoraone);
|
|
5947
|
+
const merged = mergeClaudeDesktopMcpConfigObject(existing, memoraone, options.ownership);
|
|
5845
5948
|
const body = JSON.stringify(merged, null, 2) + "\n";
|
|
5846
5949
|
if (existed && existing) {
|
|
5847
|
-
|
|
5848
|
-
if (memoraoneServerMatches9(currentMemoraone, memoraone)) {
|
|
5950
|
+
if (canonicalValueMatches(existing, merged)) {
|
|
5849
5951
|
return { outcome: "skipped", memoraone, activeConfigPath: activePath };
|
|
5850
5952
|
}
|
|
5851
5953
|
}
|
|
@@ -5863,7 +5965,7 @@ async function setupClaudeDesktopMcpConfig(options) {
|
|
|
5863
5965
|
await writeClaudeDesktopMcpJsonAtomic(activePath, body);
|
|
5864
5966
|
const verifyRaw = await fs21.readFile(activePath, "utf8");
|
|
5865
5967
|
const verifyParsed = JSON.parse(stripLeadingLineComments7(verifyRaw));
|
|
5866
|
-
validateClaudeDesktopMcpConfig(verifyParsed, memoraone);
|
|
5968
|
+
validateClaudeDesktopMcpConfig(verifyParsed, memoraone, options.ownership ? memoraoneServerNameForRepositoryBinding(options.ownership.repositoryBindingId) : CANONICAL_MEMORAONE_MCP_SERVER_NAME);
|
|
5867
5969
|
return {
|
|
5868
5970
|
outcome: existed ? "updated" : "created",
|
|
5869
5971
|
backupPath,
|
|
@@ -5897,13 +5999,13 @@ function logClaudeDesktopMcpCliSummary(info, dryRun, println = console.log) {
|
|
|
5897
5999
|
"[setup-ide-files] Fully quit Claude Desktop and reopen for MCP changes to take effect."
|
|
5898
6000
|
);
|
|
5899
6001
|
}
|
|
5900
|
-
var fs21, os8,
|
|
6002
|
+
var fs21, os8, path27, import_node_crypto12, ClaudeDesktopMcpJsonParseError;
|
|
5901
6003
|
var init_claudeDesktopMcpConfig = __esm({
|
|
5902
6004
|
"src/claudeDesktopMcpConfig.ts"() {
|
|
5903
6005
|
fs21 = __toESM(require("fs/promises"), 1);
|
|
5904
6006
|
os8 = __toESM(require("os"), 1);
|
|
5905
|
-
|
|
5906
|
-
|
|
6007
|
+
path27 = __toESM(require("path"), 1);
|
|
6008
|
+
import_node_crypto12 = require("crypto");
|
|
5907
6009
|
init_configUtils();
|
|
5908
6010
|
init_cursorGlobalMcpConfig();
|
|
5909
6011
|
init_initializeBinding();
|
|
@@ -5935,7 +6037,7 @@ async function pathExists11(filePath) {
|
|
|
5935
6037
|
}
|
|
5936
6038
|
}
|
|
5937
6039
|
function getZedProjectMcpConfigPath(repoRoot) {
|
|
5938
|
-
return
|
|
6040
|
+
return path28.join(path28.resolve(repoRoot), ".zed", "settings.json");
|
|
5939
6041
|
}
|
|
5940
6042
|
function buildMemoraoneZedMcpServer(options) {
|
|
5941
6043
|
const environment = options.environment ?? (options.devMode ? "local" : "production");
|
|
@@ -5945,7 +6047,7 @@ function buildMemoraoneZedMcpServer(options) {
|
|
|
5945
6047
|
apiUrl: options.apiUrl ?? (environment === "local" ? DEV_API_URL : void 0)
|
|
5946
6048
|
}),
|
|
5947
6049
|
MEMORAONE_IDE_TYPE: "zed",
|
|
5948
|
-
[MEMORAONE_WORKSPACE_ROOT_ENV]:
|
|
6050
|
+
[MEMORAONE_WORKSPACE_ROOT_ENV]: path28.resolve(options.workspaceRoot)
|
|
5949
6051
|
};
|
|
5950
6052
|
if (environment === "local" || options.devMode) {
|
|
5951
6053
|
env2.MEMORAONE_DEV_MODE = "1";
|
|
@@ -5970,11 +6072,11 @@ function mergeZedMcpConfigObject(existing, memoraone) {
|
|
|
5970
6072
|
};
|
|
5971
6073
|
}
|
|
5972
6074
|
async function writeZedMcpJsonAtomic(filePath, content) {
|
|
5973
|
-
const dir =
|
|
6075
|
+
const dir = path28.dirname(filePath);
|
|
5974
6076
|
await fs22.mkdir(dir, { recursive: true });
|
|
5975
|
-
const tmpPath =
|
|
6077
|
+
const tmpPath = path28.join(
|
|
5976
6078
|
dir,
|
|
5977
|
-
`.${
|
|
6079
|
+
`.${path28.basename(filePath)}.${process.pid}.${(0, import_node_crypto13.randomBytes)(8).toString("hex")}.tmp`
|
|
5978
6080
|
);
|
|
5979
6081
|
try {
|
|
5980
6082
|
await fs22.writeFile(tmpPath, content, "utf8");
|
|
@@ -6052,7 +6154,7 @@ async function buildZedMemoraoneServer(options) {
|
|
|
6052
6154
|
}
|
|
6053
6155
|
async function setupZedMcpConfig(options) {
|
|
6054
6156
|
const projectPath = options.projectConfigPath ?? getZedProjectMcpConfigPath(options.repoRoot);
|
|
6055
|
-
const workspaceRoot =
|
|
6157
|
+
const workspaceRoot = path28.resolve(options.repoRoot);
|
|
6056
6158
|
const memoraone = await buildZedMemoraoneServer({
|
|
6057
6159
|
workspaceRoot,
|
|
6058
6160
|
devMode: options.devMode,
|
|
@@ -6115,12 +6217,12 @@ function logZedMcpCliSummary(info, dryRun, println = console.log) {
|
|
|
6115
6217
|
"[setup-ide-files] Fully quit Zed and reopen this repo for MCP changes to take effect."
|
|
6116
6218
|
);
|
|
6117
6219
|
}
|
|
6118
|
-
var fs22,
|
|
6220
|
+
var fs22, path28, import_node_crypto13, ZedMcpJsonParseError;
|
|
6119
6221
|
var init_zedMcpConfig = __esm({
|
|
6120
6222
|
"src/zedMcpConfig.ts"() {
|
|
6121
6223
|
fs22 = __toESM(require("fs/promises"), 1);
|
|
6122
|
-
|
|
6123
|
-
|
|
6224
|
+
path28 = __toESM(require("path"), 1);
|
|
6225
|
+
import_node_crypto13 = require("crypto");
|
|
6124
6226
|
init_configUtils();
|
|
6125
6227
|
init_cursorGlobalMcpConfig();
|
|
6126
6228
|
init_initializeBinding();
|
|
@@ -6152,7 +6254,7 @@ async function pathExists12(filePath) {
|
|
|
6152
6254
|
}
|
|
6153
6255
|
}
|
|
6154
6256
|
function getVisualStudioProjectMcpConfigPath(repoRoot) {
|
|
6155
|
-
return
|
|
6257
|
+
return path29.join(path29.resolve(repoRoot), ".vs", "mcp.json");
|
|
6156
6258
|
}
|
|
6157
6259
|
function buildMemoraoneVisualStudioMcpServer(options) {
|
|
6158
6260
|
const environment = options.environment ?? (options.devMode ? "local" : "production");
|
|
@@ -6162,7 +6264,7 @@ function buildMemoraoneVisualStudioMcpServer(options) {
|
|
|
6162
6264
|
apiUrl: options.apiUrl ?? (environment === "local" ? DEV_API_URL : void 0)
|
|
6163
6265
|
}),
|
|
6164
6266
|
MEMORAONE_IDE_TYPE: "visual-studio",
|
|
6165
|
-
[MEMORAONE_WORKSPACE_ROOT_ENV]:
|
|
6267
|
+
[MEMORAONE_WORKSPACE_ROOT_ENV]: path29.resolve(options.workspaceRoot)
|
|
6166
6268
|
};
|
|
6167
6269
|
if (environment === "local" || options.devMode) {
|
|
6168
6270
|
env2.MEMORAONE_DEV_MODE = "1";
|
|
@@ -6185,11 +6287,11 @@ function mergeVisualStudioMcpConfigObject(existing, memoraone) {
|
|
|
6185
6287
|
return { ...base, servers: replaceMemoraoneOwnedInServerMap(servers, memoraone) };
|
|
6186
6288
|
}
|
|
6187
6289
|
async function writeVisualStudioMcpJsonAtomic(filePath, content) {
|
|
6188
|
-
const dir =
|
|
6290
|
+
const dir = path29.dirname(filePath);
|
|
6189
6291
|
await fs23.mkdir(dir, { recursive: true });
|
|
6190
|
-
const tmpPath =
|
|
6292
|
+
const tmpPath = path29.join(
|
|
6191
6293
|
dir,
|
|
6192
|
-
`.${
|
|
6294
|
+
`.${path29.basename(filePath)}.${process.pid}.${(0, import_node_crypto14.randomBytes)(8).toString("hex")}.tmp`
|
|
6193
6295
|
);
|
|
6194
6296
|
try {
|
|
6195
6297
|
await fs23.writeFile(tmpPath, content, "utf8");
|
|
@@ -6267,7 +6369,7 @@ async function buildVisualStudioMemoraoneServer(options) {
|
|
|
6267
6369
|
}
|
|
6268
6370
|
async function setupVisualStudioMcpConfig(options) {
|
|
6269
6371
|
const projectPath = options.projectConfigPath ?? getVisualStudioProjectMcpConfigPath(options.repoRoot);
|
|
6270
|
-
const workspaceRoot =
|
|
6372
|
+
const workspaceRoot = path29.resolve(options.repoRoot);
|
|
6271
6373
|
const memoraone = await buildVisualStudioMemoraoneServer({
|
|
6272
6374
|
workspaceRoot,
|
|
6273
6375
|
devMode: options.devMode,
|
|
@@ -6332,12 +6434,12 @@ function logVisualStudioMcpCliSummary(info, dryRun, println = console.log) {
|
|
|
6332
6434
|
"[setup-ide-files] Fully quit Visual Studio and reopen this repo for MCP changes to take effect."
|
|
6333
6435
|
);
|
|
6334
6436
|
}
|
|
6335
|
-
var fs23,
|
|
6437
|
+
var fs23, path29, import_node_crypto14, VisualStudioMcpJsonParseError;
|
|
6336
6438
|
var init_visualStudioMcpConfig = __esm({
|
|
6337
6439
|
"src/visualStudioMcpConfig.ts"() {
|
|
6338
6440
|
fs23 = __toESM(require("fs/promises"), 1);
|
|
6339
|
-
|
|
6340
|
-
|
|
6441
|
+
path29 = __toESM(require("path"), 1);
|
|
6442
|
+
import_node_crypto14 = require("crypto");
|
|
6341
6443
|
init_configUtils();
|
|
6342
6444
|
init_cursorGlobalMcpConfig();
|
|
6343
6445
|
init_initializeBinding();
|
|
@@ -6366,7 +6468,7 @@ async function pathExists13(filePath) {
|
|
|
6366
6468
|
}
|
|
6367
6469
|
}
|
|
6368
6470
|
function getContinueProjectMcpConfigPath(repoRoot) {
|
|
6369
|
-
return
|
|
6471
|
+
return path30.join(path30.resolve(repoRoot), ".continue", "mcpServers", "memoraone.yaml");
|
|
6370
6472
|
}
|
|
6371
6473
|
function buildMemoraoneContinueMcpServer(options) {
|
|
6372
6474
|
const environment = options.environment ?? (options.devMode ? "local" : "production");
|
|
@@ -6376,7 +6478,7 @@ function buildMemoraoneContinueMcpServer(options) {
|
|
|
6376
6478
|
apiUrl: options.apiUrl ?? (environment === "local" ? DEV_API_URL : void 0)
|
|
6377
6479
|
}),
|
|
6378
6480
|
MEMORAONE_IDE_TYPE: "continue",
|
|
6379
|
-
[MEMORAONE_WORKSPACE_ROOT_ENV]:
|
|
6481
|
+
[MEMORAONE_WORKSPACE_ROOT_ENV]: path30.resolve(options.workspaceRoot)
|
|
6380
6482
|
};
|
|
6381
6483
|
if (environment === "local" || options.devMode) {
|
|
6382
6484
|
env2.MEMORAONE_DEV_MODE = "1";
|
|
@@ -6425,11 +6527,11 @@ function mergeContinueMcpConfigObject(existing, memoraone) {
|
|
|
6425
6527
|
return base;
|
|
6426
6528
|
}
|
|
6427
6529
|
async function writeContinueMcpYamlAtomic(filePath, content) {
|
|
6428
|
-
const dir =
|
|
6530
|
+
const dir = path30.dirname(filePath);
|
|
6429
6531
|
await fs24.mkdir(dir, { recursive: true });
|
|
6430
|
-
const tmpPath =
|
|
6532
|
+
const tmpPath = path30.join(
|
|
6431
6533
|
dir,
|
|
6432
|
-
`.${
|
|
6534
|
+
`.${path30.basename(filePath)}.${process.pid}.${(0, import_node_crypto15.randomBytes)(8).toString("hex")}.tmp`
|
|
6433
6535
|
);
|
|
6434
6536
|
try {
|
|
6435
6537
|
await fs24.writeFile(tmpPath, content, "utf8");
|
|
@@ -6517,7 +6619,7 @@ async function buildContinueMemoraoneServer(options) {
|
|
|
6517
6619
|
}
|
|
6518
6620
|
async function setupContinueMcpConfig(options) {
|
|
6519
6621
|
const projectPath = options.projectConfigPath ?? getContinueProjectMcpConfigPath(options.repoRoot);
|
|
6520
|
-
const workspaceRoot =
|
|
6622
|
+
const workspaceRoot = path30.resolve(options.repoRoot);
|
|
6521
6623
|
const memoraone = await buildContinueMemoraoneServer({
|
|
6522
6624
|
workspaceRoot,
|
|
6523
6625
|
devMode: options.devMode,
|
|
@@ -6590,12 +6692,12 @@ function logContinueMcpCliSummary(info, dryRun, println = console.log) {
|
|
|
6590
6692
|
"[setup-ide-files] Fully quit Continue and reopen this repo for MCP changes to take effect."
|
|
6591
6693
|
);
|
|
6592
6694
|
}
|
|
6593
|
-
var fs24,
|
|
6695
|
+
var fs24, path30, import_node_crypto15, import_yaml, ContinueMcpYamlParseError;
|
|
6594
6696
|
var init_continueMcpConfig = __esm({
|
|
6595
6697
|
"src/continueMcpConfig.ts"() {
|
|
6596
6698
|
fs24 = __toESM(require("fs/promises"), 1);
|
|
6597
|
-
|
|
6598
|
-
|
|
6699
|
+
path30 = __toESM(require("path"), 1);
|
|
6700
|
+
import_node_crypto15 = require("crypto");
|
|
6599
6701
|
import_yaml = require("yaml");
|
|
6600
6702
|
init_configUtils();
|
|
6601
6703
|
init_cursorGlobalMcpConfig();
|
|
@@ -6627,49 +6729,8 @@ async function pathExists14(filePath) {
|
|
|
6627
6729
|
return false;
|
|
6628
6730
|
}
|
|
6629
6731
|
}
|
|
6630
|
-
function
|
|
6631
|
-
|
|
6632
|
-
return path29.join(
|
|
6633
|
-
homeDir,
|
|
6634
|
-
"Library",
|
|
6635
|
-
"Application Support",
|
|
6636
|
-
DARWIN_APP_SUPPORT_NAMES[hostId],
|
|
6637
|
-
CLINE_EXTENSION_RELATIVE
|
|
6638
|
-
);
|
|
6639
|
-
}
|
|
6640
|
-
return path29.join(homeDir, `.cline-host-${hostId}`, CLINE_EXTENSION_RELATIVE);
|
|
6641
|
-
}
|
|
6642
|
-
function getClineHostInstallRoot(homeDir, hostId, platform2 = process.platform) {
|
|
6643
|
-
if (platform2 === "darwin") {
|
|
6644
|
-
return path29.join(homeDir, "Library", "Application Support", DARWIN_APP_SUPPORT_NAMES[hostId]);
|
|
6645
|
-
}
|
|
6646
|
-
return path29.join(homeDir, `.cline-host-${hostId}`);
|
|
6647
|
-
}
|
|
6648
|
-
function getKnownClineHostCandidates(homeDir, platform2 = process.platform) {
|
|
6649
|
-
return CLINE_HOST_IDS.map((hostId) => ({
|
|
6650
|
-
hostId,
|
|
6651
|
-
installRoot: getClineHostInstallRoot(homeDir, hostId, platform2),
|
|
6652
|
-
configPath: getClineHostMcpConfigPath(homeDir, hostId, platform2)
|
|
6653
|
-
}));
|
|
6654
|
-
}
|
|
6655
|
-
async function detectClineHosts(options) {
|
|
6656
|
-
const platform2 = options.platform ?? process.platform;
|
|
6657
|
-
const exists = options.pathExistsFn ?? pathExists14;
|
|
6658
|
-
const candidates = getKnownClineHostCandidates(options.homeDir, platform2);
|
|
6659
|
-
const hostIdFilter = options.explicitHostIds ? new Set(options.explicitHostIds) : null;
|
|
6660
|
-
const selected = [];
|
|
6661
|
-
for (const c of candidates) {
|
|
6662
|
-
if (hostIdFilter && !hostIdFilter.has(c.hostId)) continue;
|
|
6663
|
-
const configPath = options.explicitHostPaths?.[c.hostId] ?? c.configPath;
|
|
6664
|
-
if (hostIdFilter) {
|
|
6665
|
-
selected.push({ hostId: c.hostId, configPath, installRoot: c.installRoot });
|
|
6666
|
-
continue;
|
|
6667
|
-
}
|
|
6668
|
-
if (await exists(c.installRoot)) {
|
|
6669
|
-
selected.push({ hostId: c.hostId, configPath, installRoot: c.installRoot });
|
|
6670
|
-
}
|
|
6671
|
-
}
|
|
6672
|
-
return selected;
|
|
6732
|
+
function getClineProjectMcpConfigPath(repoRoot) {
|
|
6733
|
+
return path31.join(path31.resolve(repoRoot), ".cline", "mcp.json");
|
|
6673
6734
|
}
|
|
6674
6735
|
function formatClineBackupTimestamp(d = /* @__PURE__ */ new Date()) {
|
|
6675
6736
|
const pad = (n) => String(n).padStart(2, "0");
|
|
@@ -6683,21 +6744,10 @@ function buildMemoraoneClineMcpServer(options) {
|
|
|
6683
6744
|
apiUrl: options.apiUrl ?? (environment === "local" ? DEV_API_URL : void 0)
|
|
6684
6745
|
}),
|
|
6685
6746
|
MEMORAONE_IDE_TYPE: "cline",
|
|
6686
|
-
[MEMORAONE_WORKSPACE_ROOT_ENV]:
|
|
6687
|
-
};
|
|
6688
|
-
if (environment === "local" || options.devMode) {
|
|
6689
|
-
env2.MEMORAONE_DEV_MODE = "1";
|
|
6690
|
-
}
|
|
6691
|
-
if ("MEMORAONE_M1_PATH" in env2 || "MEMORAONE_API_KEY" in env2) {
|
|
6692
|
-
throw new Error(
|
|
6693
|
-
"[setup-ide-files] Cline MCP config must not include credentials or .m1 paths"
|
|
6694
|
-
);
|
|
6695
|
-
}
|
|
6696
|
-
return {
|
|
6697
|
-
command: options.command,
|
|
6698
|
-
args: options.args,
|
|
6699
|
-
env: env2
|
|
6747
|
+
[MEMORAONE_WORKSPACE_ROOT_ENV]: path31.resolve(options.workspaceRoot)
|
|
6700
6748
|
};
|
|
6749
|
+
if (environment === "local" || options.devMode) env2.MEMORAONE_DEV_MODE = "1";
|
|
6750
|
+
return { command: options.command, args: options.args, env: env2 };
|
|
6701
6751
|
}
|
|
6702
6752
|
function mergeClineMcpConfigObject(existing, memoraone) {
|
|
6703
6753
|
const base = existing && typeof existing === "object" ? { ...existing } : { mcpServers: {} };
|
|
@@ -6705,11 +6755,11 @@ function mergeClineMcpConfigObject(existing, memoraone) {
|
|
|
6705
6755
|
return { ...base, mcpServers: replaceMemoraoneOwnedInServerMap(mcpServers, memoraone) };
|
|
6706
6756
|
}
|
|
6707
6757
|
async function writeClineMcpJsonAtomic(filePath, content) {
|
|
6708
|
-
const dir =
|
|
6758
|
+
const dir = path31.dirname(filePath);
|
|
6709
6759
|
await fs25.mkdir(dir, { recursive: true });
|
|
6710
|
-
const tmpPath =
|
|
6760
|
+
const tmpPath = path31.join(
|
|
6711
6761
|
dir,
|
|
6712
|
-
`.${
|
|
6762
|
+
`.${path31.basename(filePath)}.${process.pid}.${(0, import_node_crypto16.randomBytes)(8).toString("hex")}.tmp`
|
|
6713
6763
|
);
|
|
6714
6764
|
try {
|
|
6715
6765
|
await fs25.writeFile(tmpPath, content, "utf8");
|
|
@@ -6733,11 +6783,9 @@ function validateClineMcpConfig(parsed2, expected) {
|
|
|
6733
6783
|
if (!mcpServers || typeof mcpServers !== "object" || Array.isArray(mcpServers)) {
|
|
6734
6784
|
throw new Error("[setup-ide-files] Cline MCP config missing mcpServers object.");
|
|
6735
6785
|
}
|
|
6736
|
-
const memoraone = mcpServers
|
|
6786
|
+
const memoraone = mcpServers[CANONICAL_MEMORAONE_MCP_SERVER_NAME];
|
|
6737
6787
|
if (!memoraoneServerMatches13(memoraone, expected)) {
|
|
6738
|
-
throw new Error(
|
|
6739
|
-
"[setup-ide-files] Cline MCP config mcpServers.memoraone is missing or invalid."
|
|
6740
|
-
);
|
|
6788
|
+
throw new Error("[setup-ide-files] Cline MCP config mcpServers.memoraone is missing or invalid.");
|
|
6741
6789
|
}
|
|
6742
6790
|
}
|
|
6743
6791
|
async function readJsonConfig10(filePath) {
|
|
@@ -6754,13 +6802,9 @@ async function buildClineMemoraoneServer(options) {
|
|
|
6754
6802
|
const environment = options.environment ?? (options.devMode ? "local" : "production");
|
|
6755
6803
|
if (environment === "local" || options.devMode) {
|
|
6756
6804
|
let cliPath = options.cliPathOverride;
|
|
6757
|
-
if (cliPath === void 0)
|
|
6758
|
-
cliPath = await resolveLocalCliPathAsync();
|
|
6759
|
-
}
|
|
6805
|
+
if (cliPath === void 0) cliPath = await resolveLocalCliPathAsync();
|
|
6760
6806
|
if (!cliPath) {
|
|
6761
|
-
throw new Error(
|
|
6762
|
-
"[setup-ide-files] Dev mode requires a built CLI at packages/mcp/dist/cli.cjs. Run pnpm build first."
|
|
6763
|
-
);
|
|
6807
|
+
throw new Error("[setup-ide-files] Dev mode requires a built CLI at packages/mcp/dist/cli.cjs. Run pnpm build first.");
|
|
6764
6808
|
}
|
|
6765
6809
|
return buildMemoraoneClineMcpServer({
|
|
6766
6810
|
command: process.execPath,
|
|
@@ -6772,13 +6816,9 @@ async function buildClineMemoraoneServer(options) {
|
|
|
6772
6816
|
});
|
|
6773
6817
|
}
|
|
6774
6818
|
let npxPath = options.npxPathOverride;
|
|
6775
|
-
if (npxPath === void 0)
|
|
6776
|
-
npxPath = await resolveNpxPath();
|
|
6777
|
-
}
|
|
6819
|
+
if (npxPath === void 0) npxPath = await resolveNpxPath();
|
|
6778
6820
|
if (!npxPath) {
|
|
6779
|
-
throw new Error(
|
|
6780
|
-
"[setup-ide-files] Could not resolve a working npx executable. Install Node.js/npm or ensure npx is on PATH before configuring Cline MCP."
|
|
6781
|
-
);
|
|
6821
|
+
throw new Error("[setup-ide-files] Could not resolve a working npx executable. Install Node.js/npm or ensure npx is on PATH before configuring Cline MCP.");
|
|
6782
6822
|
}
|
|
6783
6823
|
const channel = options.npmPackageChannel ?? npmPackageChannelFromEnvironment(environment);
|
|
6784
6824
|
return buildMemoraoneClineMcpServer({
|
|
@@ -6786,12 +6826,21 @@ async function buildClineMemoraoneServer(options) {
|
|
|
6786
6826
|
args: ["-y", memoraoneNpmPackageSpec(channel)],
|
|
6787
6827
|
workspaceRoot: options.workspaceRoot,
|
|
6788
6828
|
environment,
|
|
6789
|
-
devMode: false,
|
|
6790
6829
|
apiUrl: options.apiUrl
|
|
6791
6830
|
});
|
|
6792
6831
|
}
|
|
6793
|
-
async function
|
|
6794
|
-
const
|
|
6832
|
+
async function setupClineMcpConfig(options) {
|
|
6833
|
+
const workspaceRoot = path31.resolve(options.repoRoot);
|
|
6834
|
+
const configPath = options.projectConfigPath ?? getClineProjectMcpConfigPath(workspaceRoot);
|
|
6835
|
+
const memoraone = await buildClineMemoraoneServer({
|
|
6836
|
+
workspaceRoot,
|
|
6837
|
+
devMode: options.devMode,
|
|
6838
|
+
environment: options.environment,
|
|
6839
|
+
npmPackageChannel: options.npmPackageChannel,
|
|
6840
|
+
apiUrl: options.apiUrl,
|
|
6841
|
+
npxPathOverride: options.npxPathOverride,
|
|
6842
|
+
cliPathOverride: options.cliPathOverride
|
|
6843
|
+
});
|
|
6795
6844
|
const existed = await pathExists14(configPath);
|
|
6796
6845
|
let existing = null;
|
|
6797
6846
|
if (existed) {
|
|
@@ -6805,143 +6854,50 @@ async function setupOneClineHost(options) {
|
|
|
6805
6854
|
}
|
|
6806
6855
|
}
|
|
6807
6856
|
const merged = mergeClineMcpConfigObject(existing, memoraone);
|
|
6808
|
-
|
|
6809
|
-
|
|
6810
|
-
const currentMemoraone = existing.mcpServers && typeof existing.mcpServers === "object" && !Array.isArray(existing.mcpServers) ? existing.mcpServers.memoraone : void 0;
|
|
6811
|
-
if (memoraoneServerMatches13(currentMemoraone, memoraone)) {
|
|
6812
|
-
return { hostId, activeConfigPath: configPath, outcome: "skipped" };
|
|
6813
|
-
}
|
|
6814
|
-
}
|
|
6815
|
-
if (dryRun) {
|
|
6816
|
-
return {
|
|
6817
|
-
hostId,
|
|
6818
|
-
activeConfigPath: configPath,
|
|
6819
|
-
outcome: existed ? "updated" : "created"
|
|
6820
|
-
};
|
|
6821
|
-
}
|
|
6822
|
-
let backupPath;
|
|
6823
|
-
if (existed) {
|
|
6824
|
-
backupPath = await backupConfigFile4(configPath);
|
|
6825
|
-
}
|
|
6826
|
-
await writeClineMcpJsonAtomic(configPath, body);
|
|
6827
|
-
const verifyRaw = await fs25.readFile(configPath, "utf8");
|
|
6828
|
-
const verifyParsed = JSON.parse(stripLeadingLineComments10(verifyRaw));
|
|
6829
|
-
validateClineMcpConfig(verifyParsed, memoraone);
|
|
6830
|
-
return {
|
|
6831
|
-
hostId,
|
|
6832
|
-
activeConfigPath: configPath,
|
|
6833
|
-
outcome: existed ? "updated" : "created",
|
|
6834
|
-
backupPath
|
|
6835
|
-
};
|
|
6836
|
-
}
|
|
6837
|
-
async function setupClineMcpConfig(options) {
|
|
6838
|
-
const homeDir = options.homeDir ?? os9.homedir();
|
|
6839
|
-
const platform2 = options.platform ?? process.platform;
|
|
6840
|
-
const workspaceRoot = path29.resolve(options.repoRoot);
|
|
6841
|
-
const hosts = await detectClineHosts({
|
|
6842
|
-
homeDir,
|
|
6843
|
-
platform: platform2,
|
|
6844
|
-
explicitHostIds: options.explicitHostIds,
|
|
6845
|
-
explicitHostPaths: options.explicitHostPaths
|
|
6846
|
-
});
|
|
6847
|
-
if (hosts.length === 0) {
|
|
6848
|
-
const candidates = getKnownClineHostCandidates(homeDir, platform2).map((c) => c.installRoot);
|
|
6849
|
-
throw new ClineNoHostFoundError(candidates);
|
|
6850
|
-
}
|
|
6851
|
-
const memoraone = await buildClineMemoraoneServer({
|
|
6852
|
-
workspaceRoot,
|
|
6853
|
-
devMode: options.devMode,
|
|
6854
|
-
environment: options.environment,
|
|
6855
|
-
npmPackageChannel: options.npmPackageChannel,
|
|
6856
|
-
apiUrl: options.apiUrl,
|
|
6857
|
-
npxPathOverride: options.npxPathOverride,
|
|
6858
|
-
cliPathOverride: options.cliPathOverride
|
|
6859
|
-
});
|
|
6860
|
-
const hostResults = [];
|
|
6861
|
-
for (const host of hosts) {
|
|
6862
|
-
hostResults.push(
|
|
6863
|
-
await setupOneClineHost({
|
|
6864
|
-
configPath: host.configPath,
|
|
6865
|
-
hostId: host.hostId,
|
|
6866
|
-
memoraone,
|
|
6867
|
-
dryRun: options.dryRun
|
|
6868
|
-
})
|
|
6869
|
-
);
|
|
6857
|
+
if (existed && existing && canonicalValueMatches(existing, merged)) {
|
|
6858
|
+
return { activeConfigPath: configPath, outcome: "skipped", memoraone };
|
|
6870
6859
|
}
|
|
6871
|
-
|
|
6860
|
+
const outcome = existed ? "updated" : "created";
|
|
6861
|
+
if (options.dryRun) return { activeConfigPath: configPath, outcome, memoraone };
|
|
6862
|
+
const backupPath = existed ? await backupConfigFile4(configPath) : void 0;
|
|
6863
|
+
await writeClineMcpJsonAtomic(configPath, JSON.stringify(merged, null, 2) + "\n");
|
|
6864
|
+
validateClineMcpConfig(JSON.parse(await fs25.readFile(configPath, "utf8")), memoraone);
|
|
6865
|
+
return { activeConfigPath: configPath, outcome, backupPath, memoraone };
|
|
6872
6866
|
}
|
|
6873
6867
|
function logClineMcpCliSummary(info, dryRun, println = console.log) {
|
|
6874
6868
|
const prefix = dryRun ? "would be " : "";
|
|
6875
|
-
|
|
6876
|
-
|
|
6877
|
-
|
|
6878
|
-
|
|
6879
|
-
|
|
6880
|
-
|
|
6881
|
-
} else if (host.outcome === "updated") {
|
|
6882
|
-
println(
|
|
6883
|
-
`[setup-ide-files] Cline (${label}) MCP config ${prefix}updated: ${host.activeConfigPath}`
|
|
6884
|
-
);
|
|
6885
|
-
} else {
|
|
6886
|
-
println(
|
|
6887
|
-
`[setup-ide-files] Cline (${label}) MCP config unchanged: ${host.activeConfigPath}`
|
|
6888
|
-
);
|
|
6889
|
-
}
|
|
6890
|
-
if (host.backupPath) {
|
|
6891
|
-
println(`[setup-ide-files] Cline (${label}) MCP config backup: ${host.backupPath}`);
|
|
6892
|
-
}
|
|
6893
|
-
}
|
|
6894
|
-
if (info.npxPath) {
|
|
6895
|
-
println(`[setup-ide-files] Resolved npx: ${info.npxPath}`);
|
|
6869
|
+
if (info.outcome === "created") {
|
|
6870
|
+
println(`[setup-ide-files] Cline MCP config ${prefix}created: ${info.activeConfigPath}`);
|
|
6871
|
+
} else if (info.outcome === "updated") {
|
|
6872
|
+
println(`[setup-ide-files] Cline MCP config ${prefix}updated: ${info.activeConfigPath}`);
|
|
6873
|
+
} else {
|
|
6874
|
+
println(`[setup-ide-files] Cline MCP config unchanged: ${info.activeConfigPath}`);
|
|
6896
6875
|
}
|
|
6897
|
-
println(
|
|
6898
|
-
|
|
6899
|
-
);
|
|
6876
|
+
if (info.backupPath) println(`[setup-ide-files] Cline MCP config backup: ${info.backupPath}`);
|
|
6877
|
+
if (info.npxPath) println(`[setup-ide-files] Resolved npx: ${info.npxPath}`);
|
|
6878
|
+
println("[setup-ide-files] Fully quit Cline and reopen this repository for MCP changes to take effect.");
|
|
6900
6879
|
}
|
|
6901
|
-
var
|
|
6880
|
+
var import_node_crypto16, fs25, path31, ClineMcpJsonParseError;
|
|
6902
6881
|
var init_clineMcpConfig = __esm({
|
|
6903
6882
|
"src/clineMcpConfig.ts"() {
|
|
6883
|
+
import_node_crypto16 = require("crypto");
|
|
6904
6884
|
fs25 = __toESM(require("fs/promises"), 1);
|
|
6905
|
-
|
|
6906
|
-
path29 = __toESM(require("path"), 1);
|
|
6907
|
-
import_node_crypto15 = require("crypto");
|
|
6885
|
+
path31 = __toESM(require("path"), 1);
|
|
6908
6886
|
init_configUtils();
|
|
6909
6887
|
init_cursorGlobalMcpConfig();
|
|
6910
6888
|
init_initializeBinding();
|
|
6911
6889
|
init_jetbrainsMcpConfig();
|
|
6912
6890
|
init_packageExecutionMode();
|
|
6913
6891
|
init_memoraoneMcpOwnership();
|
|
6914
|
-
CLINE_HOST_IDS = ["vscode", "cursor", "vscodium"];
|
|
6915
|
-
CLINE_EXTENSION_RELATIVE = path29.join(
|
|
6916
|
-
"User",
|
|
6917
|
-
"globalStorage",
|
|
6918
|
-
"saoudrizwan.claude-dev",
|
|
6919
|
-
"settings",
|
|
6920
|
-
"cline_mcp_settings.json"
|
|
6921
|
-
);
|
|
6922
|
-
DARWIN_APP_SUPPORT_NAMES = {
|
|
6923
|
-
vscode: "Code",
|
|
6924
|
-
cursor: "Cursor",
|
|
6925
|
-
vscodium: "VSCodium"
|
|
6926
|
-
};
|
|
6927
6892
|
ClineMcpJsonParseError = class extends Error {
|
|
6928
6893
|
constructor(configPath) {
|
|
6929
6894
|
super(
|
|
6930
|
-
`[setup-ide-files] Invalid JSON in
|
|
6895
|
+
`[setup-ide-files] Invalid JSON in repository-local Cline MCP config (file preserved, not modified): ${configPath}. Fix or remove the file, then re-run setup-ide-files.`
|
|
6931
6896
|
);
|
|
6932
6897
|
this.name = "ClineMcpJsonParseError";
|
|
6933
6898
|
this.configPath = configPath;
|
|
6934
6899
|
}
|
|
6935
6900
|
};
|
|
6936
|
-
ClineNoHostFoundError = class extends Error {
|
|
6937
|
-
constructor(candidates) {
|
|
6938
|
-
super(
|
|
6939
|
-
"[setup-ide-files] No Cline host installation found. Install Cline in VS Code, Cursor, or VSCodium, or pass an explicit host path for tests/automation."
|
|
6940
|
-
);
|
|
6941
|
-
this.name = "ClineNoHostFoundError";
|
|
6942
|
-
this.candidates = candidates;
|
|
6943
|
-
}
|
|
6944
|
-
};
|
|
6945
6901
|
}
|
|
6946
6902
|
});
|
|
6947
6903
|
|
|
@@ -6958,7 +6914,7 @@ async function pathExists15(filePath) {
|
|
|
6958
6914
|
}
|
|
6959
6915
|
}
|
|
6960
6916
|
function getCopilotCliProjectMcpConfigPath(repoRoot) {
|
|
6961
|
-
return
|
|
6917
|
+
return path32.join(path32.resolve(repoRoot), ".github", "mcp.json");
|
|
6962
6918
|
}
|
|
6963
6919
|
function buildMemoraoneCopilotCliMcpServer(options) {
|
|
6964
6920
|
const environment = options.environment ?? (options.devMode ? "local" : "production");
|
|
@@ -6968,7 +6924,7 @@ function buildMemoraoneCopilotCliMcpServer(options) {
|
|
|
6968
6924
|
apiUrl: options.apiUrl ?? (environment === "local" ? DEV_API_URL : void 0)
|
|
6969
6925
|
}),
|
|
6970
6926
|
MEMORAONE_IDE_TYPE: "copilot-cli",
|
|
6971
|
-
[MEMORAONE_WORKSPACE_ROOT_ENV]:
|
|
6927
|
+
[MEMORAONE_WORKSPACE_ROOT_ENV]: path32.resolve(options.workspaceRoot)
|
|
6972
6928
|
};
|
|
6973
6929
|
if (environment === "local" || options.devMode) {
|
|
6974
6930
|
env2.MEMORAONE_DEV_MODE = "1";
|
|
@@ -6991,11 +6947,11 @@ function mergeCopilotCliMcpConfigObject(existing, memoraone) {
|
|
|
6991
6947
|
return { ...base, mcpServers: replaceMemoraoneOwnedInServerMap(mcpServers, memoraone) };
|
|
6992
6948
|
}
|
|
6993
6949
|
async function writeCopilotCliMcpJsonAtomic(filePath, content) {
|
|
6994
|
-
const dir =
|
|
6950
|
+
const dir = path32.dirname(filePath);
|
|
6995
6951
|
await fs26.mkdir(dir, { recursive: true });
|
|
6996
|
-
const tmpPath =
|
|
6952
|
+
const tmpPath = path32.join(
|
|
6997
6953
|
dir,
|
|
6998
|
-
`.${
|
|
6954
|
+
`.${path32.basename(filePath)}.${process.pid}.${(0, import_node_crypto17.randomBytes)(8).toString("hex")}.tmp`
|
|
6999
6955
|
);
|
|
7000
6956
|
try {
|
|
7001
6957
|
await fs26.writeFile(tmpPath, content, "utf8");
|
|
@@ -7073,7 +7029,7 @@ async function buildCopilotCliMemoraoneServer(options) {
|
|
|
7073
7029
|
}
|
|
7074
7030
|
async function setupCopilotCliMcpConfig(options) {
|
|
7075
7031
|
const projectPath = options.projectConfigPath ?? getCopilotCliProjectMcpConfigPath(options.repoRoot);
|
|
7076
|
-
const workspaceRoot =
|
|
7032
|
+
const workspaceRoot = path32.resolve(options.repoRoot);
|
|
7077
7033
|
const memoraone = await buildCopilotCliMemoraoneServer({
|
|
7078
7034
|
workspaceRoot,
|
|
7079
7035
|
devMode: options.devMode,
|
|
@@ -7138,12 +7094,12 @@ function logCopilotCliMcpCliSummary(info, dryRun, println = console.log) {
|
|
|
7138
7094
|
"[setup-ide-files] Fully quit Copilot CLI and reopen this repo for MCP changes to take effect."
|
|
7139
7095
|
);
|
|
7140
7096
|
}
|
|
7141
|
-
var fs26,
|
|
7097
|
+
var fs26, path32, import_node_crypto17, CopilotCliMcpJsonParseError;
|
|
7142
7098
|
var init_copilotCliMcpConfig = __esm({
|
|
7143
7099
|
"src/copilotCliMcpConfig.ts"() {
|
|
7144
7100
|
fs26 = __toESM(require("fs/promises"), 1);
|
|
7145
|
-
|
|
7146
|
-
|
|
7101
|
+
path32 = __toESM(require("path"), 1);
|
|
7102
|
+
import_node_crypto17 = require("crypto");
|
|
7147
7103
|
init_configUtils();
|
|
7148
7104
|
init_cursorGlobalMcpConfig();
|
|
7149
7105
|
init_initializeBinding();
|
|
@@ -7175,7 +7131,7 @@ async function pathExists16(filePath) {
|
|
|
7175
7131
|
}
|
|
7176
7132
|
}
|
|
7177
7133
|
function getAuggieProjectMcpConfigPath(repoRoot) {
|
|
7178
|
-
return
|
|
7134
|
+
return path33.join(path33.resolve(repoRoot), ".augment", "settings.json");
|
|
7179
7135
|
}
|
|
7180
7136
|
function buildMemoraoneAuggieMcpServer(options) {
|
|
7181
7137
|
const environment = options.environment ?? (options.devMode ? "local" : "production");
|
|
@@ -7185,7 +7141,7 @@ function buildMemoraoneAuggieMcpServer(options) {
|
|
|
7185
7141
|
apiUrl: options.apiUrl ?? (environment === "local" ? DEV_API_URL : void 0)
|
|
7186
7142
|
}),
|
|
7187
7143
|
MEMORAONE_IDE_TYPE: "auggie",
|
|
7188
|
-
[MEMORAONE_WORKSPACE_ROOT_ENV]:
|
|
7144
|
+
[MEMORAONE_WORKSPACE_ROOT_ENV]: path33.resolve(options.workspaceRoot)
|
|
7189
7145
|
};
|
|
7190
7146
|
if (environment === "local" || options.devMode) {
|
|
7191
7147
|
env2.MEMORAONE_DEV_MODE = "1";
|
|
@@ -7207,11 +7163,11 @@ function mergeAuggieMcpConfigObject(existing, memoraone) {
|
|
|
7207
7163
|
return { ...base, mcpServers: replaceMemoraoneOwnedInServerMap(mcpServers, memoraone) };
|
|
7208
7164
|
}
|
|
7209
7165
|
async function writeAuggieMcpJsonAtomic(filePath, content) {
|
|
7210
|
-
const dir =
|
|
7166
|
+
const dir = path33.dirname(filePath);
|
|
7211
7167
|
await fs27.mkdir(dir, { recursive: true });
|
|
7212
|
-
const tmpPath =
|
|
7168
|
+
const tmpPath = path33.join(
|
|
7213
7169
|
dir,
|
|
7214
|
-
`.${
|
|
7170
|
+
`.${path33.basename(filePath)}.${process.pid}.${(0, import_node_crypto18.randomBytes)(8).toString("hex")}.tmp`
|
|
7215
7171
|
);
|
|
7216
7172
|
try {
|
|
7217
7173
|
await fs27.writeFile(tmpPath, content, "utf8");
|
|
@@ -7289,7 +7245,7 @@ async function buildAuggieMemoraoneServer(options) {
|
|
|
7289
7245
|
}
|
|
7290
7246
|
async function setupAuggieMcpConfig(options) {
|
|
7291
7247
|
const projectPath = options.projectConfigPath ?? getAuggieProjectMcpConfigPath(options.repoRoot);
|
|
7292
|
-
const workspaceRoot =
|
|
7248
|
+
const workspaceRoot = path33.resolve(options.repoRoot);
|
|
7293
7249
|
const memoraone = await buildAuggieMemoraoneServer({
|
|
7294
7250
|
workspaceRoot,
|
|
7295
7251
|
devMode: options.devMode,
|
|
@@ -7354,12 +7310,12 @@ function logAuggieMcpCliSummary(info, dryRun, println = console.log) {
|
|
|
7354
7310
|
"[setup-ide-files] Fully quit Augment Code / Auggie and reopen this repo for MCP changes to take effect."
|
|
7355
7311
|
);
|
|
7356
7312
|
}
|
|
7357
|
-
var fs27,
|
|
7313
|
+
var fs27, path33, import_node_crypto18, AuggieMcpJsonParseError;
|
|
7358
7314
|
var init_auggieMcpConfig = __esm({
|
|
7359
7315
|
"src/auggieMcpConfig.ts"() {
|
|
7360
7316
|
fs27 = __toESM(require("fs/promises"), 1);
|
|
7361
|
-
|
|
7362
|
-
|
|
7317
|
+
path33 = __toESM(require("path"), 1);
|
|
7318
|
+
import_node_crypto18 = require("crypto");
|
|
7363
7319
|
init_configUtils();
|
|
7364
7320
|
init_cursorGlobalMcpConfig();
|
|
7365
7321
|
init_initializeBinding();
|
|
@@ -7391,7 +7347,7 @@ async function pathExists17(filePath) {
|
|
|
7391
7347
|
}
|
|
7392
7348
|
}
|
|
7393
7349
|
function getGeminiCliProjectMcpConfigPath(repoRoot) {
|
|
7394
|
-
return
|
|
7350
|
+
return path34.join(path34.resolve(repoRoot), ".gemini", "settings.json");
|
|
7395
7351
|
}
|
|
7396
7352
|
function buildMemoraoneGeminiCliMcpServer(options) {
|
|
7397
7353
|
const environment = options.environment ?? (options.devMode ? "local" : "production");
|
|
@@ -7401,7 +7357,7 @@ function buildMemoraoneGeminiCliMcpServer(options) {
|
|
|
7401
7357
|
apiUrl: options.apiUrl ?? (environment === "local" ? DEV_API_URL : void 0)
|
|
7402
7358
|
}),
|
|
7403
7359
|
MEMORAONE_IDE_TYPE: "gemini-cli",
|
|
7404
|
-
[MEMORAONE_WORKSPACE_ROOT_ENV]:
|
|
7360
|
+
[MEMORAONE_WORKSPACE_ROOT_ENV]: path34.resolve(options.workspaceRoot)
|
|
7405
7361
|
};
|
|
7406
7362
|
if (environment === "local" || options.devMode) {
|
|
7407
7363
|
env2.MEMORAONE_DEV_MODE = "1";
|
|
@@ -7423,11 +7379,11 @@ function mergeGeminiCliMcpConfigObject(existing, memoraone) {
|
|
|
7423
7379
|
return { ...base, mcpServers: replaceMemoraoneOwnedInServerMap(mcpServers, memoraone) };
|
|
7424
7380
|
}
|
|
7425
7381
|
async function writeGeminiCliMcpJsonAtomic(filePath, content) {
|
|
7426
|
-
const dir =
|
|
7382
|
+
const dir = path34.dirname(filePath);
|
|
7427
7383
|
await fs28.mkdir(dir, { recursive: true });
|
|
7428
|
-
const tmpPath =
|
|
7384
|
+
const tmpPath = path34.join(
|
|
7429
7385
|
dir,
|
|
7430
|
-
`.${
|
|
7386
|
+
`.${path34.basename(filePath)}.${process.pid}.${(0, import_node_crypto19.randomBytes)(8).toString("hex")}.tmp`
|
|
7431
7387
|
);
|
|
7432
7388
|
try {
|
|
7433
7389
|
await fs28.writeFile(tmpPath, content, "utf8");
|
|
@@ -7505,7 +7461,7 @@ async function buildGeminiCliMemoraoneServer(options) {
|
|
|
7505
7461
|
}
|
|
7506
7462
|
async function setupGeminiCliMcpConfig(options) {
|
|
7507
7463
|
const projectPath = options.projectConfigPath ?? getGeminiCliProjectMcpConfigPath(options.repoRoot);
|
|
7508
|
-
const workspaceRoot =
|
|
7464
|
+
const workspaceRoot = path34.resolve(options.repoRoot);
|
|
7509
7465
|
const memoraone = await buildGeminiCliMemoraoneServer({
|
|
7510
7466
|
workspaceRoot,
|
|
7511
7467
|
devMode: options.devMode,
|
|
@@ -7570,12 +7526,12 @@ function logGeminiCliMcpCliSummary(info, dryRun, println = console.log) {
|
|
|
7570
7526
|
"[setup-ide-files] Fully quit Gemini CLI and reopen this repo for MCP changes to take effect."
|
|
7571
7527
|
);
|
|
7572
7528
|
}
|
|
7573
|
-
var fs28,
|
|
7529
|
+
var fs28, path34, import_node_crypto19, GeminiCliMcpJsonParseError;
|
|
7574
7530
|
var init_geminiCliMcpConfig = __esm({
|
|
7575
7531
|
"src/geminiCliMcpConfig.ts"() {
|
|
7576
7532
|
fs28 = __toESM(require("fs/promises"), 1);
|
|
7577
|
-
|
|
7578
|
-
|
|
7533
|
+
path34 = __toESM(require("path"), 1);
|
|
7534
|
+
import_node_crypto19 = require("crypto");
|
|
7579
7535
|
init_configUtils();
|
|
7580
7536
|
init_cursorGlobalMcpConfig();
|
|
7581
7537
|
init_initializeBinding();
|
|
@@ -7607,14 +7563,14 @@ async function pathExists18(filePath) {
|
|
|
7607
7563
|
}
|
|
7608
7564
|
}
|
|
7609
7565
|
function getAntigravityUnifiedMcpConfigPath(homeDir) {
|
|
7610
|
-
return
|
|
7566
|
+
return path35.join(homeDir, ".gemini", "config", "mcp_config.json");
|
|
7611
7567
|
}
|
|
7612
7568
|
function getAntigravityLegacyMcpConfigPath(homeDir) {
|
|
7613
|
-
return
|
|
7569
|
+
return path35.join(homeDir, ".gemini", "antigravity", "mcp_config.json");
|
|
7614
7570
|
}
|
|
7615
7571
|
function getAntigravityGlobalMcpConfigPath(homeDir) {
|
|
7616
7572
|
const unified = getAntigravityUnifiedMcpConfigPath(homeDir);
|
|
7617
|
-
const migratedMarker =
|
|
7573
|
+
const migratedMarker = path35.join(homeDir, ".gemini", "config", ".migrated");
|
|
7618
7574
|
if (fsSync.existsSync(migratedMarker) || fsSync.existsSync(unified)) {
|
|
7619
7575
|
return unified;
|
|
7620
7576
|
}
|
|
@@ -7628,7 +7584,7 @@ function buildMemoraoneAntigravityMcpServer(options) {
|
|
|
7628
7584
|
apiUrl: options.apiUrl ?? (environment === "local" ? DEV_API_URL : void 0)
|
|
7629
7585
|
}),
|
|
7630
7586
|
MEMORAONE_IDE_TYPE: "antigravity",
|
|
7631
|
-
[MEMORAONE_WORKSPACE_ROOT_ENV]:
|
|
7587
|
+
[MEMORAONE_WORKSPACE_ROOT_ENV]: path35.resolve(options.workspaceRoot)
|
|
7632
7588
|
};
|
|
7633
7589
|
if (environment === "local" || options.devMode) {
|
|
7634
7590
|
env2.MEMORAONE_DEV_MODE = "1";
|
|
@@ -7644,10 +7600,10 @@ function buildMemoraoneAntigravityMcpServer(options) {
|
|
|
7644
7600
|
env: env2
|
|
7645
7601
|
};
|
|
7646
7602
|
}
|
|
7647
|
-
function mergeAntigravityMcpConfigObject(existing, memoraone) {
|
|
7603
|
+
function mergeAntigravityMcpConfigObject(existing, memoraone, ownership) {
|
|
7648
7604
|
const base = existing && typeof existing === "object" ? { ...existing } : { mcpServers: {} };
|
|
7649
7605
|
const mcpServers = typeof base.mcpServers === "object" && base.mcpServers !== null && !Array.isArray(base.mcpServers) ? { ...base.mcpServers } : {};
|
|
7650
|
-
return { ...base, mcpServers: replaceMemoraoneOwnedInServerMap(mcpServers, memoraone) };
|
|
7606
|
+
return { ...base, mcpServers: ownership ? replaceMemoraoneRepositoryBindingInServerMap(mcpServers, memoraone, ownership) : replaceMemoraoneOwnedInServerMap(mcpServers, memoraone) };
|
|
7651
7607
|
}
|
|
7652
7608
|
function stripMemoraoneFromAntigravityConfigObject(existing) {
|
|
7653
7609
|
const base = { ...existing };
|
|
@@ -7663,11 +7619,11 @@ function stripMemoraoneFromAntigravityConfigObject(existing) {
|
|
|
7663
7619
|
return { next: { ...base, mcpServers }, removed: true };
|
|
7664
7620
|
}
|
|
7665
7621
|
async function writeAntigravityMcpJsonAtomic(filePath, content) {
|
|
7666
|
-
const dir =
|
|
7622
|
+
const dir = path35.dirname(filePath);
|
|
7667
7623
|
await fs29.mkdir(dir, { recursive: true });
|
|
7668
|
-
const tmpPath =
|
|
7624
|
+
const tmpPath = path35.join(
|
|
7669
7625
|
dir,
|
|
7670
|
-
`.${
|
|
7626
|
+
`.${path35.basename(filePath)}.${process.pid}.${(0, import_node_crypto20.randomBytes)(8).toString("hex")}.tmp`
|
|
7671
7627
|
);
|
|
7672
7628
|
try {
|
|
7673
7629
|
await fs29.writeFile(tmpPath, content, "utf8");
|
|
@@ -7683,7 +7639,7 @@ async function writeAntigravityMcpJsonAtomic(filePath, content) {
|
|
|
7683
7639
|
function memoraoneServerMatches17(server, expected) {
|
|
7684
7640
|
return canonicalValueMatches(server, expected);
|
|
7685
7641
|
}
|
|
7686
|
-
function validateAntigravityMcpConfig(parsed2, expected) {
|
|
7642
|
+
function validateAntigravityMcpConfig(parsed2, expected, serverName = CANONICAL_MEMORAONE_MCP_SERVER_NAME) {
|
|
7687
7643
|
if (!parsed2 || typeof parsed2 !== "object") {
|
|
7688
7644
|
throw new Error("[setup-ide-files] Antigravity MCP config must be a JSON object.");
|
|
7689
7645
|
}
|
|
@@ -7691,7 +7647,8 @@ function validateAntigravityMcpConfig(parsed2, expected) {
|
|
|
7691
7647
|
if (!mcpServers || typeof mcpServers !== "object" || Array.isArray(mcpServers)) {
|
|
7692
7648
|
throw new Error("[setup-ide-files] Antigravity MCP config missing mcpServers object.");
|
|
7693
7649
|
}
|
|
7694
|
-
const
|
|
7650
|
+
const serverMap = mcpServers;
|
|
7651
|
+
const memoraone = serverMap[serverName] ?? Object.values(serverMap).find((entry) => memoraoneServerMatches17(entry, expected));
|
|
7695
7652
|
if (!memoraoneServerMatches17(memoraone, expected)) {
|
|
7696
7653
|
throw new Error(
|
|
7697
7654
|
"[setup-ide-files] Antigravity MCP config mcpServers.memoraone is missing or invalid."
|
|
@@ -7750,12 +7707,12 @@ async function buildAntigravityMemoraoneServer(options) {
|
|
|
7750
7707
|
});
|
|
7751
7708
|
}
|
|
7752
7709
|
async function setupAntigravityMcpConfig(options) {
|
|
7753
|
-
const homeDir = options.homeDir ??
|
|
7710
|
+
const homeDir = options.homeDir ?? os9.homedir();
|
|
7754
7711
|
const activePath = options.globalConfigPath ?? getAntigravityGlobalMcpConfigPath(homeDir);
|
|
7755
7712
|
const legacyPath = options.legacyConfigPath ?? getAntigravityLegacyMcpConfigPath(homeDir);
|
|
7756
7713
|
const unifiedPath = getAntigravityUnifiedMcpConfigPath(homeDir);
|
|
7757
|
-
const writingUnified =
|
|
7758
|
-
const workspaceRoot =
|
|
7714
|
+
const writingUnified = path35.resolve(activePath) === path35.resolve(unifiedPath) && path35.resolve(activePath) !== path35.resolve(legacyPath);
|
|
7715
|
+
const workspaceRoot = path35.resolve(options.repoRoot);
|
|
7759
7716
|
const memoraone = await buildAntigravityMemoraoneServer({
|
|
7760
7717
|
workspaceRoot,
|
|
7761
7718
|
devMode: options.devMode,
|
|
@@ -7787,13 +7744,17 @@ async function setupAntigravityMcpConfig(options) {
|
|
|
7787
7744
|
legacyMalformed = true;
|
|
7788
7745
|
}
|
|
7789
7746
|
}
|
|
7790
|
-
const merged = mergeAntigravityMcpConfigObject(activeExisting, memoraone);
|
|
7747
|
+
const merged = mergeAntigravityMcpConfigObject(activeExisting, memoraone, options.ownership);
|
|
7791
7748
|
const body = JSON.stringify(merged, null, 2) + "\n";
|
|
7792
|
-
const
|
|
7793
|
-
|
|
7749
|
+
const activeAlreadyCorrect = Boolean(
|
|
7750
|
+
activeExisted && activeExisting && canonicalValueMatches(activeExisting, merged)
|
|
7751
|
+
);
|
|
7794
7752
|
let legacyNeedsCleanup = false;
|
|
7795
7753
|
if (legacyExisted && !legacyMalformed && legacyExisting) {
|
|
7796
|
-
legacyNeedsCleanup =
|
|
7754
|
+
legacyNeedsCleanup = options.ownership && legacyExisting.mcpServers && typeof legacyExisting.mcpServers === "object" && !Array.isArray(legacyExisting.mcpServers) ? stripMemoraoneRepositoryBindingFromServerMap(
|
|
7755
|
+
legacyExisting.mcpServers,
|
|
7756
|
+
options.ownership
|
|
7757
|
+
).removedKeys.length > 0 : extractMemoraone2(legacyExisting) !== void 0;
|
|
7797
7758
|
}
|
|
7798
7759
|
if (!writingUnified) {
|
|
7799
7760
|
if (activeAlreadyCorrect) {
|
|
@@ -7817,7 +7778,7 @@ async function setupAntigravityMcpConfig(options) {
|
|
|
7817
7778
|
await writeAntigravityMcpJsonAtomic(activePath, body);
|
|
7818
7779
|
const verifyRaw = await fs29.readFile(activePath, "utf8");
|
|
7819
7780
|
const verifyParsed = JSON.parse(stripLeadingLineComments14(verifyRaw));
|
|
7820
|
-
validateAntigravityMcpConfig(verifyParsed, memoraone);
|
|
7781
|
+
validateAntigravityMcpConfig(verifyParsed, memoraone, options.ownership ? memoraoneServerNameForRepositoryBinding(options.ownership.repositoryBindingId) : CANONICAL_MEMORAONE_MCP_SERVER_NAME);
|
|
7821
7782
|
return {
|
|
7822
7783
|
outcome: activeExisted ? "updated" : "created",
|
|
7823
7784
|
memoraone,
|
|
@@ -7856,7 +7817,7 @@ async function setupAntigravityMcpConfig(options) {
|
|
|
7856
7817
|
await writeAntigravityMcpJsonAtomic(activePath, body);
|
|
7857
7818
|
const verifyRaw = await fs29.readFile(activePath, "utf8");
|
|
7858
7819
|
const verifyParsed = JSON.parse(stripLeadingLineComments14(verifyRaw));
|
|
7859
|
-
validateAntigravityMcpConfig(verifyParsed, memoraone);
|
|
7820
|
+
validateAntigravityMcpConfig(verifyParsed, memoraone, options.ownership ? memoraoneServerNameForRepositoryBinding(options.ownership.repositoryBindingId) : CANONICAL_MEMORAONE_MCP_SERVER_NAME);
|
|
7860
7821
|
}
|
|
7861
7822
|
let legacyCleanup = "absent";
|
|
7862
7823
|
let warning;
|
|
@@ -7866,7 +7827,11 @@ async function setupAntigravityMcpConfig(options) {
|
|
|
7866
7827
|
warning = `[setup-ide-files] Legacy Antigravity MCP config has invalid JSON and was left unchanged: ${legacyPath}. Unified Antigravity config was written; fix or remove the legacy file to avoid ambiguity.`;
|
|
7867
7828
|
} else if (legacyNeedsCleanup && legacyExisting) {
|
|
7868
7829
|
try {
|
|
7869
|
-
const
|
|
7830
|
+
const scoped = options.ownership && legacyExisting.mcpServers && typeof legacyExisting.mcpServers === "object" && !Array.isArray(legacyExisting.mcpServers) ? stripMemoraoneRepositoryBindingFromServerMap(
|
|
7831
|
+
legacyExisting.mcpServers,
|
|
7832
|
+
options.ownership
|
|
7833
|
+
) : null;
|
|
7834
|
+
const { next, removed } = scoped ? { next: { ...legacyExisting, mcpServers: scoped.next }, removed: scoped.removedKeys.length > 0 } : stripMemoraoneFromAntigravityConfigObject(legacyExisting);
|
|
7870
7835
|
if (removed) {
|
|
7871
7836
|
const legacyBody = JSON.stringify(next, null, 2) + "\n";
|
|
7872
7837
|
await writeAntigravityMcpJsonAtomic(legacyPath, legacyBody);
|
|
@@ -7932,14 +7897,14 @@ function logAntigravityMcpCliSummary(info, dryRun, println = console.log) {
|
|
|
7932
7897
|
"[setup-ide-files] Fully quit Antigravity and reopen for MCP changes to take effect."
|
|
7933
7898
|
);
|
|
7934
7899
|
}
|
|
7935
|
-
var fsSync, fs29,
|
|
7900
|
+
var fsSync, fs29, os9, path35, import_node_crypto20, AntigravityMcpJsonParseError;
|
|
7936
7901
|
var init_antigravityMcpConfig = __esm({
|
|
7937
7902
|
"src/antigravityMcpConfig.ts"() {
|
|
7938
7903
|
fsSync = __toESM(require("fs"), 1);
|
|
7939
7904
|
fs29 = __toESM(require("fs/promises"), 1);
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
|
|
7905
|
+
os9 = __toESM(require("os"), 1);
|
|
7906
|
+
path35 = __toESM(require("path"), 1);
|
|
7907
|
+
import_node_crypto20 = require("crypto");
|
|
7943
7908
|
init_configUtils();
|
|
7944
7909
|
init_cursorGlobalMcpConfig();
|
|
7945
7910
|
init_initializeBinding();
|
|
@@ -7971,7 +7936,7 @@ function isPlainObject2(value) {
|
|
|
7971
7936
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7972
7937
|
}
|
|
7973
7938
|
function getGooseGlobalMcpConfigPath(homeDir) {
|
|
7974
|
-
return
|
|
7939
|
+
return path36.join(homeDir, ".config", "goose", "config.yaml");
|
|
7975
7940
|
}
|
|
7976
7941
|
function isMemoraoneOwnedGooseExtension(key, entry) {
|
|
7977
7942
|
if (isMemoraoneOwnedServerName(key)) return true;
|
|
@@ -8019,6 +7984,34 @@ function replaceMemoraoneOwnedInGooseExtensions(extensions, canonical) {
|
|
|
8019
7984
|
next[CANONICAL_MEMORAONE_MCP_SERVER_NAME] = canonical;
|
|
8020
7985
|
return next;
|
|
8021
7986
|
}
|
|
7987
|
+
function replaceMemoraoneRepositoryBindingInGooseExtensions(extensions, canonical, ownership) {
|
|
7988
|
+
const generatedTargetKey = memoraoneServerNameForRepositoryBinding(
|
|
7989
|
+
ownership.repositoryBindingId
|
|
7990
|
+
);
|
|
7991
|
+
const targetRoot = path36.resolve(ownership.workspaceRoot);
|
|
7992
|
+
const matchingRootKeys = Object.entries(extensions).filter(([key, value]) => {
|
|
7993
|
+
const envs = isPlainObject2(value) && isPlainObject2(value.envs) ? value.envs : void 0;
|
|
7994
|
+
return key.startsWith("memoraone-") && typeof envs?.MEMORAONE_WORKSPACE_ROOT === "string" && path36.resolve(envs.MEMORAONE_WORKSPACE_ROOT) === targetRoot;
|
|
7995
|
+
}).map(([key]) => key).sort();
|
|
7996
|
+
const targetKey = matchingRootKeys.includes(generatedTargetKey) ? generatedTargetKey : matchingRootKeys[0] ?? generatedTargetKey;
|
|
7997
|
+
const staleKeys = /* @__PURE__ */ new Set([
|
|
7998
|
+
generatedTargetKey,
|
|
7999
|
+
...(ownership.replacedRepositoryBindingIds ?? []).map(
|
|
8000
|
+
memoraoneServerNameForRepositoryBinding
|
|
8001
|
+
)
|
|
8002
|
+
]);
|
|
8003
|
+
staleKeys.delete(targetKey);
|
|
8004
|
+
const next = {};
|
|
8005
|
+
for (const [key, value] of Object.entries(extensions)) {
|
|
8006
|
+
const envs = isPlainObject2(value) && isPlainObject2(value.envs) ? value.envs : void 0;
|
|
8007
|
+
const legacyForRoot = isMemoraoneOwnedServerName(key) && !key.startsWith("memoraone-") && typeof envs?.MEMORAONE_WORKSPACE_ROOT === "string" && path36.resolve(envs.MEMORAONE_WORKSPACE_ROOT) === targetRoot;
|
|
8008
|
+
if (!staleKeys.has(key) && !matchingRootKeys.includes(key) && !legacyForRoot) {
|
|
8009
|
+
next[key] = value;
|
|
8010
|
+
}
|
|
8011
|
+
}
|
|
8012
|
+
next[targetKey] = canonical;
|
|
8013
|
+
return next;
|
|
8014
|
+
}
|
|
8022
8015
|
function buildMemoraoneGooseMcpServer(options) {
|
|
8023
8016
|
const environment = options.environment ?? (options.devMode ? "local" : "production");
|
|
8024
8017
|
const envs = {
|
|
@@ -8027,7 +8020,7 @@ function buildMemoraoneGooseMcpServer(options) {
|
|
|
8027
8020
|
apiUrl: options.apiUrl ?? (environment === "local" ? DEV_API_URL : void 0)
|
|
8028
8021
|
}),
|
|
8029
8022
|
MEMORAONE_IDE_TYPE: "goose",
|
|
8030
|
-
[MEMORAONE_WORKSPACE_ROOT_ENV]:
|
|
8023
|
+
[MEMORAONE_WORKSPACE_ROOT_ENV]: path36.resolve(options.workspaceRoot)
|
|
8031
8024
|
};
|
|
8032
8025
|
if (environment === "local" || options.devMode) {
|
|
8033
8026
|
envs.MEMORAONE_DEV_MODE = "1";
|
|
@@ -8047,20 +8040,20 @@ function buildMemoraoneGooseMcpServer(options) {
|
|
|
8047
8040
|
timeout: 300
|
|
8048
8041
|
};
|
|
8049
8042
|
}
|
|
8050
|
-
function mergeGooseMcpConfigObject(existing, memoraone) {
|
|
8043
|
+
function mergeGooseMcpConfigObject(existing, memoraone, ownership) {
|
|
8051
8044
|
const base = existing && isPlainObject2(existing) ? { ...existing } : { extensions: {} };
|
|
8052
8045
|
const extensions = isPlainObject2(base.extensions) ? { ...base.extensions } : {};
|
|
8053
8046
|
return {
|
|
8054
8047
|
...base,
|
|
8055
|
-
extensions: replaceMemoraoneOwnedInGooseExtensions(extensions, memoraone)
|
|
8048
|
+
extensions: ownership ? replaceMemoraoneRepositoryBindingInGooseExtensions(extensions, memoraone, ownership) : replaceMemoraoneOwnedInGooseExtensions(extensions, memoraone)
|
|
8056
8049
|
};
|
|
8057
8050
|
}
|
|
8058
8051
|
async function writeGooseMcpYamlAtomic(filePath, content) {
|
|
8059
|
-
const dir =
|
|
8052
|
+
const dir = path36.dirname(filePath);
|
|
8060
8053
|
await fs30.mkdir(dir, { recursive: true });
|
|
8061
|
-
const tmpPath =
|
|
8054
|
+
const tmpPath = path36.join(
|
|
8062
8055
|
dir,
|
|
8063
|
-
`.${
|
|
8056
|
+
`.${path36.basename(filePath)}.${process.pid}.${(0, import_node_crypto21.randomBytes)(8).toString("hex")}.tmp`
|
|
8064
8057
|
);
|
|
8065
8058
|
try {
|
|
8066
8059
|
await fs30.writeFile(tmpPath, content, "utf8");
|
|
@@ -8076,14 +8069,14 @@ async function writeGooseMcpYamlAtomic(filePath, content) {
|
|
|
8076
8069
|
function memoraoneExtensionMatches(extension, expected) {
|
|
8077
8070
|
return canonicalValueMatches(extension, expected);
|
|
8078
8071
|
}
|
|
8079
|
-
function validateGooseMcpConfig(parsed2, expected) {
|
|
8072
|
+
function validateGooseMcpConfig(parsed2, expected, serverName = CANONICAL_MEMORAONE_MCP_SERVER_NAME) {
|
|
8080
8073
|
if (!isPlainObject2(parsed2)) {
|
|
8081
8074
|
throw new Error("[setup-ide-files] Goose MCP config must be a YAML object.");
|
|
8082
8075
|
}
|
|
8083
8076
|
if (!isPlainObject2(parsed2.extensions)) {
|
|
8084
8077
|
throw new Error("[setup-ide-files] Goose MCP config missing extensions object.");
|
|
8085
8078
|
}
|
|
8086
|
-
const memoraone = parsed2.extensions.
|
|
8079
|
+
const memoraone = parsed2.extensions[serverName] ?? Object.values(parsed2.extensions).find((entry) => memoraoneExtensionMatches(entry, expected));
|
|
8087
8080
|
if (!memoraoneExtensionMatches(memoraone, expected)) {
|
|
8088
8081
|
throw new Error(
|
|
8089
8082
|
"[setup-ide-files] Goose MCP config extensions.memoraone is missing or invalid."
|
|
@@ -8147,9 +8140,9 @@ async function buildGooseMemoraoneServer(options) {
|
|
|
8147
8140
|
});
|
|
8148
8141
|
}
|
|
8149
8142
|
async function setupGooseMcpConfig(options) {
|
|
8150
|
-
const homeDir = options.homeDir ??
|
|
8143
|
+
const homeDir = options.homeDir ?? os10.homedir();
|
|
8151
8144
|
const activePath = options.globalConfigPath ?? getGooseGlobalMcpConfigPath(homeDir);
|
|
8152
|
-
const workspaceRoot =
|
|
8145
|
+
const workspaceRoot = path36.resolve(options.repoRoot);
|
|
8153
8146
|
const memoraone = await buildGooseMemoraoneServer({
|
|
8154
8147
|
workspaceRoot,
|
|
8155
8148
|
devMode: options.devMode,
|
|
@@ -8172,10 +8165,10 @@ async function setupGooseMcpConfig(options) {
|
|
|
8172
8165
|
throw new GooseMcpYamlParseError(activePath);
|
|
8173
8166
|
}
|
|
8174
8167
|
}
|
|
8175
|
-
const merged = mergeGooseMcpConfigObject(existing, memoraone);
|
|
8168
|
+
const merged = mergeGooseMcpConfigObject(existing, memoraone, options.ownership);
|
|
8176
8169
|
const body = formatGooseYaml(merged);
|
|
8177
8170
|
if (exists && existing) {
|
|
8178
|
-
const preview = mergeGooseMcpConfigObject(existing, memoraone);
|
|
8171
|
+
const preview = mergeGooseMcpConfigObject(existing, memoraone, options.ownership);
|
|
8179
8172
|
if (formatGooseYaml(preview) === formatGooseYaml(existing)) {
|
|
8180
8173
|
return { outcome: "skipped", memoraone, activeConfigPath: activePath };
|
|
8181
8174
|
}
|
|
@@ -8195,7 +8188,7 @@ async function setupGooseMcpConfig(options) {
|
|
|
8195
8188
|
} catch {
|
|
8196
8189
|
throw new GooseMcpYamlParseError(activePath);
|
|
8197
8190
|
}
|
|
8198
|
-
validateGooseMcpConfig(verifyParsed, memoraone);
|
|
8191
|
+
validateGooseMcpConfig(verifyParsed, memoraone, options.ownership ? memoraoneServerNameForRepositoryBinding(options.ownership.repositoryBindingId) : CANONICAL_MEMORAONE_MCP_SERVER_NAME);
|
|
8199
8192
|
return {
|
|
8200
8193
|
outcome: exists ? "updated" : "created",
|
|
8201
8194
|
memoraone,
|
|
@@ -8223,13 +8216,13 @@ function logGooseMcpCliSummary(info, dryRun, println = console.log) {
|
|
|
8223
8216
|
"[setup-ide-files] Fully quit Goose and reopen for MCP changes to take effect."
|
|
8224
8217
|
);
|
|
8225
8218
|
}
|
|
8226
|
-
var fs30,
|
|
8219
|
+
var fs30, os10, path36, import_node_crypto21, import_yaml2, GooseMcpYamlParseError, MEMORAONE_PACKAGE_SPEC_RE2;
|
|
8227
8220
|
var init_gooseMcpConfig = __esm({
|
|
8228
8221
|
"src/gooseMcpConfig.ts"() {
|
|
8229
8222
|
fs30 = __toESM(require("fs/promises"), 1);
|
|
8230
|
-
|
|
8231
|
-
|
|
8232
|
-
|
|
8223
|
+
os10 = __toESM(require("os"), 1);
|
|
8224
|
+
path36 = __toESM(require("path"), 1);
|
|
8225
|
+
import_node_crypto21 = require("crypto");
|
|
8233
8226
|
import_yaml2 = require("yaml");
|
|
8234
8227
|
init_configUtils();
|
|
8235
8228
|
init_cursorGlobalMcpConfig();
|
|
@@ -8263,7 +8256,7 @@ async function pathExists20(filePath) {
|
|
|
8263
8256
|
}
|
|
8264
8257
|
}
|
|
8265
8258
|
function getJunieProjectMcpConfigPath(repoRoot) {
|
|
8266
|
-
return
|
|
8259
|
+
return path37.join(path37.resolve(repoRoot), ".junie", "mcp", "mcp.json");
|
|
8267
8260
|
}
|
|
8268
8261
|
function buildMemoraoneJunieMcpServer(options) {
|
|
8269
8262
|
const environment = options.environment ?? (options.devMode ? "local" : "production");
|
|
@@ -8273,7 +8266,7 @@ function buildMemoraoneJunieMcpServer(options) {
|
|
|
8273
8266
|
apiUrl: options.apiUrl ?? (environment === "local" ? DEV_API_URL : void 0)
|
|
8274
8267
|
}),
|
|
8275
8268
|
MEMORAONE_IDE_TYPE: "junie",
|
|
8276
|
-
[MEMORAONE_WORKSPACE_ROOT_ENV]:
|
|
8269
|
+
[MEMORAONE_WORKSPACE_ROOT_ENV]: path37.resolve(options.workspaceRoot)
|
|
8277
8270
|
};
|
|
8278
8271
|
if (environment === "local" || options.devMode) {
|
|
8279
8272
|
env2.MEMORAONE_DEV_MODE = "1";
|
|
@@ -8295,11 +8288,11 @@ function mergeJunieMcpConfigObject(existing, memoraone) {
|
|
|
8295
8288
|
return { ...base, mcpServers: replaceMemoraoneOwnedInServerMap(mcpServers, memoraone) };
|
|
8296
8289
|
}
|
|
8297
8290
|
async function writeJunieMcpJsonAtomic(filePath, content) {
|
|
8298
|
-
const dir =
|
|
8291
|
+
const dir = path37.dirname(filePath);
|
|
8299
8292
|
await fs31.mkdir(dir, { recursive: true });
|
|
8300
|
-
const tmpPath =
|
|
8293
|
+
const tmpPath = path37.join(
|
|
8301
8294
|
dir,
|
|
8302
|
-
`.${
|
|
8295
|
+
`.${path37.basename(filePath)}.${process.pid}.${(0, import_node_crypto22.randomBytes)(8).toString("hex")}.tmp`
|
|
8303
8296
|
);
|
|
8304
8297
|
try {
|
|
8305
8298
|
await fs31.writeFile(tmpPath, content, "utf8");
|
|
@@ -8377,7 +8370,7 @@ async function buildJunieMemoraoneServer(options) {
|
|
|
8377
8370
|
}
|
|
8378
8371
|
async function setupJunieMcpConfig(options) {
|
|
8379
8372
|
const projectPath = options.projectConfigPath ?? getJunieProjectMcpConfigPath(options.repoRoot);
|
|
8380
|
-
const workspaceRoot =
|
|
8373
|
+
const workspaceRoot = path37.resolve(options.repoRoot);
|
|
8381
8374
|
const memoraone = await buildJunieMemoraoneServer({
|
|
8382
8375
|
workspaceRoot,
|
|
8383
8376
|
devMode: options.devMode,
|
|
@@ -8442,12 +8435,12 @@ function logJunieMcpCliSummary(info, dryRun, println = console.log) {
|
|
|
8442
8435
|
"[setup-ide-files] Fully quit JetBrains IDE / Junie and reopen this repo for MCP changes to take effect."
|
|
8443
8436
|
);
|
|
8444
8437
|
}
|
|
8445
|
-
var fs31,
|
|
8438
|
+
var fs31, path37, import_node_crypto22, JunieMcpJsonParseError;
|
|
8446
8439
|
var init_junieMcpConfig = __esm({
|
|
8447
8440
|
"src/junieMcpConfig.ts"() {
|
|
8448
8441
|
fs31 = __toESM(require("fs/promises"), 1);
|
|
8449
|
-
|
|
8450
|
-
|
|
8442
|
+
path37 = __toESM(require("path"), 1);
|
|
8443
|
+
import_node_crypto22 = require("crypto");
|
|
8451
8444
|
init_configUtils();
|
|
8452
8445
|
init_cursorGlobalMcpConfig();
|
|
8453
8446
|
init_initializeBinding();
|
|
@@ -8479,7 +8472,7 @@ async function pathExists21(filePath) {
|
|
|
8479
8472
|
}
|
|
8480
8473
|
}
|
|
8481
8474
|
function getXcodeGlobalMcpConfigPath(homeDir) {
|
|
8482
|
-
return
|
|
8475
|
+
return path38.join(homeDir, ".config", "github-copilot", "xcode", "mcp.json");
|
|
8483
8476
|
}
|
|
8484
8477
|
function buildMemoraoneXcodeMcpServer(options) {
|
|
8485
8478
|
const environment = options.environment ?? (options.devMode ? "local" : "production");
|
|
@@ -8489,7 +8482,7 @@ function buildMemoraoneXcodeMcpServer(options) {
|
|
|
8489
8482
|
apiUrl: options.apiUrl ?? (environment === "local" ? DEV_API_URL : void 0)
|
|
8490
8483
|
}),
|
|
8491
8484
|
MEMORAONE_IDE_TYPE: "xcode",
|
|
8492
|
-
[MEMORAONE_WORKSPACE_ROOT_ENV]:
|
|
8485
|
+
[MEMORAONE_WORKSPACE_ROOT_ENV]: path38.resolve(options.workspaceRoot)
|
|
8493
8486
|
};
|
|
8494
8487
|
if (environment === "local" || options.devMode) {
|
|
8495
8488
|
env2.MEMORAONE_DEV_MODE = "1";
|
|
@@ -8506,17 +8499,17 @@ function buildMemoraoneXcodeMcpServer(options) {
|
|
|
8506
8499
|
env: env2
|
|
8507
8500
|
};
|
|
8508
8501
|
}
|
|
8509
|
-
function mergeXcodeMcpConfigObject(existing, memoraone) {
|
|
8502
|
+
function mergeXcodeMcpConfigObject(existing, memoraone, ownership) {
|
|
8510
8503
|
const base = existing && typeof existing === "object" ? { ...existing } : { servers: {} };
|
|
8511
8504
|
const servers = typeof base.servers === "object" && base.servers !== null && !Array.isArray(base.servers) ? { ...base.servers } : {};
|
|
8512
|
-
return { ...base, servers: replaceMemoraoneOwnedInServerMap(servers, memoraone) };
|
|
8505
|
+
return { ...base, servers: ownership ? replaceMemoraoneRepositoryBindingInServerMap(servers, memoraone, ownership) : replaceMemoraoneOwnedInServerMap(servers, memoraone) };
|
|
8513
8506
|
}
|
|
8514
8507
|
async function writeXcodeMcpJsonAtomic(filePath, content) {
|
|
8515
|
-
const dir =
|
|
8508
|
+
const dir = path38.dirname(filePath);
|
|
8516
8509
|
await fs32.mkdir(dir, { recursive: true });
|
|
8517
|
-
const tmpPath =
|
|
8510
|
+
const tmpPath = path38.join(
|
|
8518
8511
|
dir,
|
|
8519
|
-
`.${
|
|
8512
|
+
`.${path38.basename(filePath)}.${process.pid}.${(0, import_node_crypto23.randomBytes)(8).toString("hex")}.tmp`
|
|
8520
8513
|
);
|
|
8521
8514
|
try {
|
|
8522
8515
|
await fs32.writeFile(tmpPath, content, "utf8");
|
|
@@ -8532,7 +8525,7 @@ async function writeXcodeMcpJsonAtomic(filePath, content) {
|
|
|
8532
8525
|
function memoraoneServerMatches19(server, expected) {
|
|
8533
8526
|
return canonicalValueMatches(server, expected);
|
|
8534
8527
|
}
|
|
8535
|
-
function validateXcodeMcpConfig(parsed2, expected) {
|
|
8528
|
+
function validateXcodeMcpConfig(parsed2, expected, serverName = CANONICAL_MEMORAONE_MCP_SERVER_NAME) {
|
|
8536
8529
|
if (!parsed2 || typeof parsed2 !== "object") {
|
|
8537
8530
|
throw new Error("[setup-ide-files] Xcode MCP config must be a JSON object.");
|
|
8538
8531
|
}
|
|
@@ -8540,7 +8533,8 @@ function validateXcodeMcpConfig(parsed2, expected) {
|
|
|
8540
8533
|
if (!servers || typeof servers !== "object" || Array.isArray(servers)) {
|
|
8541
8534
|
throw new Error("[setup-ide-files] Xcode MCP config missing servers object.");
|
|
8542
8535
|
}
|
|
8543
|
-
const
|
|
8536
|
+
const serverMap = servers;
|
|
8537
|
+
const memoraone = serverMap[serverName] ?? Object.values(serverMap).find((entry) => memoraoneServerMatches19(entry, expected));
|
|
8544
8538
|
if (!memoraoneServerMatches19(memoraone, expected)) {
|
|
8545
8539
|
throw new Error(
|
|
8546
8540
|
"[setup-ide-files] Xcode MCP config servers.memoraone is missing or invalid."
|
|
@@ -8593,9 +8587,9 @@ async function buildXcodeMemoraoneServer(options) {
|
|
|
8593
8587
|
});
|
|
8594
8588
|
}
|
|
8595
8589
|
async function setupXcodeMcpConfig(options) {
|
|
8596
|
-
const homeDir = options.homeDir ??
|
|
8590
|
+
const homeDir = options.homeDir ?? os11.homedir();
|
|
8597
8591
|
const activePath = options.globalConfigPath ?? getXcodeGlobalMcpConfigPath(homeDir);
|
|
8598
|
-
const workspaceRoot =
|
|
8592
|
+
const workspaceRoot = path38.resolve(options.repoRoot);
|
|
8599
8593
|
const memoraone = await buildXcodeMemoraoneServer({
|
|
8600
8594
|
workspaceRoot,
|
|
8601
8595
|
devMode: options.devMode,
|
|
@@ -8617,11 +8611,10 @@ async function setupXcodeMcpConfig(options) {
|
|
|
8617
8611
|
throw new XcodeMcpJsonParseError(activePath);
|
|
8618
8612
|
}
|
|
8619
8613
|
}
|
|
8620
|
-
const merged = mergeXcodeMcpConfigObject(existing, memoraone);
|
|
8614
|
+
const merged = mergeXcodeMcpConfigObject(existing, memoraone, options.ownership);
|
|
8621
8615
|
const body = JSON.stringify(merged, null, 2) + "\n";
|
|
8622
8616
|
if (exists && existing) {
|
|
8623
|
-
|
|
8624
|
-
if (memoraoneServerMatches19(currentMemoraone, memoraone)) {
|
|
8617
|
+
if (canonicalValueMatches(existing, merged)) {
|
|
8625
8618
|
return { outcome: "skipped", memoraone, activeConfigPath: activePath };
|
|
8626
8619
|
}
|
|
8627
8620
|
}
|
|
@@ -8635,7 +8628,7 @@ async function setupXcodeMcpConfig(options) {
|
|
|
8635
8628
|
await writeXcodeMcpJsonAtomic(activePath, body);
|
|
8636
8629
|
const verifyRaw = await fs32.readFile(activePath, "utf8");
|
|
8637
8630
|
const verifyParsed = JSON.parse(stripLeadingLineComments16(verifyRaw));
|
|
8638
|
-
validateXcodeMcpConfig(verifyParsed, memoraone);
|
|
8631
|
+
validateXcodeMcpConfig(verifyParsed, memoraone, options.ownership ? memoraoneServerNameForRepositoryBinding(options.ownership.repositoryBindingId) : CANONICAL_MEMORAONE_MCP_SERVER_NAME);
|
|
8639
8632
|
return {
|
|
8640
8633
|
outcome: exists ? "updated" : "created",
|
|
8641
8634
|
memoraone,
|
|
@@ -8663,13 +8656,13 @@ function logXcodeMcpCliSummary(info, dryRun, println = console.log) {
|
|
|
8663
8656
|
"[setup-ide-files] Fully quit Xcode / Copilot for Xcode and reopen for MCP changes to take effect."
|
|
8664
8657
|
);
|
|
8665
8658
|
}
|
|
8666
|
-
var fs32,
|
|
8659
|
+
var fs32, os11, path38, import_node_crypto23, XcodeMcpJsonParseError;
|
|
8667
8660
|
var init_xcodeMcpConfig = __esm({
|
|
8668
8661
|
"src/xcodeMcpConfig.ts"() {
|
|
8669
8662
|
fs32 = __toESM(require("fs/promises"), 1);
|
|
8670
|
-
|
|
8671
|
-
|
|
8672
|
-
|
|
8663
|
+
os11 = __toESM(require("os"), 1);
|
|
8664
|
+
path38 = __toESM(require("path"), 1);
|
|
8665
|
+
import_node_crypto23 = require("crypto");
|
|
8673
8666
|
init_configUtils();
|
|
8674
8667
|
init_cursorGlobalMcpConfig();
|
|
8675
8668
|
init_initializeBinding();
|
|
@@ -8701,7 +8694,7 @@ async function pathExists22(filePath) {
|
|
|
8701
8694
|
}
|
|
8702
8695
|
}
|
|
8703
8696
|
function getCopilotJetBrainsGlobalMcpConfigPath(homeDir) {
|
|
8704
|
-
return
|
|
8697
|
+
return path39.join(homeDir, ".config", "github-copilot", "intellij", "mcp.json");
|
|
8705
8698
|
}
|
|
8706
8699
|
function buildMemoraoneCopilotJetBrainsMcpServer(options) {
|
|
8707
8700
|
const environment = options.environment ?? (options.devMode ? "local" : "production");
|
|
@@ -8711,7 +8704,7 @@ function buildMemoraoneCopilotJetBrainsMcpServer(options) {
|
|
|
8711
8704
|
apiUrl: options.apiUrl ?? (environment === "local" ? DEV_API_URL : void 0)
|
|
8712
8705
|
}),
|
|
8713
8706
|
MEMORAONE_IDE_TYPE: "copilot-jetbrains",
|
|
8714
|
-
[MEMORAONE_WORKSPACE_ROOT_ENV]:
|
|
8707
|
+
[MEMORAONE_WORKSPACE_ROOT_ENV]: path39.resolve(options.workspaceRoot)
|
|
8715
8708
|
};
|
|
8716
8709
|
if (environment === "local" || options.devMode) {
|
|
8717
8710
|
env2.MEMORAONE_DEV_MODE = "1";
|
|
@@ -8728,17 +8721,17 @@ function buildMemoraoneCopilotJetBrainsMcpServer(options) {
|
|
|
8728
8721
|
env: env2
|
|
8729
8722
|
};
|
|
8730
8723
|
}
|
|
8731
|
-
function mergeCopilotJetBrainsMcpConfigObject(existing, memoraone) {
|
|
8724
|
+
function mergeCopilotJetBrainsMcpConfigObject(existing, memoraone, ownership) {
|
|
8732
8725
|
const base = existing && typeof existing === "object" ? { ...existing } : { servers: {} };
|
|
8733
8726
|
const servers = typeof base.servers === "object" && base.servers !== null && !Array.isArray(base.servers) ? { ...base.servers } : {};
|
|
8734
|
-
return { ...base, servers: replaceMemoraoneOwnedInServerMap(servers, memoraone) };
|
|
8727
|
+
return { ...base, servers: ownership ? replaceMemoraoneRepositoryBindingInServerMap(servers, memoraone, ownership) : replaceMemoraoneOwnedInServerMap(servers, memoraone) };
|
|
8735
8728
|
}
|
|
8736
8729
|
async function writeCopilotJetBrainsMcpJsonAtomic(filePath, content) {
|
|
8737
|
-
const dir =
|
|
8730
|
+
const dir = path39.dirname(filePath);
|
|
8738
8731
|
await fs33.mkdir(dir, { recursive: true });
|
|
8739
|
-
const tmpPath =
|
|
8732
|
+
const tmpPath = path39.join(
|
|
8740
8733
|
dir,
|
|
8741
|
-
`.${
|
|
8734
|
+
`.${path39.basename(filePath)}.${process.pid}.${(0, import_node_crypto24.randomBytes)(8).toString("hex")}.tmp`
|
|
8742
8735
|
);
|
|
8743
8736
|
try {
|
|
8744
8737
|
await fs33.writeFile(tmpPath, content, "utf8");
|
|
@@ -8754,7 +8747,7 @@ async function writeCopilotJetBrainsMcpJsonAtomic(filePath, content) {
|
|
|
8754
8747
|
function memoraoneServerMatches20(server, expected) {
|
|
8755
8748
|
return canonicalValueMatches(server, expected);
|
|
8756
8749
|
}
|
|
8757
|
-
function validateCopilotJetBrainsMcpConfig(parsed2, expected) {
|
|
8750
|
+
function validateCopilotJetBrainsMcpConfig(parsed2, expected, serverName = CANONICAL_MEMORAONE_MCP_SERVER_NAME) {
|
|
8758
8751
|
if (!parsed2 || typeof parsed2 !== "object") {
|
|
8759
8752
|
throw new Error(
|
|
8760
8753
|
"[setup-ide-files] GitHub Copilot JetBrains MCP config must be a JSON object."
|
|
@@ -8766,7 +8759,8 @@ function validateCopilotJetBrainsMcpConfig(parsed2, expected) {
|
|
|
8766
8759
|
"[setup-ide-files] GitHub Copilot JetBrains MCP config missing servers object."
|
|
8767
8760
|
);
|
|
8768
8761
|
}
|
|
8769
|
-
const
|
|
8762
|
+
const serverMap = servers;
|
|
8763
|
+
const memoraone = serverMap[serverName] ?? Object.values(serverMap).find((entry) => memoraoneServerMatches20(entry, expected));
|
|
8770
8764
|
if (!memoraoneServerMatches20(memoraone, expected)) {
|
|
8771
8765
|
throw new Error(
|
|
8772
8766
|
"[setup-ide-files] GitHub Copilot JetBrains MCP config servers.memoraone is missing or invalid."
|
|
@@ -8819,9 +8813,9 @@ async function buildCopilotJetBrainsMemoraoneServer(options) {
|
|
|
8819
8813
|
});
|
|
8820
8814
|
}
|
|
8821
8815
|
async function setupCopilotJetBrainsMcpConfig(options) {
|
|
8822
|
-
const homeDir = options.homeDir ??
|
|
8816
|
+
const homeDir = options.homeDir ?? os12.homedir();
|
|
8823
8817
|
const activePath = options.globalConfigPath ?? getCopilotJetBrainsGlobalMcpConfigPath(homeDir);
|
|
8824
|
-
const workspaceRoot =
|
|
8818
|
+
const workspaceRoot = path39.resolve(options.repoRoot);
|
|
8825
8819
|
const memoraone = await buildCopilotJetBrainsMemoraoneServer({
|
|
8826
8820
|
workspaceRoot,
|
|
8827
8821
|
devMode: options.devMode,
|
|
@@ -8843,11 +8837,10 @@ async function setupCopilotJetBrainsMcpConfig(options) {
|
|
|
8843
8837
|
throw new CopilotJetBrainsMcpJsonParseError(activePath);
|
|
8844
8838
|
}
|
|
8845
8839
|
}
|
|
8846
|
-
const merged = mergeCopilotJetBrainsMcpConfigObject(existing, memoraone);
|
|
8840
|
+
const merged = mergeCopilotJetBrainsMcpConfigObject(existing, memoraone, options.ownership);
|
|
8847
8841
|
const body = JSON.stringify(merged, null, 2) + "\n";
|
|
8848
8842
|
if (exists && existing) {
|
|
8849
|
-
|
|
8850
|
-
if (memoraoneServerMatches20(currentMemoraone, memoraone)) {
|
|
8843
|
+
if (canonicalValueMatches(existing, merged)) {
|
|
8851
8844
|
return { outcome: "skipped", memoraone, activeConfigPath: activePath };
|
|
8852
8845
|
}
|
|
8853
8846
|
}
|
|
@@ -8861,7 +8854,7 @@ async function setupCopilotJetBrainsMcpConfig(options) {
|
|
|
8861
8854
|
await writeCopilotJetBrainsMcpJsonAtomic(activePath, body);
|
|
8862
8855
|
const verifyRaw = await fs33.readFile(activePath, "utf8");
|
|
8863
8856
|
const verifyParsed = JSON.parse(stripLeadingLineComments17(verifyRaw));
|
|
8864
|
-
validateCopilotJetBrainsMcpConfig(verifyParsed, memoraone);
|
|
8857
|
+
validateCopilotJetBrainsMcpConfig(verifyParsed, memoraone, options.ownership ? memoraoneServerNameForRepositoryBinding(options.ownership.repositoryBindingId) : CANONICAL_MEMORAONE_MCP_SERVER_NAME);
|
|
8865
8858
|
return {
|
|
8866
8859
|
outcome: exists ? "updated" : "created",
|
|
8867
8860
|
memoraone,
|
|
@@ -8893,13 +8886,13 @@ function logCopilotJetBrainsMcpCliSummary(info, dryRun, println = console.log) {
|
|
|
8893
8886
|
"[setup-ide-files] Fully quit JetBrains IDE / GitHub Copilot and reopen for MCP changes to take effect."
|
|
8894
8887
|
);
|
|
8895
8888
|
}
|
|
8896
|
-
var fs33,
|
|
8889
|
+
var fs33, os12, path39, import_node_crypto24, CopilotJetBrainsMcpJsonParseError;
|
|
8897
8890
|
var init_copilotJetBrainsMcpConfig = __esm({
|
|
8898
8891
|
"src/copilotJetBrainsMcpConfig.ts"() {
|
|
8899
8892
|
fs33 = __toESM(require("fs/promises"), 1);
|
|
8900
|
-
|
|
8901
|
-
|
|
8902
|
-
|
|
8893
|
+
os12 = __toESM(require("os"), 1);
|
|
8894
|
+
path39 = __toESM(require("path"), 1);
|
|
8895
|
+
import_node_crypto24 = require("crypto");
|
|
8903
8896
|
init_configUtils();
|
|
8904
8897
|
init_cursorGlobalMcpConfig();
|
|
8905
8898
|
init_initializeBinding();
|
|
@@ -9305,7 +9298,6 @@ var setupIdeFiles_exports = {};
|
|
|
9305
9298
|
__export(setupIdeFiles_exports, {
|
|
9306
9299
|
CANONICAL_MEMORAONE_MCP_SERVER_NAME: () => CANONICAL_MEMORAONE_MCP_SERVER_NAME,
|
|
9307
9300
|
CLINE_CLI_MCP_TIMEOUT_SECONDS: () => CLINE_CLI_MCP_TIMEOUT_SECONDS,
|
|
9308
|
-
ClineNoHostFoundError: () => ClineNoHostFoundError,
|
|
9309
9301
|
GITIGNORE_MEMORAONE_COMMENT: () => GITIGNORE_MEMORAONE_COMMENT,
|
|
9310
9302
|
GITIGNORE_MEMORAONE_ENTRY: () => GITIGNORE_MEMORAONE_ENTRY,
|
|
9311
9303
|
JETBRAINS_DEBUG_ENV_VARS: () => JETBRAINS_DEBUG_ENV_VARS,
|
|
@@ -9340,7 +9332,6 @@ __export(setupIdeFiles_exports, {
|
|
|
9340
9332
|
cliSetupIdeFiles: () => cliSetupIdeFiles,
|
|
9341
9333
|
cursorConfigHasManagedMemoraone: () => cursorConfigHasManagedMemoraone,
|
|
9342
9334
|
cursorEnvironmentFromFlags: () => cursorEnvironmentFromFlags,
|
|
9343
|
-
detectClineHosts: () => detectClineHosts,
|
|
9344
9335
|
detectCursorGlobalMcpConfig: () => detectCursorGlobalMcpConfig,
|
|
9345
9336
|
findRepoRoot: () => findRepoRoot,
|
|
9346
9337
|
formatJetBrainsBackupTimestamp: () => formatJetBrainsBackupTimestamp,
|
|
@@ -9354,8 +9345,7 @@ __export(setupIdeFiles_exports, {
|
|
|
9354
9345
|
getClineCliGlobalMcpConfigPath: () => getClineCliGlobalMcpConfigPath,
|
|
9355
9346
|
getClineCliMcpConfigPaths: () => getClineCliMcpConfigPaths,
|
|
9356
9347
|
getClineCliRootMcpConfigPath: () => getClineCliRootMcpConfigPath,
|
|
9357
|
-
|
|
9358
|
-
getClineHostMcpConfigPath: () => getClineHostMcpConfigPath,
|
|
9348
|
+
getClineProjectMcpConfigPath: () => getClineProjectMcpConfigPath,
|
|
9359
9349
|
getCodexGlobalMcpConfigPath: () => getCodexGlobalMcpConfigPath,
|
|
9360
9350
|
getCodexProjectMcpConfigPath: () => getCodexProjectMcpConfigPath,
|
|
9361
9351
|
getContinueProjectMcpConfigPath: () => getContinueProjectMcpConfigPath,
|
|
@@ -9366,7 +9356,6 @@ __export(setupIdeFiles_exports, {
|
|
|
9366
9356
|
getGooseGlobalMcpConfigPath: () => getGooseGlobalMcpConfigPath,
|
|
9367
9357
|
getJunieProjectMcpConfigPath: () => getJunieProjectMcpConfigPath,
|
|
9368
9358
|
getKiroProjectMcpConfigPath: () => getKiroProjectMcpConfigPath,
|
|
9369
|
-
getKnownClineHostCandidates: () => getKnownClineHostCandidates,
|
|
9370
9359
|
getKnownCursorGlobalMcpConfigCandidates: () => getKnownCursorGlobalMcpConfigCandidates,
|
|
9371
9360
|
getKnownJetBrainsMcpConfigLocations: () => getKnownJetBrainsMcpConfigLocations,
|
|
9372
9361
|
getOpenCodeGlobalMcpConfigPath: () => getOpenCodeGlobalMcpConfigPath,
|
|
@@ -9476,7 +9465,7 @@ function buildMemoraoneMcpServer(ideType, options = {}) {
|
|
|
9476
9465
|
};
|
|
9477
9466
|
const includeWorkspaceRoot = options.workspaceRoot !== void 0 && (environment === "local" || ideType === "cursor" || ideType === "claude-code");
|
|
9478
9467
|
if (includeWorkspaceRoot) {
|
|
9479
|
-
env2[MEMORAONE_WORKSPACE_ROOT_ENV] =
|
|
9468
|
+
env2[MEMORAONE_WORKSPACE_ROOT_ENV] = path40.resolve(options.workspaceRoot);
|
|
9480
9469
|
}
|
|
9481
9470
|
if (environment === "local") {
|
|
9482
9471
|
if (!options.cliPath) {
|
|
@@ -9496,9 +9485,9 @@ function buildMemoraoneMcpServer(ideType, options = {}) {
|
|
|
9496
9485
|
};
|
|
9497
9486
|
}
|
|
9498
9487
|
function assertUnderRepoRoot(repoRoot, absPath) {
|
|
9499
|
-
const normRoot =
|
|
9500
|
-
const normPath =
|
|
9501
|
-
if (normPath !==
|
|
9488
|
+
const normRoot = path40.resolve(repoRoot) + path40.sep;
|
|
9489
|
+
const normPath = path40.resolve(absPath);
|
|
9490
|
+
if (normPath !== path40.resolve(repoRoot) && !normPath.startsWith(normRoot)) {
|
|
9502
9491
|
throw new Error(`[setup-ide-files] Refusing to write outside repo root: ${absPath}`);
|
|
9503
9492
|
}
|
|
9504
9493
|
}
|
|
@@ -9522,18 +9511,18 @@ async function ensureGitignoreMemoraone(_repoRoot, _opts) {
|
|
|
9522
9511
|
return "skipped";
|
|
9523
9512
|
}
|
|
9524
9513
|
async function findRepoRoot(startDir) {
|
|
9525
|
-
let current =
|
|
9526
|
-
const root =
|
|
9514
|
+
let current = path40.resolve(startDir);
|
|
9515
|
+
const root = path40.parse(current).root;
|
|
9527
9516
|
while (true) {
|
|
9528
|
-
const gitPath =
|
|
9529
|
-
const m1Path =
|
|
9517
|
+
const gitPath = path40.join(current, ".git");
|
|
9518
|
+
const m1Path = path40.join(current, "memoraone.m1");
|
|
9530
9519
|
if (await pathExists23(gitPath) || await pathExists23(m1Path)) {
|
|
9531
9520
|
return current;
|
|
9532
9521
|
}
|
|
9533
9522
|
if (current === root) {
|
|
9534
9523
|
return null;
|
|
9535
9524
|
}
|
|
9536
|
-
current =
|
|
9525
|
+
current = path40.dirname(current);
|
|
9537
9526
|
}
|
|
9538
9527
|
}
|
|
9539
9528
|
function stripLeadingLineComments18(text) {
|
|
@@ -9592,11 +9581,11 @@ function buildVscodeMcpJsonBody(existing, options = {}) {
|
|
|
9592
9581
|
return mcpJsonHeader() + JSON.stringify(merged, null, 2) + "\n";
|
|
9593
9582
|
}
|
|
9594
9583
|
async function writeSharedMcpJsonAtomic(filePath, content) {
|
|
9595
|
-
const dir =
|
|
9584
|
+
const dir = path40.dirname(filePath);
|
|
9596
9585
|
await fs34.mkdir(dir, { recursive: true });
|
|
9597
|
-
const tmpPath =
|
|
9586
|
+
const tmpPath = path40.join(
|
|
9598
9587
|
dir,
|
|
9599
|
-
`.${
|
|
9588
|
+
`.${path40.basename(filePath)}.${process.pid}.${(0, import_node_crypto25.randomBytes)(8).toString("hex")}.tmp`
|
|
9600
9589
|
);
|
|
9601
9590
|
try {
|
|
9602
9591
|
await fs34.writeFile(tmpPath, content, "utf8");
|
|
@@ -9650,7 +9639,7 @@ async function writeClaudeCodeMcpJson(repoRoot, buildBody, opts) {
|
|
|
9650
9639
|
return "updated";
|
|
9651
9640
|
}
|
|
9652
9641
|
async function writeManagedMarkdown(repoRoot, relPath, fullContent, opts) {
|
|
9653
|
-
const abs =
|
|
9642
|
+
const abs = path40.join(repoRoot, relPath);
|
|
9654
9643
|
assertUnderRepoRoot(repoRoot, abs);
|
|
9655
9644
|
let prior = "";
|
|
9656
9645
|
let existed = false;
|
|
@@ -9662,25 +9651,25 @@ async function writeManagedMarkdown(repoRoot, relPath, fullContent, opts) {
|
|
|
9662
9651
|
}
|
|
9663
9652
|
if (!existed) {
|
|
9664
9653
|
if (opts.dryRun) return "created";
|
|
9665
|
-
await fs34.mkdir(
|
|
9654
|
+
await fs34.mkdir(path40.dirname(abs), { recursive: true });
|
|
9666
9655
|
await fs34.writeFile(abs, fullContent, "utf8");
|
|
9667
9656
|
return "created";
|
|
9668
9657
|
}
|
|
9669
9658
|
if (prior.includes(MANAGED_MARKER)) {
|
|
9670
9659
|
if (prior === fullContent) return "skipped";
|
|
9671
9660
|
if (opts.dryRun) return "updated";
|
|
9672
|
-
await fs34.mkdir(
|
|
9661
|
+
await fs34.mkdir(path40.dirname(abs), { recursive: true });
|
|
9673
9662
|
await fs34.writeFile(abs, fullContent, "utf8");
|
|
9674
9663
|
return "updated";
|
|
9675
9664
|
}
|
|
9676
9665
|
if (!opts.force) return "skipped-untracked";
|
|
9677
9666
|
if (opts.dryRun) return "updated";
|
|
9678
|
-
await fs34.mkdir(
|
|
9667
|
+
await fs34.mkdir(path40.dirname(abs), { recursive: true });
|
|
9679
9668
|
await fs34.writeFile(abs, fullContent, "utf8");
|
|
9680
9669
|
return "updated";
|
|
9681
9670
|
}
|
|
9682
9671
|
async function writeIdeMcpJson(repoRoot, relPath, buildBody, opts) {
|
|
9683
|
-
const abs =
|
|
9672
|
+
const abs = path40.join(repoRoot, relPath);
|
|
9684
9673
|
assertUnderRepoRoot(repoRoot, abs);
|
|
9685
9674
|
let raw = "";
|
|
9686
9675
|
let existed = false;
|
|
@@ -10274,7 +10263,7 @@ async function runSetupIdeFiles(o) {
|
|
|
10274
10263
|
let junieMcp;
|
|
10275
10264
|
let xcodeMcp;
|
|
10276
10265
|
let copilotJetBrainsMcp;
|
|
10277
|
-
const repoRoot = o.workspaceRoot !== void 0 && o.workspaceRoot !== "" ?
|
|
10266
|
+
const repoRoot = o.workspaceRoot !== void 0 && o.workspaceRoot !== "" ? path40.resolve(o.workspaceRoot) : await findRepoRoot(o.cwd);
|
|
10278
10267
|
if (!repoRoot) {
|
|
10279
10268
|
return {
|
|
10280
10269
|
exitCode: 1,
|
|
@@ -10316,6 +10305,13 @@ async function runSetupIdeFiles(o) {
|
|
|
10316
10305
|
environment: localOrDev ? "local" : cursorEnvironment,
|
|
10317
10306
|
apiUrl: resolvedApiUrl2
|
|
10318
10307
|
});
|
|
10308
|
+
const bindingRecord = o.repositoryBindingId ? void 0 : await findBindingRecordByWorkspaceRoot(repoRoot, o.homeDir);
|
|
10309
|
+
const repositoryBindingId = o.repositoryBindingId ?? bindingRecord?.repositoryBindingId;
|
|
10310
|
+
const globalOwnership = repositoryBindingId ? {
|
|
10311
|
+
repositoryBindingId,
|
|
10312
|
+
replacedRepositoryBindingIds: o.replacedRepositoryBindingIds,
|
|
10313
|
+
workspaceRoot: repoRoot
|
|
10314
|
+
} : void 0;
|
|
10319
10315
|
if (!o.dryRun && resolvedApiUrl2) {
|
|
10320
10316
|
await persistBindingApiUrl(repoRoot, effectiveApiUrl, o.homeDir, o.dryRun);
|
|
10321
10317
|
}
|
|
@@ -10496,7 +10492,7 @@ description: MemoraOne MCP \u2014 IDE agent instructions
|
|
|
10496
10492
|
{ force: o.force, dryRun: o.dryRun }
|
|
10497
10493
|
);
|
|
10498
10494
|
try {
|
|
10499
|
-
const homeDir = o.jetbrainsHomeDir ??
|
|
10495
|
+
const homeDir = o.jetbrainsHomeDir ?? os13.homedir();
|
|
10500
10496
|
const activePath = o.jetbrainsGlobalMcpConfigPath ?? getJetBrainsGlobalMcpConfigPath(homeDir);
|
|
10501
10497
|
const jetbrainsSetup = await setupJetBrainsMcpConfig({
|
|
10502
10498
|
homeDir,
|
|
@@ -10512,7 +10508,8 @@ description: MemoraOne MCP \u2014 IDE agent instructions
|
|
|
10512
10508
|
repair: o.repair ?? false,
|
|
10513
10509
|
verify: o.verifyHandshake ?? !o.dryRun,
|
|
10514
10510
|
npxPathOverride: o.npxPathOverride,
|
|
10515
|
-
cliPathOverride: o.cliPathOverride
|
|
10511
|
+
cliPathOverride: o.cliPathOverride,
|
|
10512
|
+
ownership: globalOwnership
|
|
10516
10513
|
});
|
|
10517
10514
|
jetbrainsMcp = {
|
|
10518
10515
|
activeConfigPath: activePath,
|
|
@@ -10606,7 +10603,7 @@ description: MemoraOne MCP \u2014 IDE agent instructions
|
|
|
10606
10603
|
}
|
|
10607
10604
|
if (o.targets.windsurf) {
|
|
10608
10605
|
try {
|
|
10609
|
-
const homeDir = o.windsurfHomeDir ??
|
|
10606
|
+
const homeDir = o.windsurfHomeDir ?? os13.homedir();
|
|
10610
10607
|
const activePath = o.windsurfGlobalMcpConfigPath ?? getWindsurfGlobalMcpConfigPath(homeDir);
|
|
10611
10608
|
const legacyPath = o.windsurfLegacyMcpConfigPath ?? getWindsurfLegacyMcpConfigPath(homeDir);
|
|
10612
10609
|
const windsurfSetup = await setupWindsurfMcpConfig({
|
|
@@ -10622,7 +10619,8 @@ description: MemoraOne MCP \u2014 IDE agent instructions
|
|
|
10622
10619
|
npmPackageChannel,
|
|
10623
10620
|
apiUrl: resolvedApiUrl2,
|
|
10624
10621
|
npxPathOverride: o.npxPathOverride,
|
|
10625
|
-
cliPathOverride: o.cliPathOverride ?? o.cursorLocalCliPathOverride
|
|
10622
|
+
cliPathOverride: o.cliPathOverride ?? o.cursorLocalCliPathOverride,
|
|
10623
|
+
ownership: globalOwnership
|
|
10626
10624
|
});
|
|
10627
10625
|
windsurfMcp = {
|
|
10628
10626
|
activeConfigPath: windsurfSetup.activeConfigPath,
|
|
@@ -10802,13 +10800,10 @@ description: MemoraOne MCP \u2014 IDE agent instructions
|
|
|
10802
10800
|
}
|
|
10803
10801
|
if (o.targets.cline) {
|
|
10804
10802
|
try {
|
|
10805
|
-
const
|
|
10803
|
+
const activeConfigPath = o.clineProjectMcpConfigPath ?? getClineProjectMcpConfigPath(repoRoot);
|
|
10806
10804
|
const clineSetup = await setupClineMcpConfig({
|
|
10807
|
-
homeDir,
|
|
10808
10805
|
repoRoot,
|
|
10809
|
-
|
|
10810
|
-
explicitHostIds: o.clineExplicitHostIds,
|
|
10811
|
-
explicitHostPaths: o.clineExplicitHostPaths,
|
|
10806
|
+
projectConfigPath: activeConfigPath,
|
|
10812
10807
|
dryRun: o.dryRun,
|
|
10813
10808
|
devMode: localOrDev,
|
|
10814
10809
|
environment: localOrDev ? "local" : cursorEnvironment,
|
|
@@ -10818,39 +10813,34 @@ description: MemoraOne MCP \u2014 IDE agent instructions
|
|
|
10818
10813
|
cliPathOverride: o.cliPathOverride ?? o.cursorLocalCliPathOverride
|
|
10819
10814
|
});
|
|
10820
10815
|
clineMcp = {
|
|
10821
|
-
|
|
10822
|
-
|
|
10816
|
+
activeConfigPath: clineSetup.activeConfigPath,
|
|
10817
|
+
outcome: clineSetup.outcome,
|
|
10818
|
+
npxPath: clineSetup.memoraone?.command,
|
|
10819
|
+
backupPath: clineSetup.backupPath
|
|
10823
10820
|
};
|
|
10824
|
-
|
|
10825
|
-
outcomes[`cline-${host.hostId}:${host.activeConfigPath}`] = host.outcome;
|
|
10826
|
-
}
|
|
10821
|
+
outcomes[".cline/mcp.json"] = clineSetup.outcome;
|
|
10827
10822
|
} catch (err) {
|
|
10828
|
-
|
|
10829
|
-
|
|
10830
|
-
|
|
10831
|
-
|
|
10832
|
-
|
|
10833
|
-
|
|
10834
|
-
|
|
10835
|
-
|
|
10836
|
-
|
|
10837
|
-
|
|
10838
|
-
|
|
10839
|
-
|
|
10840
|
-
|
|
10841
|
-
|
|
10842
|
-
|
|
10843
|
-
|
|
10844
|
-
clineMcp,
|
|
10845
|
-
daemonCleanup,
|
|
10846
|
-
error: message
|
|
10847
|
-
};
|
|
10848
|
-
}
|
|
10823
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
10824
|
+
return {
|
|
10825
|
+
exitCode: 1,
|
|
10826
|
+
repoRoot,
|
|
10827
|
+
outcomes,
|
|
10828
|
+
cursorMcp,
|
|
10829
|
+
jetbrainsMcp,
|
|
10830
|
+
windsurfMcp,
|
|
10831
|
+
opencodeMcp,
|
|
10832
|
+
codexMcp,
|
|
10833
|
+
kiroMcp,
|
|
10834
|
+
rooCodeMcp,
|
|
10835
|
+
clineMcp,
|
|
10836
|
+
daemonCleanup,
|
|
10837
|
+
error: message
|
|
10838
|
+
};
|
|
10849
10839
|
}
|
|
10850
10840
|
}
|
|
10851
10841
|
if (o.targets.clineCli) {
|
|
10852
10842
|
try {
|
|
10853
|
-
const homeDir = o.clineCliHomeDir ?? o.homeDir ??
|
|
10843
|
+
const homeDir = o.clineCliHomeDir ?? o.homeDir ?? os13.homedir();
|
|
10854
10844
|
const settingsPath = o.clineCliGlobalMcpConfigPath ?? getClineCliGlobalMcpConfigPath(homeDir);
|
|
10855
10845
|
const rootPath = o.clineCliRootMcpConfigPath ?? getClineCliRootMcpConfigPath(homeDir);
|
|
10856
10846
|
const clineCliSetup = await setupClineCliMcpConfig({
|
|
@@ -10864,7 +10854,8 @@ description: MemoraOne MCP \u2014 IDE agent instructions
|
|
|
10864
10854
|
npmPackageChannel,
|
|
10865
10855
|
apiUrl: resolvedApiUrl2,
|
|
10866
10856
|
npxPathOverride: o.npxPathOverride,
|
|
10867
|
-
cliPathOverride: o.cliPathOverride ?? o.cursorLocalCliPathOverride
|
|
10857
|
+
cliPathOverride: o.cliPathOverride ?? o.cursorLocalCliPathOverride,
|
|
10858
|
+
ownership: globalOwnership
|
|
10868
10859
|
});
|
|
10869
10860
|
clineCliMcp = {
|
|
10870
10861
|
activeConfigPath: clineCliSetup.activeConfigPath,
|
|
@@ -10899,7 +10890,7 @@ description: MemoraOne MCP \u2014 IDE agent instructions
|
|
|
10899
10890
|
}
|
|
10900
10891
|
if (o.targets.claudeDesktop) {
|
|
10901
10892
|
try {
|
|
10902
|
-
const homeDir = o.claudeDesktopHomeDir ?? o.homeDir ??
|
|
10893
|
+
const homeDir = o.claudeDesktopHomeDir ?? o.homeDir ?? os13.homedir();
|
|
10903
10894
|
const activePath = o.claudeDesktopGlobalMcpConfigPath ?? getClaudeDesktopGlobalMcpConfigPath(homeDir);
|
|
10904
10895
|
const claudeDesktopSetup = await setupClaudeDesktopMcpConfig({
|
|
10905
10896
|
homeDir,
|
|
@@ -10911,7 +10902,8 @@ description: MemoraOne MCP \u2014 IDE agent instructions
|
|
|
10911
10902
|
npmPackageChannel,
|
|
10912
10903
|
apiUrl: resolvedApiUrl2,
|
|
10913
10904
|
npxPathOverride: o.npxPathOverride,
|
|
10914
|
-
cliPathOverride: o.cliPathOverride ?? o.cursorLocalCliPathOverride
|
|
10905
|
+
cliPathOverride: o.cliPathOverride ?? o.cursorLocalCliPathOverride,
|
|
10906
|
+
ownership: globalOwnership
|
|
10915
10907
|
});
|
|
10916
10908
|
claudeDesktopMcp = {
|
|
10917
10909
|
activeConfigPath: claudeDesktopSetup.activeConfigPath,
|
|
@@ -11206,7 +11198,7 @@ description: MemoraOne MCP \u2014 IDE agent instructions
|
|
|
11206
11198
|
}
|
|
11207
11199
|
if (o.targets.antigravity) {
|
|
11208
11200
|
try {
|
|
11209
|
-
const homeDir = o.antigravityHomeDir ?? o.homeDir ??
|
|
11201
|
+
const homeDir = o.antigravityHomeDir ?? o.homeDir ?? os13.homedir();
|
|
11210
11202
|
const activePath = o.antigravityGlobalMcpConfigPath ?? getAntigravityGlobalMcpConfigPath(homeDir);
|
|
11211
11203
|
const legacyPath = o.antigravityLegacyMcpConfigPath ?? getAntigravityLegacyMcpConfigPath(homeDir);
|
|
11212
11204
|
const antigravitySetup = await setupAntigravityMcpConfig({
|
|
@@ -11220,7 +11212,8 @@ description: MemoraOne MCP \u2014 IDE agent instructions
|
|
|
11220
11212
|
npmPackageChannel,
|
|
11221
11213
|
apiUrl: resolvedApiUrl2,
|
|
11222
11214
|
npxPathOverride: o.npxPathOverride,
|
|
11223
|
-
cliPathOverride: o.cliPathOverride ?? o.cursorLocalCliPathOverride
|
|
11215
|
+
cliPathOverride: o.cliPathOverride ?? o.cursorLocalCliPathOverride,
|
|
11216
|
+
ownership: globalOwnership
|
|
11224
11217
|
});
|
|
11225
11218
|
antigravityMcp = {
|
|
11226
11219
|
activeConfigPath: antigravitySetup.activeConfigPath,
|
|
@@ -11261,7 +11254,7 @@ description: MemoraOne MCP \u2014 IDE agent instructions
|
|
|
11261
11254
|
}
|
|
11262
11255
|
if (o.targets.goose) {
|
|
11263
11256
|
try {
|
|
11264
|
-
const homeDir = o.gooseHomeDir ?? o.homeDir ??
|
|
11257
|
+
const homeDir = o.gooseHomeDir ?? o.homeDir ?? os13.homedir();
|
|
11265
11258
|
const activePath = o.gooseGlobalMcpConfigPath ?? getGooseGlobalMcpConfigPath(homeDir);
|
|
11266
11259
|
const gooseSetup = await setupGooseMcpConfig({
|
|
11267
11260
|
homeDir,
|
|
@@ -11273,7 +11266,8 @@ description: MemoraOne MCP \u2014 IDE agent instructions
|
|
|
11273
11266
|
npmPackageChannel,
|
|
11274
11267
|
apiUrl: resolvedApiUrl2,
|
|
11275
11268
|
npxPathOverride: o.npxPathOverride,
|
|
11276
|
-
cliPathOverride: o.cliPathOverride ?? o.cursorLocalCliPathOverride
|
|
11269
|
+
cliPathOverride: o.cliPathOverride ?? o.cursorLocalCliPathOverride,
|
|
11270
|
+
ownership: globalOwnership
|
|
11277
11271
|
});
|
|
11278
11272
|
gooseMcp = {
|
|
11279
11273
|
activeConfigPath: gooseSetup.activeConfigPath,
|
|
@@ -11362,7 +11356,7 @@ description: MemoraOne MCP \u2014 IDE agent instructions
|
|
|
11362
11356
|
}
|
|
11363
11357
|
if (o.targets.xcode) {
|
|
11364
11358
|
try {
|
|
11365
|
-
const homeDir = o.xcodeHomeDir ?? o.homeDir ??
|
|
11359
|
+
const homeDir = o.xcodeHomeDir ?? o.homeDir ?? os13.homedir();
|
|
11366
11360
|
const activePath = o.xcodeGlobalMcpConfigPath ?? getXcodeGlobalMcpConfigPath(homeDir);
|
|
11367
11361
|
const xcodeSetup = await setupXcodeMcpConfig({
|
|
11368
11362
|
homeDir,
|
|
@@ -11374,7 +11368,8 @@ description: MemoraOne MCP \u2014 IDE agent instructions
|
|
|
11374
11368
|
npmPackageChannel,
|
|
11375
11369
|
apiUrl: resolvedApiUrl2,
|
|
11376
11370
|
npxPathOverride: o.npxPathOverride,
|
|
11377
|
-
cliPathOverride: o.cliPathOverride ?? o.cursorLocalCliPathOverride
|
|
11371
|
+
cliPathOverride: o.cliPathOverride ?? o.cursorLocalCliPathOverride,
|
|
11372
|
+
ownership: globalOwnership
|
|
11378
11373
|
});
|
|
11379
11374
|
xcodeMcp = {
|
|
11380
11375
|
activeConfigPath: xcodeSetup.activeConfigPath,
|
|
@@ -11415,7 +11410,7 @@ description: MemoraOne MCP \u2014 IDE agent instructions
|
|
|
11415
11410
|
}
|
|
11416
11411
|
if (o.targets.copilotJetBrains) {
|
|
11417
11412
|
try {
|
|
11418
|
-
const homeDir = o.copilotJetBrainsHomeDir ?? o.homeDir ??
|
|
11413
|
+
const homeDir = o.copilotJetBrainsHomeDir ?? o.homeDir ?? os13.homedir();
|
|
11419
11414
|
const activePath = o.copilotJetBrainsGlobalMcpConfigPath ?? getCopilotJetBrainsGlobalMcpConfigPath(homeDir);
|
|
11420
11415
|
const copilotJetBrainsSetup = await setupCopilotJetBrainsMcpConfig({
|
|
11421
11416
|
homeDir,
|
|
@@ -11427,7 +11422,8 @@ description: MemoraOne MCP \u2014 IDE agent instructions
|
|
|
11427
11422
|
npmPackageChannel,
|
|
11428
11423
|
apiUrl: resolvedApiUrl2,
|
|
11429
11424
|
npxPathOverride: o.npxPathOverride,
|
|
11430
|
-
cliPathOverride: o.cliPathOverride ?? o.cursorLocalCliPathOverride
|
|
11425
|
+
cliPathOverride: o.cliPathOverride ?? o.cursorLocalCliPathOverride,
|
|
11426
|
+
ownership: globalOwnership
|
|
11431
11427
|
});
|
|
11432
11428
|
copilotJetBrainsMcp = {
|
|
11433
11429
|
activeConfigPath: copilotJetBrainsSetup.activeConfigPath,
|
|
@@ -11601,13 +11597,13 @@ async function cliSetupIdeFiles(argv, options = {}) {
|
|
|
11601
11597
|
}
|
|
11602
11598
|
return 0;
|
|
11603
11599
|
}
|
|
11604
|
-
var fs34,
|
|
11600
|
+
var fs34, os13, path40, import_node_crypto25, MANAGED_MARKER, GITIGNORE_MEMORAONE_COMMENT, GITIGNORE_MEMORAONE_ENTRY, SharedMcpJsonParseError;
|
|
11605
11601
|
var init_setupIdeFiles = __esm({
|
|
11606
11602
|
"src/setupIdeFiles.ts"() {
|
|
11607
11603
|
fs34 = __toESM(require("fs/promises"), 1);
|
|
11608
|
-
|
|
11609
|
-
|
|
11610
|
-
|
|
11604
|
+
os13 = __toESM(require("os"), 1);
|
|
11605
|
+
path40 = __toESM(require("path"), 1);
|
|
11606
|
+
import_node_crypto25 = require("crypto");
|
|
11611
11607
|
init_cleanup();
|
|
11612
11608
|
init_cursorGlobalMcpConfig();
|
|
11613
11609
|
init_jetbrainsMcpConfig();
|
|
@@ -11677,10 +11673,10 @@ var init_setupIdeFiles = __esm({
|
|
|
11677
11673
|
|
|
11678
11674
|
// src/localState/replaceRootLocalState.ts
|
|
11679
11675
|
function canonicalizeWorkspaceRoot(workspaceRoot) {
|
|
11680
|
-
return
|
|
11676
|
+
return path41.resolve(workspaceRoot);
|
|
11681
11677
|
}
|
|
11682
11678
|
function getWorkspaceMapPathForHome(homeDir) {
|
|
11683
|
-
return
|
|
11679
|
+
return path41.join(getMemoraoneStateDir(homeDir), WORKSPACE_MAP_FILENAME);
|
|
11684
11680
|
}
|
|
11685
11681
|
async function loadWorkspaceMapFile(homeDir) {
|
|
11686
11682
|
const filePath = getWorkspaceMapPathForHome(homeDir);
|
|
@@ -11695,7 +11691,7 @@ async function saveWorkspaceMapFile(map, homeDir) {
|
|
|
11695
11691
|
await writeJsonAtomic(getWorkspaceMapPathForHome(homeDir), map);
|
|
11696
11692
|
}
|
|
11697
11693
|
function rootsMatch(a, b) {
|
|
11698
|
-
return
|
|
11694
|
+
return path41.resolve(a) === path41.resolve(b);
|
|
11699
11695
|
}
|
|
11700
11696
|
async function collectRootAssociatedBindingIds(workspaceRoot, options = {}) {
|
|
11701
11697
|
const canonicalRoot = canonicalizeWorkspaceRoot(workspaceRoot);
|
|
@@ -11852,11 +11848,11 @@ async function restoreRootLocalState(snapshot, options = {}) {
|
|
|
11852
11848
|
await writeInstallationCredentials(creds, options.credentialOptions);
|
|
11853
11849
|
}
|
|
11854
11850
|
}
|
|
11855
|
-
var fs35,
|
|
11851
|
+
var fs35, path41, WORKSPACE_MAP_FILENAME, FINGERPRINT_REGEX;
|
|
11856
11852
|
var init_replaceRootLocalState = __esm({
|
|
11857
11853
|
"src/localState/replaceRootLocalState.ts"() {
|
|
11858
11854
|
fs35 = __toESM(require("fs/promises"), 1);
|
|
11859
|
-
|
|
11855
|
+
path41 = __toESM(require("path"), 1);
|
|
11860
11856
|
init_installationCredentials();
|
|
11861
11857
|
init_bindingStore();
|
|
11862
11858
|
init_localLocks();
|
|
@@ -11920,9 +11916,6 @@ async function defaultRemoveSocket2(socketPath) {
|
|
|
11920
11916
|
} catch {
|
|
11921
11917
|
}
|
|
11922
11918
|
}
|
|
11923
|
-
function rootsMatch2(a, b) {
|
|
11924
|
-
return path40.resolve(a) === path40.resolve(b);
|
|
11925
|
-
}
|
|
11926
11919
|
function classifyMemoraoneDaemonForConnect(proc, opts) {
|
|
11927
11920
|
const newBinding = opts.newRepositoryBindingId.trim();
|
|
11928
11921
|
if (proc.repositoryBindingId && proc.repositoryBindingId === newBinding) {
|
|
@@ -11937,11 +11930,11 @@ function classifyMemoraoneDaemonForConnect(proc, opts) {
|
|
|
11937
11930
|
}
|
|
11938
11931
|
return "preserve";
|
|
11939
11932
|
}
|
|
11940
|
-
function classifyClineHubForConnect(
|
|
11941
|
-
return
|
|
11933
|
+
function classifyClineHubForConnect(_proc, _workspaceRoot) {
|
|
11934
|
+
return "preserve";
|
|
11942
11935
|
}
|
|
11943
11936
|
async function runConnectRuntimeCleanup(options) {
|
|
11944
|
-
const workspaceRoot =
|
|
11937
|
+
const workspaceRoot = path42.resolve(options.workspaceRoot);
|
|
11945
11938
|
const newRepositoryBindingId = options.newRepositoryBindingId.trim();
|
|
11946
11939
|
const replacedBindingIds = new Set(
|
|
11947
11940
|
(options.replacedBindingIds ?? []).map((id) => id.trim()).filter(Boolean)
|
|
@@ -12112,10 +12105,10 @@ async function runConnectRuntimeCleanup(options) {
|
|
|
12112
12105
|
staleRuntimeRemains
|
|
12113
12106
|
};
|
|
12114
12107
|
}
|
|
12115
|
-
var
|
|
12108
|
+
var path42, import_node_child_process6, import_node_util5, fs36, execFileAsync5, CLINE_HUB_DAEMON_MARKER;
|
|
12116
12109
|
var init_connectRuntimeCleanup = __esm({
|
|
12117
12110
|
"src/connectRuntimeCleanup.ts"() {
|
|
12118
|
-
|
|
12111
|
+
path42 = __toESM(require("path"), 1);
|
|
12119
12112
|
import_node_child_process6 = require("child_process");
|
|
12120
12113
|
import_node_util5 = require("util");
|
|
12121
12114
|
fs36 = __toESM(require("fs/promises"), 1);
|
|
@@ -12149,7 +12142,7 @@ function normalizeGitRemote(remoteUrl) {
|
|
|
12149
12142
|
return normalized.toLowerCase() || null;
|
|
12150
12143
|
}
|
|
12151
12144
|
async function detectLegacyM1Warning2(workspaceRoot) {
|
|
12152
|
-
const candidate =
|
|
12145
|
+
const candidate = path43.join(path43.resolve(workspaceRoot), CANONICAL_M1_FILENAME);
|
|
12153
12146
|
try {
|
|
12154
12147
|
await fs37.access(candidate);
|
|
12155
12148
|
return candidate;
|
|
@@ -12166,9 +12159,9 @@ async function rollbackFailedConnect(options) {
|
|
|
12166
12159
|
}
|
|
12167
12160
|
async function runConnectCommand(options) {
|
|
12168
12161
|
const code = normalizeConnectCode(options.code);
|
|
12169
|
-
const cwd2 =
|
|
12162
|
+
const cwd2 = path43.resolve(options.cwd ?? process.cwd());
|
|
12170
12163
|
const apiUrl = (options.apiUrl ?? config2.apiUrl).replace(/\/+$/, "");
|
|
12171
|
-
const homeDir = options.homeDir ??
|
|
12164
|
+
const homeDir = options.homeDir ?? os14.homedir();
|
|
12172
12165
|
const environment = "local";
|
|
12173
12166
|
const verifyLocalBinding = options.verifyLocalBinding ?? resolveLocalBinding;
|
|
12174
12167
|
const executionMode = await resolvePackageExecutionMode({
|
|
@@ -12195,7 +12188,7 @@ async function runConnectCommand(options) {
|
|
|
12195
12188
|
const legacyM1WarningPath = await detectLegacyM1Warning2(cwd2);
|
|
12196
12189
|
if (legacyM1WarningPath) {
|
|
12197
12190
|
process.stderr.write(
|
|
12198
|
-
`[memoraone-mcp] warning: ignoring legacy ${
|
|
12191
|
+
`[memoraone-mcp] warning: ignoring legacy ${path43.basename(legacyM1WarningPath)} at ${legacyM1WarningPath} (credentials and binding are package-managed)
|
|
12199
12192
|
`
|
|
12200
12193
|
);
|
|
12201
12194
|
}
|
|
@@ -12379,6 +12372,8 @@ async function runConnectCommand(options) {
|
|
|
12379
12372
|
cwd: cwd2,
|
|
12380
12373
|
// Use the exact bound workspace root — do not rediscover via .git / .m1.
|
|
12381
12374
|
workspaceRoot: cwd2,
|
|
12375
|
+
repositoryBindingId,
|
|
12376
|
+
replacedRepositoryBindingIds: snapshot.bindingIds,
|
|
12382
12377
|
targets,
|
|
12383
12378
|
force: true,
|
|
12384
12379
|
dryRun: false,
|
|
@@ -12388,8 +12383,6 @@ async function runConnectCommand(options) {
|
|
|
12388
12383
|
homeDir,
|
|
12389
12384
|
// Propagate the redeemed binding API URL (backend only — not execution mode).
|
|
12390
12385
|
apiUrl,
|
|
12391
|
-
// Connect configures every writer; skip Cline when no host IDE is installed.
|
|
12392
|
-
requireClineHosts: false,
|
|
12393
12386
|
...modeSetup,
|
|
12394
12387
|
...options.setupIdeOptions
|
|
12395
12388
|
});
|
|
@@ -12599,12 +12592,12 @@ async function cliConnect(argv, options = {}) {
|
|
|
12599
12592
|
return 1;
|
|
12600
12593
|
}
|
|
12601
12594
|
}
|
|
12602
|
-
var fs37,
|
|
12595
|
+
var fs37, path43, os14;
|
|
12603
12596
|
var init_connectCommand = __esm({
|
|
12604
12597
|
"src/localState/connectCommand.ts"() {
|
|
12605
12598
|
fs37 = __toESM(require("fs/promises"), 1);
|
|
12606
|
-
|
|
12607
|
-
|
|
12599
|
+
path43 = __toESM(require("path"), 1);
|
|
12600
|
+
os14 = __toESM(require("os"), 1);
|
|
12608
12601
|
init_config();
|
|
12609
12602
|
init_projectBinding();
|
|
12610
12603
|
init_packageExecutionMode();
|
|
@@ -12765,8 +12758,8 @@ var init_bridgeClientRoots = __esm({
|
|
|
12765
12758
|
if (this.closed) {
|
|
12766
12759
|
return null;
|
|
12767
12760
|
}
|
|
12768
|
-
return new Promise((
|
|
12769
|
-
this.waiters.push(
|
|
12761
|
+
return new Promise((resolve40) => {
|
|
12762
|
+
this.waiters.push(resolve40);
|
|
12770
12763
|
});
|
|
12771
12764
|
}
|
|
12772
12765
|
/** Re-queue lines read during an intermediate protocol step (e.g. roots/list) for the main bridge loop. */
|
|
@@ -12993,9 +12986,9 @@ function extractJsonRpcId(line) {
|
|
|
12993
12986
|
}
|
|
12994
12987
|
}
|
|
12995
12988
|
function connectWithRetry(socketPath, log, maxRetries, retryDelayMs, connect2) {
|
|
12996
|
-
return new Promise((
|
|
12989
|
+
return new Promise((resolve40, reject) => {
|
|
12997
12990
|
const tryConnect = (attempt) => {
|
|
12998
|
-
connect2(socketPath).then(
|
|
12991
|
+
connect2(socketPath).then(resolve40).catch((err) => {
|
|
12999
12992
|
if (attempt >= maxRetries) {
|
|
13000
12993
|
reject(err);
|
|
13001
12994
|
return;
|
|
@@ -13191,8 +13184,8 @@ var init_bridgeProxy = __esm({
|
|
|
13191
13184
|
this.maxRetries = options.maxRetries ?? 5;
|
|
13192
13185
|
this.retryDelayMs = options.retryDelayMs ?? 200;
|
|
13193
13186
|
this.lineReader = options.lineReader ?? null;
|
|
13194
|
-
this.connectImpl = options.connect ?? ((socketPath) => new Promise((
|
|
13195
|
-
const socket = net.connect(socketPath, () =>
|
|
13187
|
+
this.connectImpl = options.connect ?? ((socketPath) => new Promise((resolve40, reject) => {
|
|
13188
|
+
const socket = net.connect(socketPath, () => resolve40(socket));
|
|
13196
13189
|
socket.on("error", reject);
|
|
13197
13190
|
}));
|
|
13198
13191
|
this.spawnDaemonImpl = options.spawnDaemon ?? (async (binding) => {
|
|
@@ -13324,7 +13317,7 @@ var init_bridgeProxy = __esm({
|
|
|
13324
13317
|
}
|
|
13325
13318
|
waitForDaemonJsonRpcResponse(id, timeoutMs = 3e4) {
|
|
13326
13319
|
const key = this.waiterKey(id);
|
|
13327
|
-
return new Promise((
|
|
13320
|
+
return new Promise((resolve40, reject) => {
|
|
13328
13321
|
const timer = setTimeout(() => {
|
|
13329
13322
|
this.pendingDaemonResponseWaiters.delete(key);
|
|
13330
13323
|
reject(
|
|
@@ -13333,7 +13326,7 @@ var init_bridgeProxy = __esm({
|
|
|
13333
13326
|
)
|
|
13334
13327
|
);
|
|
13335
13328
|
}, timeoutMs);
|
|
13336
|
-
this.pendingDaemonResponseWaiters.set(key, { resolve:
|
|
13329
|
+
this.pendingDaemonResponseWaiters.set(key, { resolve: resolve40, reject, timer });
|
|
13337
13330
|
});
|
|
13338
13331
|
}
|
|
13339
13332
|
notifyDaemonResponseWaiters(line) {
|