@memoraone/mcp 0.1.40 → 0.1.42
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 +605 -621
- package/dist/daemon.cjs +58 -6
- package/dist/index.cjs +58 -6
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -231,7 +231,7 @@ 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.42",
|
|
235
235
|
type: "module",
|
|
236
236
|
main: "dist/index.cjs",
|
|
237
237
|
bin: {
|
|
@@ -524,7 +524,7 @@ async function acquireLocalLock(lockName, options = {}) {
|
|
|
524
524
|
`[memoraone-mcp] Failed to acquire lock ${lockName} after ${maxRetries} retries`
|
|
525
525
|
);
|
|
526
526
|
}
|
|
527
|
-
await new Promise((
|
|
527
|
+
await new Promise((resolve39) => setTimeout(resolve39, retryDelayMs));
|
|
528
528
|
continue;
|
|
529
529
|
}
|
|
530
530
|
throw err;
|
|
@@ -1085,9 +1085,9 @@ var init_memoraClient = __esm({
|
|
|
1085
1085
|
});
|
|
1086
1086
|
|
|
1087
1087
|
// src/localState/localConnectClient.ts
|
|
1088
|
-
async function requestJson(baseUrl, method,
|
|
1088
|
+
async function requestJson(baseUrl, method, path43, options = {}) {
|
|
1089
1089
|
const fetchImpl = options.fetchImpl ?? fetch;
|
|
1090
|
-
const url = `${baseUrl.replace(/\/+$/, "")}${
|
|
1090
|
+
const url = `${baseUrl.replace(/\/+$/, "")}${path43.startsWith("/") ? path43 : `/${path43}`}`;
|
|
1091
1091
|
const res = await fetchImpl(url, {
|
|
1092
1092
|
method,
|
|
1093
1093
|
headers: {
|
|
@@ -1421,9 +1421,9 @@ function bindingRelevantValuesMatch(a, b) {
|
|
|
1421
1421
|
const envB = b.environment ?? void 0;
|
|
1422
1422
|
return a.repositoryBindingId === b.repositoryBindingId && a.projectId.trim().toLowerCase() === b.projectId.trim().toLowerCase() && path9.resolve(a.workspaceRoot) === path9.resolve(b.workspaceRoot) && (a.installationPublicId ?? void 0) === (b.installationPublicId ?? void 0) && envA === envB && a.status === b.status;
|
|
1423
1423
|
}
|
|
1424
|
-
async function reconcileResolvedBindingWithDisk(cached) {
|
|
1424
|
+
async function reconcileResolvedBindingWithDisk(cached, options = {}) {
|
|
1425
1425
|
const repositoryBindingId = assertRepositoryBindingId(cached.repositoryBindingId);
|
|
1426
|
-
const record = await readBindingRecord(repositoryBindingId);
|
|
1426
|
+
const record = await readBindingRecord(repositoryBindingId, options.homeDir);
|
|
1427
1427
|
if (!record) {
|
|
1428
1428
|
throw new ReconnectRequiredError(
|
|
1429
1429
|
`[memoraone-mcp] Cached binding missing for ${repositoryBindingId}. Run: memoraone-mcp connect <code>`
|
|
@@ -2005,7 +2005,14 @@ function normalizeMemoraoneServerName(name) {
|
|
|
2005
2005
|
}
|
|
2006
2006
|
function isMemoraoneOwnedServerName(name) {
|
|
2007
2007
|
if (typeof name !== "string" || name.trim() === "") return false;
|
|
2008
|
-
|
|
2008
|
+
const trimmed = name.trim();
|
|
2009
|
+
return OWNED_NAME_NORMALIZED.has(normalizeMemoraoneServerName(trimmed)) || REPOSITORY_SERVER_KEY_RE.test(trimmed);
|
|
2010
|
+
}
|
|
2011
|
+
function memoraoneServerNameForRepositoryBinding(repositoryBindingId) {
|
|
2012
|
+
const id = repositoryBindingId.trim();
|
|
2013
|
+
if (id === "") throw new Error("repository_binding_id is required for global MCP ownership");
|
|
2014
|
+
const suffix = (0, import_node_crypto4.createHash)("sha256").update(id, "utf8").digest("hex").slice(0, 16);
|
|
2015
|
+
return `${MEMORAONE_REPOSITORY_SERVER_NAME_PREFIX}${suffix}`;
|
|
2009
2016
|
}
|
|
2010
2017
|
function collectCommandTokens(entry) {
|
|
2011
2018
|
const tokens = [];
|
|
@@ -2032,6 +2039,12 @@ function envRecordFromEntry(entry) {
|
|
|
2032
2039
|
}
|
|
2033
2040
|
return null;
|
|
2034
2041
|
}
|
|
2042
|
+
function memoraoneWorkspaceRootFromServerEntry(entry) {
|
|
2043
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry)) return void 0;
|
|
2044
|
+
const env2 = envRecordFromEntry(entry);
|
|
2045
|
+
const root = env2?.MEMORAONE_WORKSPACE_ROOT;
|
|
2046
|
+
return typeof root === "string" && root.trim() !== "" ? path14.resolve(root) : void 0;
|
|
2047
|
+
}
|
|
2035
2048
|
function tokensInvokeMemoraone(tokens) {
|
|
2036
2049
|
for (const token of tokens) {
|
|
2037
2050
|
if (MEMORAONE_PACKAGE_SPEC_RE.test(token)) return true;
|
|
@@ -2052,6 +2065,17 @@ function envLooksMemoraoneOwned(env2) {
|
|
|
2052
2065
|
if (typeof env2.MEMORAONE_API_KEY === "string") return true;
|
|
2053
2066
|
return false;
|
|
2054
2067
|
}
|
|
2068
|
+
function entryContainsLegacyCredentialFields(entry) {
|
|
2069
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry)) return false;
|
|
2070
|
+
const value = entry;
|
|
2071
|
+
const env2 = envRecordFromEntry(value);
|
|
2072
|
+
if (env2 && ("MEMORAONE_API_KEY" in env2 || "MEMORAONE_M1_PATH" in env2)) return true;
|
|
2073
|
+
if (value.headers && typeof value.headers === "object" && !Array.isArray(value.headers)) {
|
|
2074
|
+
const headers = value.headers;
|
|
2075
|
+
return Object.keys(headers).some((key) => key.toLowerCase() === "authorization");
|
|
2076
|
+
}
|
|
2077
|
+
return false;
|
|
2078
|
+
}
|
|
2055
2079
|
function isMemoraoneOwnedServerEntry(entry) {
|
|
2056
2080
|
if (!entry || typeof entry !== "object" || Array.isArray(entry)) return false;
|
|
2057
2081
|
const s = entry;
|
|
@@ -2084,6 +2108,55 @@ function replaceMemoraoneOwnedInServerMap(servers, canonical) {
|
|
|
2084
2108
|
next[CANONICAL_MEMORAONE_MCP_SERVER_NAME] = canonical;
|
|
2085
2109
|
return next;
|
|
2086
2110
|
}
|
|
2111
|
+
function replaceMemoraoneRepositoryBindingInServerMap(servers, canonical, ownership) {
|
|
2112
|
+
const generatedTargetKey = memoraoneServerNameForRepositoryBinding(
|
|
2113
|
+
ownership.repositoryBindingId
|
|
2114
|
+
);
|
|
2115
|
+
const targetRoot = path14.resolve(ownership.workspaceRoot);
|
|
2116
|
+
const matchingRootKeys = Object.entries(servers).filter(
|
|
2117
|
+
([key, value]) => REPOSITORY_SERVER_KEY_RE.test(key) && memoraoneWorkspaceRootFromServerEntry(value) === targetRoot
|
|
2118
|
+
).map(([key]) => key).sort();
|
|
2119
|
+
const targetKey = matchingRootKeys.includes(generatedTargetKey) ? generatedTargetKey : matchingRootKeys[0] ?? generatedTargetKey;
|
|
2120
|
+
const staleKeys = new Set(
|
|
2121
|
+
(ownership.replacedRepositoryBindingIds ?? []).map(memoraoneServerNameForRepositoryBinding)
|
|
2122
|
+
);
|
|
2123
|
+
staleKeys.add(generatedTargetKey);
|
|
2124
|
+
staleKeys.delete(targetKey);
|
|
2125
|
+
const next = {};
|
|
2126
|
+
for (const [key, value] of Object.entries(servers)) {
|
|
2127
|
+
if (staleKeys.has(key)) continue;
|
|
2128
|
+
if (matchingRootKeys.includes(key)) continue;
|
|
2129
|
+
if (isMemoraoneOwnedServerName(key) && !REPOSITORY_SERVER_KEY_RE.test(key) && entryContainsLegacyCredentialFields(value)) {
|
|
2130
|
+
continue;
|
|
2131
|
+
}
|
|
2132
|
+
if (isMemoraoneOwnedServerName(key) && !REPOSITORY_SERVER_KEY_RE.test(key) && memoraoneWorkspaceRootFromServerEntry(value) === targetRoot) {
|
|
2133
|
+
continue;
|
|
2134
|
+
}
|
|
2135
|
+
next[key] = value;
|
|
2136
|
+
}
|
|
2137
|
+
next[targetKey] = canonical;
|
|
2138
|
+
return next;
|
|
2139
|
+
}
|
|
2140
|
+
function stripMemoraoneRepositoryBindingFromServerMap(servers, ownership) {
|
|
2141
|
+
const keys = /* @__PURE__ */ new Set([
|
|
2142
|
+
memoraoneServerNameForRepositoryBinding(ownership.repositoryBindingId),
|
|
2143
|
+
...(ownership.replacedRepositoryBindingIds ?? []).map(
|
|
2144
|
+
memoraoneServerNameForRepositoryBinding
|
|
2145
|
+
)
|
|
2146
|
+
]);
|
|
2147
|
+
const targetRoot = path14.resolve(ownership.workspaceRoot);
|
|
2148
|
+
const next = {};
|
|
2149
|
+
const removedKeys = [];
|
|
2150
|
+
for (const [key, value] of Object.entries(servers)) {
|
|
2151
|
+
const matchingWorkspace = isMemoraoneOwnedServerName(key) && memoraoneWorkspaceRootFromServerEntry(value) === targetRoot;
|
|
2152
|
+
if (keys.has(key) || matchingWorkspace) {
|
|
2153
|
+
removedKeys.push(key);
|
|
2154
|
+
} else {
|
|
2155
|
+
next[key] = value;
|
|
2156
|
+
}
|
|
2157
|
+
}
|
|
2158
|
+
return { next, removedKeys };
|
|
2159
|
+
}
|
|
2087
2160
|
function stripMemoraoneOwnedFromServerList(servers) {
|
|
2088
2161
|
const next = [];
|
|
2089
2162
|
let removedCount = 0;
|
|
@@ -2122,10 +2195,14 @@ function canonicalValueMatches(actual, expected) {
|
|
|
2122
2195
|
}
|
|
2123
2196
|
return false;
|
|
2124
2197
|
}
|
|
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;
|
|
2198
|
+
var import_node_crypto4, path14, 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
2199
|
var init_memoraoneMcpOwnership = __esm({
|
|
2127
2200
|
"src/memoraoneMcpOwnership.ts"() {
|
|
2201
|
+
import_node_crypto4 = require("crypto");
|
|
2202
|
+
path14 = __toESM(require("path"), 1);
|
|
2128
2203
|
CANONICAL_MEMORAONE_MCP_SERVER_NAME = "memoraone";
|
|
2204
|
+
MEMORAONE_REPOSITORY_SERVER_NAME_PREFIX = "memoraone-";
|
|
2205
|
+
REPOSITORY_SERVER_KEY_RE = /^memoraone-[0-9a-f]{16}$/;
|
|
2129
2206
|
LEGACY_MEMORAONE_SERVER_NAME_ALIASES = [
|
|
2130
2207
|
"memoraone",
|
|
2131
2208
|
"memora-one",
|
|
@@ -2168,7 +2245,7 @@ function buildMemoraoneCursorMcpServer(options) {
|
|
|
2168
2245
|
env2.MEMORAONE_IDE_TYPE = ideType;
|
|
2169
2246
|
}
|
|
2170
2247
|
if (options.workspaceRoot !== void 0) {
|
|
2171
|
-
env2[MEMORAONE_WORKSPACE_ROOT_ENV] =
|
|
2248
|
+
env2[MEMORAONE_WORKSPACE_ROOT_ENV] = path15.resolve(options.workspaceRoot);
|
|
2172
2249
|
}
|
|
2173
2250
|
if (options.environment === "local") {
|
|
2174
2251
|
if (!options.cliPath) {
|
|
@@ -2204,7 +2281,7 @@ function stripLeadingLineComments(text) {
|
|
|
2204
2281
|
return text.split("\n").filter((line) => !/^\s*\/\//.test(line)).join("\n");
|
|
2205
2282
|
}
|
|
2206
2283
|
function getKnownCursorGlobalMcpConfigCandidates(homeDir) {
|
|
2207
|
-
return [
|
|
2284
|
+
return [path15.join(homeDir, ".cursor", "mcp.json")];
|
|
2208
2285
|
}
|
|
2209
2286
|
async function detectCursorGlobalMcpConfig(options) {
|
|
2210
2287
|
if (options?.explicitPath) {
|
|
@@ -2267,7 +2344,7 @@ async function resolveNpxPath() {
|
|
|
2267
2344
|
const pathSep = process.platform === "win32" ? ";" : ":";
|
|
2268
2345
|
for (const dir of (process.env.PATH ?? "").split(pathSep)) {
|
|
2269
2346
|
if (!dir) continue;
|
|
2270
|
-
candidates.push(
|
|
2347
|
+
candidates.push(path15.join(dir, npxName));
|
|
2271
2348
|
}
|
|
2272
2349
|
try {
|
|
2273
2350
|
const lookupCmd = process.platform === "win32" ? "where" : "which";
|
|
@@ -2278,7 +2355,7 @@ async function resolveNpxPath() {
|
|
|
2278
2355
|
}
|
|
2279
2356
|
const seen = /* @__PURE__ */ new Set();
|
|
2280
2357
|
for (const candidate of candidates) {
|
|
2281
|
-
const abs =
|
|
2358
|
+
const abs = path15.isAbsolute(candidate) ? candidate : path15.resolve(candidate);
|
|
2282
2359
|
const key = process.platform === "win32" ? abs.toLowerCase() : abs;
|
|
2283
2360
|
if (seen.has(key)) continue;
|
|
2284
2361
|
seen.add(key);
|
|
@@ -2338,7 +2415,7 @@ function mergeClaudeCodeMcpConfigObject(existing, writeOptions) {
|
|
|
2338
2415
|
};
|
|
2339
2416
|
}
|
|
2340
2417
|
function getClaudeCodeMcpConfigPath(repoRoot) {
|
|
2341
|
-
return
|
|
2418
|
+
return path15.join(path15.resolve(repoRoot), ".mcp.json");
|
|
2342
2419
|
}
|
|
2343
2420
|
function isMemoraoneManagedApiUrl(url) {
|
|
2344
2421
|
if (typeof url !== "string" || url.length === 0) return false;
|
|
@@ -2387,7 +2464,7 @@ function memoraoneServerMatches(server, matchOptions) {
|
|
|
2387
2464
|
if (e.MEMORAONE_IDE_TYPE !== "cursor") return false;
|
|
2388
2465
|
const workspaceRoot = e[MEMORAONE_WORKSPACE_ROOT_ENV];
|
|
2389
2466
|
if (matchOptions.repoRoot !== void 0) {
|
|
2390
|
-
return typeof workspaceRoot === "string" &&
|
|
2467
|
+
return typeof workspaceRoot === "string" && path15.resolve(workspaceRoot) === path15.resolve(matchOptions.repoRoot);
|
|
2391
2468
|
}
|
|
2392
2469
|
return workspaceRoot === void 0;
|
|
2393
2470
|
}
|
|
@@ -2422,7 +2499,7 @@ function validateCursorRepoMcpConfig(parsed2, matchOptions) {
|
|
|
2422
2499
|
}
|
|
2423
2500
|
}
|
|
2424
2501
|
function getCursorRepoMcpConfigPath(repoRoot) {
|
|
2425
|
-
return
|
|
2502
|
+
return path15.join(repoRoot, ".cursor", "mcp.json");
|
|
2426
2503
|
}
|
|
2427
2504
|
async function readCursorMcpConfigObject(configPath) {
|
|
2428
2505
|
try {
|
|
@@ -2453,12 +2530,12 @@ async function removeMemoraoneFromCursorGlobalConfig(options) {
|
|
|
2453
2530
|
return { changed: true, backupPath };
|
|
2454
2531
|
}
|
|
2455
2532
|
const next = { ...parsed2, mcpServers };
|
|
2456
|
-
await fs10.mkdir(
|
|
2533
|
+
await fs10.mkdir(path15.dirname(configPath), { recursive: true });
|
|
2457
2534
|
await fs10.writeFile(configPath, JSON.stringify(next, null, 2) + "\n", "utf8");
|
|
2458
2535
|
return { changed: true, backupPath };
|
|
2459
2536
|
}
|
|
2460
2537
|
async function auditCursorMcpConfig(options) {
|
|
2461
|
-
const repoRoot =
|
|
2538
|
+
const repoRoot = path15.resolve(options?.repoRoot ?? process.cwd());
|
|
2462
2539
|
const repoConfigPath = getCursorRepoMcpConfigPath(repoRoot);
|
|
2463
2540
|
const globalDetection = await detectCursorGlobalMcpConfig({
|
|
2464
2541
|
homeDir: options?.homeDir,
|
|
@@ -2560,12 +2637,12 @@ function logCursorMcpCliSummary(info, dryRun, opts) {
|
|
|
2560
2637
|
);
|
|
2561
2638
|
}
|
|
2562
2639
|
}
|
|
2563
|
-
var fs10, os4,
|
|
2640
|
+
var fs10, os4, path15, 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
2641
|
var init_cursorGlobalMcpConfig = __esm({
|
|
2565
2642
|
"src/cursorGlobalMcpConfig.ts"() {
|
|
2566
2643
|
fs10 = __toESM(require("fs/promises"), 1);
|
|
2567
2644
|
os4 = __toESM(require("os"), 1);
|
|
2568
|
-
|
|
2645
|
+
path15 = __toESM(require("path"), 1);
|
|
2569
2646
|
import_node_child_process2 = require("child_process");
|
|
2570
2647
|
import_node_util2 = require("util");
|
|
2571
2648
|
init_initializeBinding();
|
|
@@ -2791,7 +2868,7 @@ async function defaultListSocketPaths(projectId) {
|
|
|
2791
2868
|
if (!name.endsWith(".sock") || !isMemoraoneSocketFilename(name)) {
|
|
2792
2869
|
continue;
|
|
2793
2870
|
}
|
|
2794
|
-
const socketPath =
|
|
2871
|
+
const socketPath = path16.join(baseDir, name);
|
|
2795
2872
|
if (projectId === null) {
|
|
2796
2873
|
paths.push(socketPath);
|
|
2797
2874
|
continue;
|
|
@@ -2811,7 +2888,7 @@ async function defaultListSocketPaths(projectId) {
|
|
|
2811
2888
|
return paths.sort();
|
|
2812
2889
|
}
|
|
2813
2890
|
async function defaultListSocketPathsForWorkspaceRoot(workspaceRoot) {
|
|
2814
|
-
const resolvedRoot =
|
|
2891
|
+
const resolvedRoot = path16.resolve(workspaceRoot);
|
|
2815
2892
|
const baseDir = getMcpBaseDir();
|
|
2816
2893
|
let entries;
|
|
2817
2894
|
try {
|
|
@@ -2828,25 +2905,25 @@ async function defaultListSocketPathsForWorkspaceRoot(workspaceRoot) {
|
|
|
2828
2905
|
if (!name.endsWith(".sock") || !isHashSocketFilename(name)) {
|
|
2829
2906
|
continue;
|
|
2830
2907
|
}
|
|
2831
|
-
const socketPath =
|
|
2908
|
+
const socketPath = path16.join(baseDir, name);
|
|
2832
2909
|
const record = readBindingSidecarRecord(socketPath);
|
|
2833
2910
|
if (!record?.workspaceRoot) continue;
|
|
2834
|
-
if (
|
|
2911
|
+
if (path16.resolve(record.workspaceRoot) === resolvedRoot) {
|
|
2835
2912
|
paths.push(socketPath);
|
|
2836
2913
|
}
|
|
2837
2914
|
}
|
|
2838
2915
|
return paths.sort();
|
|
2839
2916
|
}
|
|
2840
2917
|
async function defaultListSocketPathsForM1Path(m1Path) {
|
|
2841
|
-
return defaultListSocketPathsForWorkspaceRoot(
|
|
2918
|
+
return defaultListSocketPathsForWorkspaceRoot(path16.dirname(path16.resolve(m1Path)));
|
|
2842
2919
|
}
|
|
2843
2920
|
async function filterSocketPathsByIdeForCleanup(socketPaths, projectId, ide, workspaceRoot) {
|
|
2844
2921
|
if (ide === void 0) return socketPaths;
|
|
2845
2922
|
const normalizedProjectId = projectId.trim().toLowerCase();
|
|
2846
|
-
const resolvedRoot = workspaceRoot ?
|
|
2923
|
+
const resolvedRoot = workspaceRoot ? path16.resolve(workspaceRoot) : null;
|
|
2847
2924
|
const filtered = [];
|
|
2848
2925
|
for (const socketPath of socketPaths) {
|
|
2849
|
-
const basename30 =
|
|
2926
|
+
const basename30 = path16.basename(socketPath);
|
|
2850
2927
|
if (isLegacySocketFilename(basename30)) {
|
|
2851
2928
|
if (isSocketFilenameForProjectAndIde(basename30, normalizedProjectId, ide)) {
|
|
2852
2929
|
filtered.push(socketPath);
|
|
@@ -2857,7 +2934,7 @@ async function filterSocketPathsByIdeForCleanup(socketPaths, projectId, ide, wor
|
|
|
2857
2934
|
const record = readBindingSidecarRecord(socketPath);
|
|
2858
2935
|
if (!record || record.ideType !== ide) continue;
|
|
2859
2936
|
const sameProject = record.projectId.trim().toLowerCase() === normalizedProjectId;
|
|
2860
|
-
const sameWorkspace = resolvedRoot !== null &&
|
|
2937
|
+
const sameWorkspace = resolvedRoot !== null && path16.resolve(record.workspaceRoot) === resolvedRoot;
|
|
2861
2938
|
if (sameProject || sameWorkspace) {
|
|
2862
2939
|
filtered.push(socketPath);
|
|
2863
2940
|
}
|
|
@@ -2889,7 +2966,7 @@ async function defaultConfirm(message) {
|
|
|
2889
2966
|
}
|
|
2890
2967
|
async function resolveCleanupTarget(cwd2) {
|
|
2891
2968
|
try {
|
|
2892
|
-
const binding = await resolveAuthoritativeBinding([
|
|
2969
|
+
const binding = await resolveAuthoritativeBinding([path16.resolve(cwd2)]);
|
|
2893
2970
|
return {
|
|
2894
2971
|
workspaceRoot: binding.workspaceRoot,
|
|
2895
2972
|
repositoryBindingId: binding.repositoryBindingId,
|
|
@@ -3085,7 +3162,7 @@ async function runCleanup(opts) {
|
|
|
3085
3162
|
projectIds.add(proc.projectId);
|
|
3086
3163
|
}
|
|
3087
3164
|
for (const socketPath of socketPaths) {
|
|
3088
|
-
const id = extractProjectIdFromSocketFilename(
|
|
3165
|
+
const id = extractProjectIdFromSocketFilename(path16.basename(socketPath));
|
|
3089
3166
|
if (id) {
|
|
3090
3167
|
projectIds.add(id);
|
|
3091
3168
|
continue;
|
|
@@ -3268,11 +3345,11 @@ async function cliCleanup(argv) {
|
|
|
3268
3345
|
}
|
|
3269
3346
|
return result.exitCode;
|
|
3270
3347
|
}
|
|
3271
|
-
var fs11,
|
|
3348
|
+
var fs11, path16, 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
3349
|
var init_cleanup = __esm({
|
|
3273
3350
|
"src/cleanup.ts"() {
|
|
3274
3351
|
fs11 = __toESM(require("fs/promises"), 1);
|
|
3275
|
-
|
|
3352
|
+
path16 = __toESM(require("path"), 1);
|
|
3276
3353
|
readline = __toESM(require("readline/promises"), 1);
|
|
3277
3354
|
import_node_child_process3 = require("child_process");
|
|
3278
3355
|
import_node_util3 = require("util");
|
|
@@ -3314,17 +3391,17 @@ var init_configUtils = __esm({
|
|
|
3314
3391
|
});
|
|
3315
3392
|
|
|
3316
3393
|
// src/config.ts
|
|
3317
|
-
var process2, fs12,
|
|
3394
|
+
var process2, fs12, path17, dotenv, import_v4, dotenvPath, EnvSchema, requiredEnvVars, missingEnvVars, parsed, resolvedApiUrl, parseBooleanFlag2, config2;
|
|
3318
3395
|
var init_config = __esm({
|
|
3319
3396
|
"src/config.ts"() {
|
|
3320
3397
|
process2 = __toESM(require("process"), 1);
|
|
3321
3398
|
fs12 = __toESM(require("fs"), 1);
|
|
3322
|
-
|
|
3399
|
+
path17 = __toESM(require("path"), 1);
|
|
3323
3400
|
dotenv = __toESM(require("dotenv"), 1);
|
|
3324
3401
|
import_v4 = require("zod/v4");
|
|
3325
3402
|
init_configUtils();
|
|
3326
3403
|
init_socketPaths();
|
|
3327
|
-
dotenvPath =
|
|
3404
|
+
dotenvPath = path17.resolve(process2.cwd(), ".env");
|
|
3328
3405
|
if (fs12.existsSync(dotenvPath)) {
|
|
3329
3406
|
try {
|
|
3330
3407
|
dotenv.config({ path: dotenvPath });
|
|
@@ -3399,7 +3476,7 @@ var init_config = __esm({
|
|
|
3399
3476
|
function resolveRepoFingerprint(cwd2) {
|
|
3400
3477
|
const found = findGitRoot(cwd2);
|
|
3401
3478
|
if (!found) {
|
|
3402
|
-
const fallbackPath =
|
|
3479
|
+
const fallbackPath = path18.resolve(cwd2);
|
|
3403
3480
|
const fingerprint2 = sha256(fallbackPath);
|
|
3404
3481
|
debugLog(`repo fingerprint=${fingerprint2} source=path-fallback`);
|
|
3405
3482
|
return {
|
|
@@ -3421,7 +3498,7 @@ function resolveRepoFingerprint(cwd2) {
|
|
|
3421
3498
|
source: "git-remote"
|
|
3422
3499
|
};
|
|
3423
3500
|
}
|
|
3424
|
-
const fingerprint = sha256(
|
|
3501
|
+
const fingerprint = sha256(path18.resolve(gitRoot));
|
|
3425
3502
|
debugLog(`repo fingerprint=${fingerprint} source=path-fallback`);
|
|
3426
3503
|
return {
|
|
3427
3504
|
fingerprint,
|
|
@@ -3429,11 +3506,11 @@ function resolveRepoFingerprint(cwd2) {
|
|
|
3429
3506
|
source: "path-fallback"
|
|
3430
3507
|
};
|
|
3431
3508
|
}
|
|
3432
|
-
var fs13,
|
|
3509
|
+
var fs13, path18, crypto2, parseBooleanFlag3, debugEnabled2, debugLog, normalizeRemoteUrl, sha256, resolveGitDir, findGitRoot, readOriginRemote;
|
|
3433
3510
|
var init_repoFingerprint = __esm({
|
|
3434
3511
|
"src/repoFingerprint.ts"() {
|
|
3435
3512
|
fs13 = __toESM(require("fs"), 1);
|
|
3436
|
-
|
|
3513
|
+
path18 = __toESM(require("path"), 1);
|
|
3437
3514
|
crypto2 = __toESM(require("crypto"), 1);
|
|
3438
3515
|
parseBooleanFlag3 = (value) => {
|
|
3439
3516
|
if (!value) {
|
|
@@ -3472,7 +3549,7 @@ var init_repoFingerprint = __esm({
|
|
|
3472
3549
|
const match = content.match(/^gitdir:\s*(.+)$/m);
|
|
3473
3550
|
if (match) {
|
|
3474
3551
|
const gitDir = match[1].trim();
|
|
3475
|
-
return
|
|
3552
|
+
return path18.resolve(path18.dirname(gitPath), gitDir);
|
|
3476
3553
|
}
|
|
3477
3554
|
}
|
|
3478
3555
|
} catch {
|
|
@@ -3481,16 +3558,16 @@ var init_repoFingerprint = __esm({
|
|
|
3481
3558
|
return null;
|
|
3482
3559
|
};
|
|
3483
3560
|
findGitRoot = (start) => {
|
|
3484
|
-
let current =
|
|
3561
|
+
let current = path18.resolve(start);
|
|
3485
3562
|
while (true) {
|
|
3486
|
-
const gitPath =
|
|
3563
|
+
const gitPath = path18.join(current, ".git");
|
|
3487
3564
|
if (fs13.existsSync(gitPath)) {
|
|
3488
3565
|
const gitDir = resolveGitDir(gitPath);
|
|
3489
3566
|
if (gitDir) {
|
|
3490
3567
|
return { gitRoot: current, gitDir };
|
|
3491
3568
|
}
|
|
3492
3569
|
}
|
|
3493
|
-
const parent =
|
|
3570
|
+
const parent = path18.dirname(current);
|
|
3494
3571
|
if (parent === current) {
|
|
3495
3572
|
break;
|
|
3496
3573
|
}
|
|
@@ -3499,7 +3576,7 @@ var init_repoFingerprint = __esm({
|
|
|
3499
3576
|
return null;
|
|
3500
3577
|
};
|
|
3501
3578
|
readOriginRemote = (gitDir) => {
|
|
3502
|
-
const configPath =
|
|
3579
|
+
const configPath = path18.join(gitDir, "config");
|
|
3503
3580
|
try {
|
|
3504
3581
|
const content = fs13.readFileSync(configPath, "utf8");
|
|
3505
3582
|
const lines = content.split(/\r?\n/);
|
|
@@ -3542,12 +3619,12 @@ function formatJetBrainsBackupTimestamp(d = /* @__PURE__ */ new Date()) {
|
|
|
3542
3619
|
return `${d.getFullYear()}${pad(d.getMonth() + 1)}${pad(d.getDate())}-${pad(d.getHours())}${pad(d.getMinutes())}${pad(d.getSeconds())}`;
|
|
3543
3620
|
}
|
|
3544
3621
|
function getJetBrainsGlobalMcpConfigPath(homeDir) {
|
|
3545
|
-
return
|
|
3622
|
+
return path19.join(homeDir, ".ai", "mcp", "mcp.json");
|
|
3546
3623
|
}
|
|
3547
3624
|
function getJetBrainsProjectMcpConfigPaths(repoRoot) {
|
|
3548
3625
|
return [
|
|
3549
|
-
{ kind: "project-ai", path:
|
|
3550
|
-
{ kind: "project-ij", path:
|
|
3626
|
+
{ kind: "project-ai", path: path19.join(repoRoot, ".ai", "mcp", "mcp.json") },
|
|
3627
|
+
{ kind: "project-ij", path: path19.join(repoRoot, ".ij", "mcp", "mcp.json") }
|
|
3551
3628
|
];
|
|
3552
3629
|
}
|
|
3553
3630
|
function getKnownJetBrainsMcpConfigLocations(homeDir, repoRoot) {
|
|
@@ -3582,7 +3659,7 @@ function buildMemoraoneJetBrainsMcpServer(options) {
|
|
|
3582
3659
|
apiUrl: options.apiUrl ?? (environment === "local" ? DEV_API_URL : void 0)
|
|
3583
3660
|
}),
|
|
3584
3661
|
MEMORAONE_IDE_TYPE: "jetbrains",
|
|
3585
|
-
[MEMORAONE_WORKSPACE_ROOT_ENV]:
|
|
3662
|
+
[MEMORAONE_WORKSPACE_ROOT_ENV]: path19.resolve(options.workspaceRoot)
|
|
3586
3663
|
};
|
|
3587
3664
|
if (environment === "local" || options.devMode) {
|
|
3588
3665
|
env2.MEMORAONE_DEV_MODE = "1";
|
|
@@ -3596,17 +3673,17 @@ function buildMemoraoneJetBrainsMcpServer(options) {
|
|
|
3596
3673
|
env: env2
|
|
3597
3674
|
};
|
|
3598
3675
|
}
|
|
3599
|
-
function mergeJetBrainsMcpConfigObject(existing, memoraone) {
|
|
3676
|
+
function mergeJetBrainsMcpConfigObject(existing, memoraone, ownership) {
|
|
3600
3677
|
const base = existing && typeof existing === "object" ? { ...existing } : { mcpServers: {} };
|
|
3601
3678
|
const mcpServers = typeof base.mcpServers === "object" && base.mcpServers !== null && !Array.isArray(base.mcpServers) ? { ...base.mcpServers } : {};
|
|
3602
|
-
return { ...base, mcpServers: replaceMemoraoneOwnedInServerMap(mcpServers, memoraone) };
|
|
3679
|
+
return { ...base, mcpServers: ownership ? replaceMemoraoneRepositoryBindingInServerMap(mcpServers, memoraone, ownership) : replaceMemoraoneOwnedInServerMap(mcpServers, memoraone) };
|
|
3603
3680
|
}
|
|
3604
3681
|
async function writeJetBrainsMcpJsonAtomic(filePath, content) {
|
|
3605
|
-
const dir =
|
|
3682
|
+
const dir = path19.dirname(filePath);
|
|
3606
3683
|
await fs14.mkdir(dir, { recursive: true });
|
|
3607
|
-
const tmpPath =
|
|
3684
|
+
const tmpPath = path19.join(
|
|
3608
3685
|
dir,
|
|
3609
|
-
`.${
|
|
3686
|
+
`.${path19.basename(filePath)}.${process.pid}.${(0, import_node_crypto5.randomBytes)(8).toString("hex")}.tmp`
|
|
3610
3687
|
);
|
|
3611
3688
|
try {
|
|
3612
3689
|
await fs14.writeFile(tmpPath, content, "utf8");
|
|
@@ -3622,7 +3699,7 @@ async function writeJetBrainsMcpJsonAtomic(filePath, content) {
|
|
|
3622
3699
|
function memoraoneServerMatches2(server, expected) {
|
|
3623
3700
|
return canonicalValueMatches(server, expected);
|
|
3624
3701
|
}
|
|
3625
|
-
function validateJetBrainsMcpConfig(parsed2, expected) {
|
|
3702
|
+
function validateJetBrainsMcpConfig(parsed2, expected, serverName = CANONICAL_MEMORAONE_MCP_SERVER_NAME) {
|
|
3626
3703
|
if (!parsed2 || typeof parsed2 !== "object") {
|
|
3627
3704
|
throw new Error("[setup-ide-files] JetBrains MCP config must be a JSON object.");
|
|
3628
3705
|
}
|
|
@@ -3630,7 +3707,8 @@ function validateJetBrainsMcpConfig(parsed2, expected) {
|
|
|
3630
3707
|
if (!mcpServers || typeof mcpServers !== "object" || Array.isArray(mcpServers)) {
|
|
3631
3708
|
throw new Error("[setup-ide-files] JetBrains MCP config missing mcpServers object.");
|
|
3632
3709
|
}
|
|
3633
|
-
const
|
|
3710
|
+
const serverMap = mcpServers;
|
|
3711
|
+
const memoraone = serverMap[serverName] ?? Object.values(serverMap).find((entry) => memoraoneServerMatches2(entry, expected));
|
|
3634
3712
|
if (!memoraoneServerMatches2(memoraone, expected)) {
|
|
3635
3713
|
throw new Error(
|
|
3636
3714
|
"[setup-ide-files] JetBrains MCP config mcpServers.memoraone is missing or invalid."
|
|
@@ -3690,20 +3768,20 @@ async function removeMemoraoneFromProjectConfig(options) {
|
|
|
3690
3768
|
return { changed: true, backupPath };
|
|
3691
3769
|
}
|
|
3692
3770
|
const next = { ...parsed2, mcpServers };
|
|
3693
|
-
await fs14.mkdir(
|
|
3771
|
+
await fs14.mkdir(path19.dirname(configPath), { recursive: true });
|
|
3694
3772
|
await fs14.writeFile(configPath, JSON.stringify(next, null, 2) + "\n", "utf8");
|
|
3695
3773
|
return { changed: true, backupPath };
|
|
3696
3774
|
}
|
|
3697
3775
|
async function resolveLocalCliPathAsync() {
|
|
3698
|
-
const here = process.argv[1] ?
|
|
3776
|
+
const here = process.argv[1] ? path19.dirname(path19.resolve(process.argv[1])) : process.cwd();
|
|
3699
3777
|
const candidates = [
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3778
|
+
path19.join(here, "cli.cjs"),
|
|
3779
|
+
path19.join(here, "..", "dist", "cli.cjs"),
|
|
3780
|
+
path19.join(here, "..", "..", "dist", "cli.cjs")
|
|
3703
3781
|
];
|
|
3704
3782
|
for (const candidate of candidates) {
|
|
3705
3783
|
if (await pathExists3(candidate)) {
|
|
3706
|
-
return
|
|
3784
|
+
return path19.resolve(candidate);
|
|
3707
3785
|
}
|
|
3708
3786
|
}
|
|
3709
3787
|
return null;
|
|
@@ -3760,7 +3838,7 @@ function formatOptionalJetBrainsHandshakeUnavailableDetail(detail) {
|
|
|
3760
3838
|
async function verifyJetBrainsMcpHandshake(options) {
|
|
3761
3839
|
const timeoutMs = options.timeoutMs ?? 15e3;
|
|
3762
3840
|
const { server } = options;
|
|
3763
|
-
return new Promise((
|
|
3841
|
+
return new Promise((resolve39) => {
|
|
3764
3842
|
let settled = false;
|
|
3765
3843
|
const finish = (ok, detail, optionalUnavailable) => {
|
|
3766
3844
|
if (settled) return;
|
|
@@ -3770,7 +3848,7 @@ async function verifyJetBrainsMcpHandshake(options) {
|
|
|
3770
3848
|
child.kill();
|
|
3771
3849
|
} catch {
|
|
3772
3850
|
}
|
|
3773
|
-
|
|
3851
|
+
resolve39({ ok, detail, optionalUnavailable });
|
|
3774
3852
|
};
|
|
3775
3853
|
const child = (0, import_node_child_process4.spawn)(server.command, [...server.args], {
|
|
3776
3854
|
env: { ...process.env, ...server.env },
|
|
@@ -3844,7 +3922,7 @@ async function verifyJetBrainsMcpHandshake(options) {
|
|
|
3844
3922
|
async function setupJetBrainsMcpConfig(options) {
|
|
3845
3923
|
const homeDir = options.homeDir ?? os5.homedir();
|
|
3846
3924
|
const globalPath = options.globalConfigPath ?? getJetBrainsGlobalMcpConfigPath(homeDir);
|
|
3847
|
-
const workspaceRoot =
|
|
3925
|
+
const workspaceRoot = path19.resolve(options.repoRoot);
|
|
3848
3926
|
const repairActions = [];
|
|
3849
3927
|
const allLocations = getKnownJetBrainsMcpConfigLocations(homeDir, options.repoRoot);
|
|
3850
3928
|
for (const location of allLocations) {
|
|
@@ -3898,11 +3976,10 @@ async function setupJetBrainsMcpConfig(options) {
|
|
|
3898
3976
|
);
|
|
3899
3977
|
}
|
|
3900
3978
|
}
|
|
3901
|
-
const merged = mergeJetBrainsMcpConfigObject(existing, memoraone);
|
|
3979
|
+
const merged = mergeJetBrainsMcpConfigObject(existing, memoraone, options.ownership);
|
|
3902
3980
|
const body = JSON.stringify(merged, null, 2) + "\n";
|
|
3903
3981
|
if (existed && existing) {
|
|
3904
|
-
|
|
3905
|
-
if (memoraoneServerMatches2(currentMemoraone, memoraone)) {
|
|
3982
|
+
if (canonicalValueMatches(existing, merged)) {
|
|
3906
3983
|
repairActions.push({ type: "wrote-global-config", path: globalPath, outcome: "skipped" });
|
|
3907
3984
|
return { outcome: "skipped", repairActions, memoraone };
|
|
3908
3985
|
}
|
|
@@ -3919,7 +3996,7 @@ async function setupJetBrainsMcpConfig(options) {
|
|
|
3919
3996
|
await writeJetBrainsMcpJsonAtomic(globalPath, body);
|
|
3920
3997
|
const verifyRaw = await fs14.readFile(globalPath, "utf8");
|
|
3921
3998
|
const verifyParsed = JSON.parse(stripLeadingLineComments2(verifyRaw));
|
|
3922
|
-
validateJetBrainsMcpConfig(verifyParsed, memoraone);
|
|
3999
|
+
validateJetBrainsMcpConfig(verifyParsed, memoraone, options.ownership ? memoraoneServerNameForRepositoryBinding(options.ownership.repositoryBindingId) : CANONICAL_MEMORAONE_MCP_SERVER_NAME);
|
|
3923
4000
|
const outcome = existed ? "updated" : "created";
|
|
3924
4001
|
repairActions.push({ type: "wrote-global-config", path: globalPath, outcome });
|
|
3925
4002
|
let verifyOk;
|
|
@@ -3984,13 +4061,13 @@ function logJetBrainsMcpCliSummary(info, dryRun, println = console.log) {
|
|
|
3984
4061
|
"[setup-ide-files] Fully quit JetBrains IDE and reopen this repo for MCP changes to take effect."
|
|
3985
4062
|
);
|
|
3986
4063
|
}
|
|
3987
|
-
var fs14, os5,
|
|
4064
|
+
var fs14, os5, path19, import_node_crypto5, import_node_child_process4, JETBRAINS_DEBUG_ENV_VARS;
|
|
3988
4065
|
var init_jetbrainsMcpConfig = __esm({
|
|
3989
4066
|
"src/jetbrainsMcpConfig.ts"() {
|
|
3990
4067
|
fs14 = __toESM(require("fs/promises"), 1);
|
|
3991
4068
|
os5 = __toESM(require("os"), 1);
|
|
3992
|
-
|
|
3993
|
-
|
|
4069
|
+
path19 = __toESM(require("path"), 1);
|
|
4070
|
+
import_node_crypto5 = require("crypto");
|
|
3994
4071
|
import_node_child_process4 = require("child_process");
|
|
3995
4072
|
init_configUtils();
|
|
3996
4073
|
init_cursorGlobalMcpConfig();
|
|
@@ -4019,10 +4096,10 @@ async function pathExists4(filePath) {
|
|
|
4019
4096
|
}
|
|
4020
4097
|
}
|
|
4021
4098
|
function getWindsurfGlobalMcpConfigPath(homeDir) {
|
|
4022
|
-
return
|
|
4099
|
+
return path20.join(homeDir, ".config", "devin", "mcp_config.json");
|
|
4023
4100
|
}
|
|
4024
4101
|
function getWindsurfLegacyMcpConfigPath(homeDir) {
|
|
4025
|
-
return
|
|
4102
|
+
return path20.join(homeDir, ".codeium", "windsurf", "mcp_config.json");
|
|
4026
4103
|
}
|
|
4027
4104
|
function formatWindsurfBackupTimestamp(d = /* @__PURE__ */ new Date()) {
|
|
4028
4105
|
const pad = (n) => String(n).padStart(2, "0");
|
|
@@ -4036,7 +4113,7 @@ function buildMemoraoneWindsurfMcpServer(options) {
|
|
|
4036
4113
|
apiUrl: options.apiUrl ?? (environment === "local" ? DEV_API_URL : void 0)
|
|
4037
4114
|
}),
|
|
4038
4115
|
MEMORAONE_IDE_TYPE: "windsurf",
|
|
4039
|
-
[MEMORAONE_WORKSPACE_ROOT_ENV]:
|
|
4116
|
+
[MEMORAONE_WORKSPACE_ROOT_ENV]: path20.resolve(options.workspaceRoot)
|
|
4040
4117
|
};
|
|
4041
4118
|
if (environment === "local" || options.devMode) {
|
|
4042
4119
|
env2.MEMORAONE_DEV_MODE = "1";
|
|
@@ -4052,10 +4129,10 @@ function buildMemoraoneWindsurfMcpServer(options) {
|
|
|
4052
4129
|
env: env2
|
|
4053
4130
|
};
|
|
4054
4131
|
}
|
|
4055
|
-
function mergeWindsurfMcpConfigObject(existing, memoraone) {
|
|
4132
|
+
function mergeWindsurfMcpConfigObject(existing, memoraone, ownership) {
|
|
4056
4133
|
const base = existing && typeof existing === "object" ? { ...existing } : { mcpServers: {} };
|
|
4057
4134
|
const mcpServers = typeof base.mcpServers === "object" && base.mcpServers !== null && !Array.isArray(base.mcpServers) ? { ...base.mcpServers } : {};
|
|
4058
|
-
return { ...base, mcpServers: replaceMemoraoneOwnedInServerMap(mcpServers, memoraone) };
|
|
4135
|
+
return { ...base, mcpServers: ownership ? replaceMemoraoneRepositoryBindingInServerMap(mcpServers, memoraone, ownership) : replaceMemoraoneOwnedInServerMap(mcpServers, memoraone) };
|
|
4059
4136
|
}
|
|
4060
4137
|
function stripMemoraoneFromWindsurfConfigObject(existing) {
|
|
4061
4138
|
const base = { ...existing };
|
|
@@ -4071,11 +4148,11 @@ function stripMemoraoneFromWindsurfConfigObject(existing) {
|
|
|
4071
4148
|
return { next: { ...base, mcpServers }, removed: true };
|
|
4072
4149
|
}
|
|
4073
4150
|
async function writeWindsurfMcpJsonAtomic(filePath, content) {
|
|
4074
|
-
const dir =
|
|
4151
|
+
const dir = path20.dirname(filePath);
|
|
4075
4152
|
await fs15.mkdir(dir, { recursive: true });
|
|
4076
|
-
const tmpPath =
|
|
4153
|
+
const tmpPath = path20.join(
|
|
4077
4154
|
dir,
|
|
4078
|
-
`.${
|
|
4155
|
+
`.${path20.basename(filePath)}.${process.pid}.${(0, import_node_crypto6.randomBytes)(8).toString("hex")}.tmp`
|
|
4079
4156
|
);
|
|
4080
4157
|
try {
|
|
4081
4158
|
await fs15.writeFile(tmpPath, content, "utf8");
|
|
@@ -4091,7 +4168,7 @@ async function writeWindsurfMcpJsonAtomic(filePath, content) {
|
|
|
4091
4168
|
function memoraoneServerMatches3(server, expected) {
|
|
4092
4169
|
return canonicalValueMatches(server, expected);
|
|
4093
4170
|
}
|
|
4094
|
-
function validateWindsurfMcpConfig(parsed2, expected) {
|
|
4171
|
+
function validateWindsurfMcpConfig(parsed2, expected, serverName = CANONICAL_MEMORAONE_MCP_SERVER_NAME) {
|
|
4095
4172
|
if (!parsed2 || typeof parsed2 !== "object") {
|
|
4096
4173
|
throw new Error("[setup-ide-files] Devin Desktop MCP config must be a JSON object.");
|
|
4097
4174
|
}
|
|
@@ -4099,7 +4176,8 @@ function validateWindsurfMcpConfig(parsed2, expected) {
|
|
|
4099
4176
|
if (!mcpServers || typeof mcpServers !== "object" || Array.isArray(mcpServers)) {
|
|
4100
4177
|
throw new Error("[setup-ide-files] Devin Desktop MCP config missing mcpServers object.");
|
|
4101
4178
|
}
|
|
4102
|
-
const
|
|
4179
|
+
const serverMap = mcpServers;
|
|
4180
|
+
const memoraone = serverMap[serverName] ?? Object.values(serverMap).find((entry) => memoraoneServerMatches3(entry, expected));
|
|
4103
4181
|
if (!memoraoneServerMatches3(memoraone, expected)) {
|
|
4104
4182
|
throw new Error(
|
|
4105
4183
|
"[setup-ide-files] Devin Desktop MCP config mcpServers.memoraone is missing or invalid."
|
|
@@ -4166,8 +4244,8 @@ async function setupWindsurfMcpConfig(options) {
|
|
|
4166
4244
|
const homeDir = options.homeDir ?? os6.homedir();
|
|
4167
4245
|
const activePath = options.globalConfigPath ?? getWindsurfGlobalMcpConfigPath(homeDir);
|
|
4168
4246
|
const legacyPath = options.legacyConfigPath ?? getWindsurfLegacyMcpConfigPath(homeDir);
|
|
4169
|
-
const samePath =
|
|
4170
|
-
const workspaceRoot =
|
|
4247
|
+
const samePath = path20.resolve(activePath) === path20.resolve(legacyPath);
|
|
4248
|
+
const workspaceRoot = path20.resolve(options.repoRoot);
|
|
4171
4249
|
const memoraone = await buildWindsurfMemoraoneServer({
|
|
4172
4250
|
workspaceRoot,
|
|
4173
4251
|
devMode: options.devMode,
|
|
@@ -4204,14 +4282,17 @@ async function setupWindsurfMcpConfig(options) {
|
|
|
4204
4282
|
);
|
|
4205
4283
|
}
|
|
4206
4284
|
const mergeBase = activeExisted ? activeExisting : legacyExisting;
|
|
4207
|
-
const merged = mergeWindsurfMcpConfigObject(mergeBase, memoraone);
|
|
4285
|
+
const merged = mergeWindsurfMcpConfigObject(mergeBase, memoraone, options.ownership);
|
|
4208
4286
|
const body = JSON.stringify(merged, null, 2) + "\n";
|
|
4209
|
-
const
|
|
4210
|
-
|
|
4287
|
+
const activeAlreadyCorrect = Boolean(
|
|
4288
|
+
activeExisted && activeExisting && canonicalValueMatches(activeExisting, merged)
|
|
4289
|
+
);
|
|
4211
4290
|
let legacyNeedsCleanup = false;
|
|
4212
4291
|
if (legacyExisted && !legacyMalformed && legacyExisting) {
|
|
4213
|
-
|
|
4214
|
-
|
|
4292
|
+
legacyNeedsCleanup = options.ownership ? stripMemoraoneRepositoryBindingFromServerMap(
|
|
4293
|
+
legacyExisting.mcpServers ?? {},
|
|
4294
|
+
options.ownership
|
|
4295
|
+
).removedKeys.length > 0 : extractMemoraone(legacyExisting) !== void 0;
|
|
4215
4296
|
}
|
|
4216
4297
|
if (activeAlreadyCorrect && !legacyNeedsCleanup) {
|
|
4217
4298
|
return {
|
|
@@ -4247,7 +4328,7 @@ async function setupWindsurfMcpConfig(options) {
|
|
|
4247
4328
|
await writeWindsurfMcpJsonAtomic(activePath, body);
|
|
4248
4329
|
const verifyRaw = await fs15.readFile(activePath, "utf8");
|
|
4249
4330
|
const verifyParsed = JSON.parse(stripLeadingLineComments3(verifyRaw));
|
|
4250
|
-
validateWindsurfMcpConfig(verifyParsed, memoraone);
|
|
4331
|
+
validateWindsurfMcpConfig(verifyParsed, memoraone, options.ownership ? memoraoneServerNameForRepositoryBinding(options.ownership.repositoryBindingId) : CANONICAL_MEMORAONE_MCP_SERVER_NAME);
|
|
4251
4332
|
}
|
|
4252
4333
|
let legacyCleanup = "absent";
|
|
4253
4334
|
let warning;
|
|
@@ -4257,7 +4338,11 @@ async function setupWindsurfMcpConfig(options) {
|
|
|
4257
4338
|
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
4339
|
} else if (legacyNeedsCleanup && legacyExisting) {
|
|
4259
4340
|
await backupConfigFile2(legacyPath);
|
|
4260
|
-
const
|
|
4341
|
+
const scoped = options.ownership && legacyExisting.mcpServers && typeof legacyExisting.mcpServers === "object" && !Array.isArray(legacyExisting.mcpServers) ? stripMemoraoneRepositoryBindingFromServerMap(
|
|
4342
|
+
legacyExisting.mcpServers,
|
|
4343
|
+
options.ownership
|
|
4344
|
+
) : null;
|
|
4345
|
+
const { next, removed } = scoped ? { next: { ...legacyExisting, mcpServers: scoped.next }, removed: scoped.removedKeys.length > 0 } : stripMemoraoneFromWindsurfConfigObject(legacyExisting);
|
|
4261
4346
|
if (removed) {
|
|
4262
4347
|
const legacyBody = JSON.stringify(next, null, 2) + "\n";
|
|
4263
4348
|
await writeWindsurfMcpJsonAtomic(legacyPath, legacyBody);
|
|
@@ -4320,13 +4405,13 @@ function logWindsurfMcpCliSummary(info, dryRun, println = console.log) {
|
|
|
4320
4405
|
"[setup-ide-files] Refresh MCP servers in Devin Desktop settings, or restart Devin Desktop, for MCP changes to take effect."
|
|
4321
4406
|
);
|
|
4322
4407
|
}
|
|
4323
|
-
var fs15, os6,
|
|
4408
|
+
var fs15, os6, path20, import_node_crypto6;
|
|
4324
4409
|
var init_windsurfMcpConfig = __esm({
|
|
4325
4410
|
"src/windsurfMcpConfig.ts"() {
|
|
4326
4411
|
fs15 = __toESM(require("fs/promises"), 1);
|
|
4327
4412
|
os6 = __toESM(require("os"), 1);
|
|
4328
|
-
|
|
4329
|
-
|
|
4413
|
+
path20 = __toESM(require("path"), 1);
|
|
4414
|
+
import_node_crypto6 = require("crypto");
|
|
4330
4415
|
init_configUtils();
|
|
4331
4416
|
init_cursorGlobalMcpConfig();
|
|
4332
4417
|
init_initializeBinding();
|
|
@@ -4346,13 +4431,13 @@ async function pathExists5(filePath) {
|
|
|
4346
4431
|
}
|
|
4347
4432
|
}
|
|
4348
4433
|
function getOpenCodeProjectMcpConfigPath(repoRoot) {
|
|
4349
|
-
return
|
|
4434
|
+
return path21.join(path21.resolve(repoRoot), "opencode.json");
|
|
4350
4435
|
}
|
|
4351
4436
|
function getOpenCodeProjectJsoncConfigPath(repoRoot) {
|
|
4352
|
-
return
|
|
4437
|
+
return path21.join(path21.resolve(repoRoot), "opencode.jsonc");
|
|
4353
4438
|
}
|
|
4354
4439
|
function getOpenCodeGlobalMcpConfigPath(homeDir) {
|
|
4355
|
-
return
|
|
4440
|
+
return path21.join(homeDir, ".config", "opencode", "opencode.json");
|
|
4356
4441
|
}
|
|
4357
4442
|
function buildMemoraoneOpenCodeMcpServer(options) {
|
|
4358
4443
|
const environment = options.environment ?? (options.devMode ? "local" : "production");
|
|
@@ -4362,7 +4447,7 @@ function buildMemoraoneOpenCodeMcpServer(options) {
|
|
|
4362
4447
|
apiUrl: options.apiUrl ?? (environment === "local" ? DEV_API_URL : void 0)
|
|
4363
4448
|
}),
|
|
4364
4449
|
MEMORAONE_IDE_TYPE: "opencode",
|
|
4365
|
-
[MEMORAONE_WORKSPACE_ROOT_ENV]:
|
|
4450
|
+
[MEMORAONE_WORKSPACE_ROOT_ENV]: path21.resolve(options.workspaceRoot)
|
|
4366
4451
|
};
|
|
4367
4452
|
if (environment === "local" || options.devMode) {
|
|
4368
4453
|
env2.MEMORAONE_DEV_MODE = "1";
|
|
@@ -4393,11 +4478,11 @@ function mergeOpenCodeMcpConfigObject(existing, memoraone) {
|
|
|
4393
4478
|
return { ...base, mcp: replaceMemoraoneOwnedInServerMap(mcp, memoraone) };
|
|
4394
4479
|
}
|
|
4395
4480
|
async function writeOpenCodeMcpJsonAtomic(filePath, content) {
|
|
4396
|
-
const dir =
|
|
4481
|
+
const dir = path21.dirname(filePath);
|
|
4397
4482
|
await fs16.mkdir(dir, { recursive: true });
|
|
4398
|
-
const tmpPath =
|
|
4483
|
+
const tmpPath = path21.join(
|
|
4399
4484
|
dir,
|
|
4400
|
-
`.${
|
|
4485
|
+
`.${path21.basename(filePath)}.${process.pid}.${(0, import_node_crypto7.randomBytes)(8).toString("hex")}.tmp`
|
|
4401
4486
|
);
|
|
4402
4487
|
try {
|
|
4403
4488
|
await fs16.writeFile(tmpPath, content, "utf8");
|
|
@@ -4476,7 +4561,7 @@ async function buildOpenCodeMemoraoneServer(options) {
|
|
|
4476
4561
|
async function setupOpenCodeMcpConfig(options) {
|
|
4477
4562
|
const projectPath = options.projectConfigPath ?? getOpenCodeProjectMcpConfigPath(options.repoRoot);
|
|
4478
4563
|
const jsoncPath = getOpenCodeProjectJsoncConfigPath(options.repoRoot);
|
|
4479
|
-
const workspaceRoot =
|
|
4564
|
+
const workspaceRoot = path21.resolve(options.repoRoot);
|
|
4480
4565
|
const memoraone = await buildOpenCodeMemoraoneServer({
|
|
4481
4566
|
workspaceRoot,
|
|
4482
4567
|
devMode: options.devMode,
|
|
@@ -4539,12 +4624,12 @@ function logOpenCodeMcpCliSummary(info, dryRun, println = console.log) {
|
|
|
4539
4624
|
"[setup-ide-files] Fully quit OpenCode and reopen this repo for MCP changes to take effect."
|
|
4540
4625
|
);
|
|
4541
4626
|
}
|
|
4542
|
-
var fs16,
|
|
4627
|
+
var fs16, path21, import_node_crypto7, OPENCODE_CONFIG_SCHEMA_URL, OpenCodeMcpJsonParseError, OpenCodeJsoncOnlyError;
|
|
4543
4628
|
var init_opencodeMcpConfig = __esm({
|
|
4544
4629
|
"src/opencodeMcpConfig.ts"() {
|
|
4545
4630
|
fs16 = __toESM(require("fs/promises"), 1);
|
|
4546
|
-
|
|
4547
|
-
|
|
4631
|
+
path21 = __toESM(require("path"), 1);
|
|
4632
|
+
import_node_crypto7 = require("crypto");
|
|
4548
4633
|
init_configUtils();
|
|
4549
4634
|
init_cursorGlobalMcpConfig();
|
|
4550
4635
|
init_initializeBinding();
|
|
@@ -4583,11 +4668,11 @@ async function pathExists6(filePath) {
|
|
|
4583
4668
|
}
|
|
4584
4669
|
}
|
|
4585
4670
|
function getCodexProjectMcpConfigPath(repoRoot) {
|
|
4586
|
-
return
|
|
4671
|
+
return path22.join(path22.resolve(repoRoot), ".codex", "config.toml");
|
|
4587
4672
|
}
|
|
4588
4673
|
function getCodexGlobalMcpConfigPath(homeDir, env2 = process.env) {
|
|
4589
|
-
const codexHome = env2.CODEX_HOME?.trim() ?
|
|
4590
|
-
return
|
|
4674
|
+
const codexHome = env2.CODEX_HOME?.trim() ? path22.resolve(env2.CODEX_HOME) : path22.join(homeDir, ".codex");
|
|
4675
|
+
return path22.join(codexHome, "config.toml");
|
|
4591
4676
|
}
|
|
4592
4677
|
function escapeTomlBasicString(value) {
|
|
4593
4678
|
return '"' + value.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r") + '"';
|
|
@@ -4611,7 +4696,7 @@ function buildMemoraoneCodexMcpServer(options) {
|
|
|
4611
4696
|
apiUrl: options.apiUrl ?? (environment === "local" ? DEV_API_URL : void 0)
|
|
4612
4697
|
}),
|
|
4613
4698
|
MEMORAONE_IDE_TYPE: "codex",
|
|
4614
|
-
[MEMORAONE_WORKSPACE_ROOT_ENV]:
|
|
4699
|
+
[MEMORAONE_WORKSPACE_ROOT_ENV]: path22.resolve(options.workspaceRoot)
|
|
4615
4700
|
};
|
|
4616
4701
|
if (environment === "local" || options.devMode) {
|
|
4617
4702
|
env2.MEMORAONE_DEV_MODE = "1";
|
|
@@ -4838,11 +4923,11 @@ function parseCodexTomlOrThrow(source, configPath) {
|
|
|
4838
4923
|
}
|
|
4839
4924
|
}
|
|
4840
4925
|
async function writeCodexTomlAtomic(filePath, content) {
|
|
4841
|
-
const dir =
|
|
4926
|
+
const dir = path22.dirname(filePath);
|
|
4842
4927
|
await fs17.mkdir(dir, { recursive: true });
|
|
4843
|
-
const tmpPath =
|
|
4928
|
+
const tmpPath = path22.join(
|
|
4844
4929
|
dir,
|
|
4845
|
-
`.${
|
|
4930
|
+
`.${path22.basename(filePath)}.${process.pid}.${(0, import_node_crypto8.randomBytes)(8).toString("hex")}.tmp`
|
|
4846
4931
|
);
|
|
4847
4932
|
try {
|
|
4848
4933
|
await fs17.writeFile(tmpPath, content, "utf8");
|
|
@@ -4897,7 +4982,7 @@ async function buildCodexMemoraoneServer(options) {
|
|
|
4897
4982
|
}
|
|
4898
4983
|
async function setupCodexMcpConfig(options) {
|
|
4899
4984
|
const projectPath = options.projectConfigPath ?? getCodexProjectMcpConfigPath(options.repoRoot);
|
|
4900
|
-
const workspaceRoot =
|
|
4985
|
+
const workspaceRoot = path22.resolve(options.repoRoot);
|
|
4901
4986
|
const memoraone = await buildCodexMemoraoneServer({
|
|
4902
4987
|
workspaceRoot,
|
|
4903
4988
|
devMode: options.devMode,
|
|
@@ -4947,12 +5032,12 @@ function logCodexMcpCliSummary(info, dryRun, println = console.log) {
|
|
|
4947
5032
|
"[setup-ide-files] Trust this project in Codex if prompted, then restart Codex."
|
|
4948
5033
|
);
|
|
4949
5034
|
}
|
|
4950
|
-
var fs17,
|
|
5035
|
+
var fs17, path22, import_node_crypto8, import_smol_toml, CODEX_MCP_SERVER_NAME, CODEX_OWNED_TABLE_PREFIX, CodexMcpTomlParseError, TABLE_HEADER_RE;
|
|
4951
5036
|
var init_codexMcpConfig = __esm({
|
|
4952
5037
|
"src/codexMcpConfig.ts"() {
|
|
4953
5038
|
fs17 = __toESM(require("fs/promises"), 1);
|
|
4954
|
-
|
|
4955
|
-
|
|
5039
|
+
path22 = __toESM(require("path"), 1);
|
|
5040
|
+
import_node_crypto8 = require("crypto");
|
|
4956
5041
|
import_smol_toml = require("smol-toml");
|
|
4957
5042
|
init_configUtils();
|
|
4958
5043
|
init_cursorGlobalMcpConfig();
|
|
@@ -4988,7 +5073,7 @@ async function pathExists7(filePath) {
|
|
|
4988
5073
|
}
|
|
4989
5074
|
}
|
|
4990
5075
|
function getKiroProjectMcpConfigPath(repoRoot) {
|
|
4991
|
-
return
|
|
5076
|
+
return path23.join(path23.resolve(repoRoot), ".kiro", "settings", "mcp.json");
|
|
4992
5077
|
}
|
|
4993
5078
|
function buildMemoraoneKiroMcpServer(options) {
|
|
4994
5079
|
const environment = options.environment ?? (options.devMode ? "local" : "production");
|
|
@@ -4997,7 +5082,7 @@ function buildMemoraoneKiroMcpServer(options) {
|
|
|
4997
5082
|
environment,
|
|
4998
5083
|
apiUrl: options.apiUrl ?? (environment === "local" ? DEV_API_URL : void 0)
|
|
4999
5084
|
}),
|
|
5000
|
-
[MEMORAONE_WORKSPACE_ROOT_ENV]:
|
|
5085
|
+
[MEMORAONE_WORKSPACE_ROOT_ENV]: path23.resolve(options.workspaceRoot)
|
|
5001
5086
|
};
|
|
5002
5087
|
if (environment === "local" || options.devMode) {
|
|
5003
5088
|
env2.MEMORAONE_DEV_MODE = "1";
|
|
@@ -5019,11 +5104,11 @@ function mergeKiroMcpConfigObject(existing, memoraone) {
|
|
|
5019
5104
|
return { ...base, mcpServers: replaceMemoraoneOwnedInServerMap(mcpServers, memoraone) };
|
|
5020
5105
|
}
|
|
5021
5106
|
async function writeKiroMcpJsonAtomic(filePath, content) {
|
|
5022
|
-
const dir =
|
|
5107
|
+
const dir = path23.dirname(filePath);
|
|
5023
5108
|
await fs18.mkdir(dir, { recursive: true });
|
|
5024
|
-
const tmpPath =
|
|
5109
|
+
const tmpPath = path23.join(
|
|
5025
5110
|
dir,
|
|
5026
|
-
`.${
|
|
5111
|
+
`.${path23.basename(filePath)}.${process.pid}.${(0, import_node_crypto9.randomBytes)(8).toString("hex")}.tmp`
|
|
5027
5112
|
);
|
|
5028
5113
|
try {
|
|
5029
5114
|
await fs18.writeFile(tmpPath, content, "utf8");
|
|
@@ -5101,7 +5186,7 @@ async function buildKiroMemoraoneServer(options) {
|
|
|
5101
5186
|
}
|
|
5102
5187
|
async function setupKiroMcpConfig(options) {
|
|
5103
5188
|
const projectPath = options.projectConfigPath ?? getKiroProjectMcpConfigPath(options.repoRoot);
|
|
5104
|
-
const workspaceRoot =
|
|
5189
|
+
const workspaceRoot = path23.resolve(options.repoRoot);
|
|
5105
5190
|
const memoraone = await buildKiroMemoraoneServer({
|
|
5106
5191
|
workspaceRoot,
|
|
5107
5192
|
devMode: options.devMode,
|
|
@@ -5160,12 +5245,12 @@ function logKiroMcpCliSummary(info, dryRun, println = console.log) {
|
|
|
5160
5245
|
"[setup-ide-files] Fully quit Kiro and reopen this repo for MCP changes to take effect."
|
|
5161
5246
|
);
|
|
5162
5247
|
}
|
|
5163
|
-
var fs18,
|
|
5248
|
+
var fs18, path23, import_node_crypto9, KiroMcpJsonParseError;
|
|
5164
5249
|
var init_kiroMcpConfig = __esm({
|
|
5165
5250
|
"src/kiroMcpConfig.ts"() {
|
|
5166
5251
|
fs18 = __toESM(require("fs/promises"), 1);
|
|
5167
|
-
|
|
5168
|
-
|
|
5252
|
+
path23 = __toESM(require("path"), 1);
|
|
5253
|
+
import_node_crypto9 = require("crypto");
|
|
5169
5254
|
init_configUtils();
|
|
5170
5255
|
init_cursorGlobalMcpConfig();
|
|
5171
5256
|
init_initializeBinding();
|
|
@@ -5197,7 +5282,7 @@ async function pathExists8(filePath) {
|
|
|
5197
5282
|
}
|
|
5198
5283
|
}
|
|
5199
5284
|
function getRooCodeProjectMcpConfigPath(repoRoot) {
|
|
5200
|
-
return
|
|
5285
|
+
return path24.join(path24.resolve(repoRoot), ".roo", "mcp.json");
|
|
5201
5286
|
}
|
|
5202
5287
|
function buildMemoraoneRooCodeMcpServer(options) {
|
|
5203
5288
|
const environment = options.environment ?? (options.devMode ? "local" : "production");
|
|
@@ -5207,7 +5292,7 @@ function buildMemoraoneRooCodeMcpServer(options) {
|
|
|
5207
5292
|
apiUrl: options.apiUrl ?? (environment === "local" ? DEV_API_URL : void 0)
|
|
5208
5293
|
}),
|
|
5209
5294
|
MEMORAONE_IDE_TYPE: "roo-code",
|
|
5210
|
-
[MEMORAONE_WORKSPACE_ROOT_ENV]:
|
|
5295
|
+
[MEMORAONE_WORKSPACE_ROOT_ENV]: path24.resolve(options.workspaceRoot)
|
|
5211
5296
|
};
|
|
5212
5297
|
if (environment === "local" || options.devMode) {
|
|
5213
5298
|
env2.MEMORAONE_DEV_MODE = "1";
|
|
@@ -5229,11 +5314,11 @@ function mergeRooCodeMcpConfigObject(existing, memoraone) {
|
|
|
5229
5314
|
return { ...base, mcpServers: replaceMemoraoneOwnedInServerMap(mcpServers, memoraone) };
|
|
5230
5315
|
}
|
|
5231
5316
|
async function writeRooCodeMcpJsonAtomic(filePath, content) {
|
|
5232
|
-
const dir =
|
|
5317
|
+
const dir = path24.dirname(filePath);
|
|
5233
5318
|
await fs19.mkdir(dir, { recursive: true });
|
|
5234
|
-
const tmpPath =
|
|
5319
|
+
const tmpPath = path24.join(
|
|
5235
5320
|
dir,
|
|
5236
|
-
`.${
|
|
5321
|
+
`.${path24.basename(filePath)}.${process.pid}.${(0, import_node_crypto10.randomBytes)(8).toString("hex")}.tmp`
|
|
5237
5322
|
);
|
|
5238
5323
|
try {
|
|
5239
5324
|
await fs19.writeFile(tmpPath, content, "utf8");
|
|
@@ -5311,7 +5396,7 @@ async function buildRooCodeMemoraoneServer(options) {
|
|
|
5311
5396
|
}
|
|
5312
5397
|
async function setupRooCodeMcpConfig(options) {
|
|
5313
5398
|
const projectPath = options.projectConfigPath ?? getRooCodeProjectMcpConfigPath(options.repoRoot);
|
|
5314
|
-
const workspaceRoot =
|
|
5399
|
+
const workspaceRoot = path24.resolve(options.repoRoot);
|
|
5315
5400
|
const memoraone = await buildRooCodeMemoraoneServer({
|
|
5316
5401
|
workspaceRoot,
|
|
5317
5402
|
devMode: options.devMode,
|
|
@@ -5376,12 +5461,12 @@ function logRooCodeMcpCliSummary(info, dryRun, println = console.log) {
|
|
|
5376
5461
|
"[setup-ide-files] Fully quit Roo Code and reopen this repo for MCP changes to take effect."
|
|
5377
5462
|
);
|
|
5378
5463
|
}
|
|
5379
|
-
var fs19,
|
|
5464
|
+
var fs19, path24, import_node_crypto10, RooCodeMcpJsonParseError;
|
|
5380
5465
|
var init_rooCodeMcpConfig = __esm({
|
|
5381
5466
|
"src/rooCodeMcpConfig.ts"() {
|
|
5382
5467
|
fs19 = __toESM(require("fs/promises"), 1);
|
|
5383
|
-
|
|
5384
|
-
|
|
5468
|
+
path24 = __toESM(require("path"), 1);
|
|
5469
|
+
import_node_crypto10 = require("crypto");
|
|
5385
5470
|
init_configUtils();
|
|
5386
5471
|
init_cursorGlobalMcpConfig();
|
|
5387
5472
|
init_initializeBinding();
|
|
@@ -5413,10 +5498,10 @@ async function pathExists9(filePath) {
|
|
|
5413
5498
|
}
|
|
5414
5499
|
}
|
|
5415
5500
|
function getClineCliRootMcpConfigPath(homeDir) {
|
|
5416
|
-
return
|
|
5501
|
+
return path25.join(homeDir, ".cline", "mcp.json");
|
|
5417
5502
|
}
|
|
5418
5503
|
function getClineCliGlobalMcpConfigPath(homeDir) {
|
|
5419
|
-
return
|
|
5504
|
+
return path25.join(homeDir, ".cline", "data", "settings", "cline_mcp_settings.json");
|
|
5420
5505
|
}
|
|
5421
5506
|
function getClineCliMcpConfigPaths(homeDir) {
|
|
5422
5507
|
return {
|
|
@@ -5432,7 +5517,7 @@ function buildMemoraoneClineCliMcpServer(options) {
|
|
|
5432
5517
|
apiUrl: options.apiUrl ?? (environment === "local" ? DEV_API_URL : void 0)
|
|
5433
5518
|
}),
|
|
5434
5519
|
MEMORAONE_IDE_TYPE: "cline-cli",
|
|
5435
|
-
[MEMORAONE_WORKSPACE_ROOT_ENV]:
|
|
5520
|
+
[MEMORAONE_WORKSPACE_ROOT_ENV]: path25.resolve(options.workspaceRoot)
|
|
5436
5521
|
};
|
|
5437
5522
|
if (environment === "local" || options.devMode) {
|
|
5438
5523
|
env2.MEMORAONE_DEV_MODE = "1";
|
|
@@ -5450,17 +5535,20 @@ function buildMemoraoneClineCliMcpServer(options) {
|
|
|
5450
5535
|
env: env2
|
|
5451
5536
|
};
|
|
5452
5537
|
}
|
|
5453
|
-
function mergeClineCliMcpConfigObject(existing, memoraone) {
|
|
5538
|
+
function mergeClineCliMcpConfigObject(existing, memoraone, ownership) {
|
|
5454
5539
|
const base = existing && typeof existing === "object" ? { ...existing } : { mcpServers: {} };
|
|
5455
5540
|
const mcpServers = typeof base.mcpServers === "object" && base.mcpServers !== null && !Array.isArray(base.mcpServers) ? { ...base.mcpServers } : {};
|
|
5456
|
-
return {
|
|
5541
|
+
return {
|
|
5542
|
+
...base,
|
|
5543
|
+
mcpServers: ownership ? replaceMemoraoneRepositoryBindingInServerMap(mcpServers, memoraone, ownership) : replaceMemoraoneOwnedInServerMap(mcpServers, memoraone)
|
|
5544
|
+
};
|
|
5457
5545
|
}
|
|
5458
5546
|
async function writeClineCliMcpJsonAtomic(filePath, content) {
|
|
5459
|
-
const dir =
|
|
5547
|
+
const dir = path25.dirname(filePath);
|
|
5460
5548
|
await fs20.mkdir(dir, { recursive: true });
|
|
5461
|
-
const tmpPath =
|
|
5549
|
+
const tmpPath = path25.join(
|
|
5462
5550
|
dir,
|
|
5463
|
-
`.${
|
|
5551
|
+
`.${path25.basename(filePath)}.${process.pid}.${(0, import_node_crypto11.randomBytes)(8).toString("hex")}.tmp`
|
|
5464
5552
|
);
|
|
5465
5553
|
try {
|
|
5466
5554
|
await fs20.writeFile(tmpPath, content, "utf8");
|
|
@@ -5476,7 +5564,7 @@ async function writeClineCliMcpJsonAtomic(filePath, content) {
|
|
|
5476
5564
|
function memoraoneServerMatches8(server, expected) {
|
|
5477
5565
|
return canonicalValueMatches(server, expected);
|
|
5478
5566
|
}
|
|
5479
|
-
function validateClineCliMcpConfig(parsed2, expected) {
|
|
5567
|
+
function validateClineCliMcpConfig(parsed2, expected, serverName = CANONICAL_MEMORAONE_MCP_SERVER_NAME) {
|
|
5480
5568
|
if (!parsed2 || typeof parsed2 !== "object") {
|
|
5481
5569
|
throw new Error("[setup-ide-files] Cline CLI MCP config must be a JSON object.");
|
|
5482
5570
|
}
|
|
@@ -5484,7 +5572,8 @@ function validateClineCliMcpConfig(parsed2, expected) {
|
|
|
5484
5572
|
if (!mcpServers || typeof mcpServers !== "object" || Array.isArray(mcpServers)) {
|
|
5485
5573
|
throw new Error("[setup-ide-files] Cline CLI MCP config missing mcpServers object.");
|
|
5486
5574
|
}
|
|
5487
|
-
const
|
|
5575
|
+
const serverMap = mcpServers;
|
|
5576
|
+
const memoraone = serverMap[serverName] ?? Object.values(serverMap).find((entry) => memoraoneServerMatches8(entry, expected));
|
|
5488
5577
|
if (!memoraoneServerMatches8(memoraone, expected)) {
|
|
5489
5578
|
throw new Error(
|
|
5490
5579
|
"[setup-ide-files] Cline CLI MCP config mcpServers.memoraone is missing or invalid."
|
|
@@ -5496,7 +5585,7 @@ async function readJsonConfig6(filePath) {
|
|
|
5496
5585
|
if (raw.trim() === "") return null;
|
|
5497
5586
|
return JSON.parse(stripLeadingLineComments6(raw));
|
|
5498
5587
|
}
|
|
5499
|
-
async function prepareClineCliFile(filePath, memoraone) {
|
|
5588
|
+
async function prepareClineCliFile(filePath, memoraone, ownership) {
|
|
5500
5589
|
const existed = await pathExists9(filePath);
|
|
5501
5590
|
let existing = null;
|
|
5502
5591
|
if (existed) {
|
|
@@ -5509,13 +5598,9 @@ async function prepareClineCliFile(filePath, memoraone) {
|
|
|
5509
5598
|
throw new ClineCliMcpJsonParseError(filePath);
|
|
5510
5599
|
}
|
|
5511
5600
|
}
|
|
5512
|
-
const merged = mergeClineCliMcpConfigObject(existing, memoraone);
|
|
5601
|
+
const merged = mergeClineCliMcpConfigObject(existing, memoraone, ownership);
|
|
5513
5602
|
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
|
-
}
|
|
5603
|
+
const alreadyCorrect = Boolean(existed && existing && canonicalValueMatches(existing, merged));
|
|
5519
5604
|
return { filePath, existed, existing, merged, body, alreadyCorrect };
|
|
5520
5605
|
}
|
|
5521
5606
|
function outcomeForPrepared(prepared) {
|
|
@@ -5573,7 +5658,7 @@ async function setupClineCliMcpConfig(options) {
|
|
|
5573
5658
|
const defaults = getClineCliMcpConfigPaths(homeDir);
|
|
5574
5659
|
const rootConfigPath = options.rootConfigPath ?? defaults.rootConfigPath;
|
|
5575
5660
|
const settingsConfigPath = options.globalConfigPath ?? defaults.settingsConfigPath;
|
|
5576
|
-
const workspaceRoot =
|
|
5661
|
+
const workspaceRoot = path25.resolve(options.repoRoot);
|
|
5577
5662
|
const memoraone = await buildClineCliMemoraoneServer({
|
|
5578
5663
|
workspaceRoot,
|
|
5579
5664
|
devMode: options.devMode,
|
|
@@ -5583,8 +5668,12 @@ async function setupClineCliMcpConfig(options) {
|
|
|
5583
5668
|
npxPathOverride: options.npxPathOverride,
|
|
5584
5669
|
cliPathOverride: options.cliPathOverride
|
|
5585
5670
|
});
|
|
5586
|
-
const rootPrepared = await prepareClineCliFile(rootConfigPath, memoraone);
|
|
5587
|
-
const settingsPrepared = await prepareClineCliFile(
|
|
5671
|
+
const rootPrepared = await prepareClineCliFile(rootConfigPath, memoraone, options.ownership);
|
|
5672
|
+
const settingsPrepared = await prepareClineCliFile(
|
|
5673
|
+
settingsConfigPath,
|
|
5674
|
+
memoraone,
|
|
5675
|
+
options.ownership
|
|
5676
|
+
);
|
|
5588
5677
|
const rootOutcome = outcomeForPrepared(rootPrepared);
|
|
5589
5678
|
const settingsOutcome = outcomeForPrepared(settingsPrepared);
|
|
5590
5679
|
const outcome = combineClineCliOutcomes(rootOutcome, settingsOutcome);
|
|
@@ -5615,7 +5704,11 @@ async function setupClineCliMcpConfig(options) {
|
|
|
5615
5704
|
await writeClineCliMcpJsonAtomic(prepared.filePath, prepared.body);
|
|
5616
5705
|
const verifyRaw = await fs20.readFile(prepared.filePath, "utf8");
|
|
5617
5706
|
const verifyParsed = JSON.parse(stripLeadingLineComments6(verifyRaw));
|
|
5618
|
-
validateClineCliMcpConfig(
|
|
5707
|
+
validateClineCliMcpConfig(
|
|
5708
|
+
verifyParsed,
|
|
5709
|
+
memoraone,
|
|
5710
|
+
options.ownership ? memoraoneServerNameForRepositoryBinding(options.ownership.repositoryBindingId) : CANONICAL_MEMORAONE_MCP_SERVER_NAME
|
|
5711
|
+
);
|
|
5619
5712
|
}
|
|
5620
5713
|
return {
|
|
5621
5714
|
outcome,
|
|
@@ -5650,13 +5743,13 @@ function logClineCliMcpCliSummary(info, dryRun, println = console.log) {
|
|
|
5650
5743
|
"[setup-ide-files] Fully quit Cline CLI and reopen for MCP changes to take effect."
|
|
5651
5744
|
);
|
|
5652
5745
|
}
|
|
5653
|
-
var fs20, os7,
|
|
5746
|
+
var fs20, os7, path25, import_node_crypto11, CLINE_CLI_MCP_TIMEOUT_SECONDS, ClineCliMcpJsonParseError;
|
|
5654
5747
|
var init_clineCliMcpConfig = __esm({
|
|
5655
5748
|
"src/clineCliMcpConfig.ts"() {
|
|
5656
5749
|
fs20 = __toESM(require("fs/promises"), 1);
|
|
5657
5750
|
os7 = __toESM(require("os"), 1);
|
|
5658
|
-
|
|
5659
|
-
|
|
5751
|
+
path25 = __toESM(require("path"), 1);
|
|
5752
|
+
import_node_crypto11 = require("crypto");
|
|
5660
5753
|
init_configUtils();
|
|
5661
5754
|
init_cursorGlobalMcpConfig();
|
|
5662
5755
|
init_initializeBinding();
|
|
@@ -5689,7 +5782,7 @@ async function pathExists10(filePath) {
|
|
|
5689
5782
|
}
|
|
5690
5783
|
}
|
|
5691
5784
|
function getClaudeDesktopGlobalMcpConfigPath(homeDir) {
|
|
5692
|
-
return
|
|
5785
|
+
return path26.join(
|
|
5693
5786
|
homeDir,
|
|
5694
5787
|
"Library",
|
|
5695
5788
|
"Application Support",
|
|
@@ -5709,7 +5802,7 @@ function buildMemoraoneClaudeDesktopMcpServer(options) {
|
|
|
5709
5802
|
apiUrl: options.apiUrl ?? (environment === "local" ? DEV_API_URL : void 0)
|
|
5710
5803
|
}),
|
|
5711
5804
|
MEMORAONE_IDE_TYPE: "claude-desktop",
|
|
5712
|
-
[MEMORAONE_WORKSPACE_ROOT_ENV]:
|
|
5805
|
+
[MEMORAONE_WORKSPACE_ROOT_ENV]: path26.resolve(options.workspaceRoot)
|
|
5713
5806
|
};
|
|
5714
5807
|
if (environment === "local" || options.devMode) {
|
|
5715
5808
|
env2.MEMORAONE_DEV_MODE = "1";
|
|
@@ -5725,17 +5818,17 @@ function buildMemoraoneClaudeDesktopMcpServer(options) {
|
|
|
5725
5818
|
env: env2
|
|
5726
5819
|
};
|
|
5727
5820
|
}
|
|
5728
|
-
function mergeClaudeDesktopMcpConfigObject(existing, memoraone) {
|
|
5821
|
+
function mergeClaudeDesktopMcpConfigObject(existing, memoraone, ownership) {
|
|
5729
5822
|
const base = existing && typeof existing === "object" ? { ...existing } : { mcpServers: {} };
|
|
5730
5823
|
const mcpServers = typeof base.mcpServers === "object" && base.mcpServers !== null && !Array.isArray(base.mcpServers) ? { ...base.mcpServers } : {};
|
|
5731
|
-
return { ...base, mcpServers: replaceMemoraoneOwnedInServerMap(mcpServers, memoraone) };
|
|
5824
|
+
return { ...base, mcpServers: ownership ? replaceMemoraoneRepositoryBindingInServerMap(mcpServers, memoraone, ownership) : replaceMemoraoneOwnedInServerMap(mcpServers, memoraone) };
|
|
5732
5825
|
}
|
|
5733
5826
|
async function writeClaudeDesktopMcpJsonAtomic(filePath, content) {
|
|
5734
|
-
const dir =
|
|
5827
|
+
const dir = path26.dirname(filePath);
|
|
5735
5828
|
await fs21.mkdir(dir, { recursive: true });
|
|
5736
|
-
const tmpPath =
|
|
5829
|
+
const tmpPath = path26.join(
|
|
5737
5830
|
dir,
|
|
5738
|
-
`.${
|
|
5831
|
+
`.${path26.basename(filePath)}.${process.pid}.${(0, import_node_crypto12.randomBytes)(8).toString("hex")}.tmp`
|
|
5739
5832
|
);
|
|
5740
5833
|
try {
|
|
5741
5834
|
await fs21.writeFile(tmpPath, content, "utf8");
|
|
@@ -5751,7 +5844,7 @@ async function writeClaudeDesktopMcpJsonAtomic(filePath, content) {
|
|
|
5751
5844
|
function memoraoneServerMatches9(server, expected) {
|
|
5752
5845
|
return canonicalValueMatches(server, expected);
|
|
5753
5846
|
}
|
|
5754
|
-
function validateClaudeDesktopMcpConfig(parsed2, expected) {
|
|
5847
|
+
function validateClaudeDesktopMcpConfig(parsed2, expected, serverName = CANONICAL_MEMORAONE_MCP_SERVER_NAME) {
|
|
5755
5848
|
if (!parsed2 || typeof parsed2 !== "object") {
|
|
5756
5849
|
throw new Error("[setup-ide-files] Claude Desktop MCP config must be a JSON object.");
|
|
5757
5850
|
}
|
|
@@ -5759,7 +5852,8 @@ function validateClaudeDesktopMcpConfig(parsed2, expected) {
|
|
|
5759
5852
|
if (!mcpServers || typeof mcpServers !== "object" || Array.isArray(mcpServers)) {
|
|
5760
5853
|
throw new Error("[setup-ide-files] Claude Desktop MCP config missing mcpServers object.");
|
|
5761
5854
|
}
|
|
5762
|
-
const
|
|
5855
|
+
const serverMap = mcpServers;
|
|
5856
|
+
const memoraone = serverMap[serverName] ?? Object.values(serverMap).find((entry) => memoraoneServerMatches9(entry, expected));
|
|
5763
5857
|
if (!memoraoneServerMatches9(memoraone, expected)) {
|
|
5764
5858
|
throw new Error(
|
|
5765
5859
|
"[setup-ide-files] Claude Desktop MCP config mcpServers.memoraone is missing or invalid."
|
|
@@ -5819,7 +5913,7 @@ async function buildClaudeDesktopMemoraoneServer(options) {
|
|
|
5819
5913
|
async function setupClaudeDesktopMcpConfig(options) {
|
|
5820
5914
|
const homeDir = options.homeDir ?? os8.homedir();
|
|
5821
5915
|
const activePath = options.globalConfigPath ?? getClaudeDesktopGlobalMcpConfigPath(homeDir);
|
|
5822
|
-
const workspaceRoot =
|
|
5916
|
+
const workspaceRoot = path26.resolve(options.repoRoot);
|
|
5823
5917
|
const memoraone = await buildClaudeDesktopMemoraoneServer({
|
|
5824
5918
|
workspaceRoot,
|
|
5825
5919
|
devMode: options.devMode,
|
|
@@ -5841,11 +5935,10 @@ async function setupClaudeDesktopMcpConfig(options) {
|
|
|
5841
5935
|
throw new ClaudeDesktopMcpJsonParseError(activePath);
|
|
5842
5936
|
}
|
|
5843
5937
|
}
|
|
5844
|
-
const merged = mergeClaudeDesktopMcpConfigObject(existing, memoraone);
|
|
5938
|
+
const merged = mergeClaudeDesktopMcpConfigObject(existing, memoraone, options.ownership);
|
|
5845
5939
|
const body = JSON.stringify(merged, null, 2) + "\n";
|
|
5846
5940
|
if (existed && existing) {
|
|
5847
|
-
|
|
5848
|
-
if (memoraoneServerMatches9(currentMemoraone, memoraone)) {
|
|
5941
|
+
if (canonicalValueMatches(existing, merged)) {
|
|
5849
5942
|
return { outcome: "skipped", memoraone, activeConfigPath: activePath };
|
|
5850
5943
|
}
|
|
5851
5944
|
}
|
|
@@ -5863,7 +5956,7 @@ async function setupClaudeDesktopMcpConfig(options) {
|
|
|
5863
5956
|
await writeClaudeDesktopMcpJsonAtomic(activePath, body);
|
|
5864
5957
|
const verifyRaw = await fs21.readFile(activePath, "utf8");
|
|
5865
5958
|
const verifyParsed = JSON.parse(stripLeadingLineComments7(verifyRaw));
|
|
5866
|
-
validateClaudeDesktopMcpConfig(verifyParsed, memoraone);
|
|
5959
|
+
validateClaudeDesktopMcpConfig(verifyParsed, memoraone, options.ownership ? memoraoneServerNameForRepositoryBinding(options.ownership.repositoryBindingId) : CANONICAL_MEMORAONE_MCP_SERVER_NAME);
|
|
5867
5960
|
return {
|
|
5868
5961
|
outcome: existed ? "updated" : "created",
|
|
5869
5962
|
backupPath,
|
|
@@ -5897,13 +5990,13 @@ function logClaudeDesktopMcpCliSummary(info, dryRun, println = console.log) {
|
|
|
5897
5990
|
"[setup-ide-files] Fully quit Claude Desktop and reopen for MCP changes to take effect."
|
|
5898
5991
|
);
|
|
5899
5992
|
}
|
|
5900
|
-
var fs21, os8,
|
|
5993
|
+
var fs21, os8, path26, import_node_crypto12, ClaudeDesktopMcpJsonParseError;
|
|
5901
5994
|
var init_claudeDesktopMcpConfig = __esm({
|
|
5902
5995
|
"src/claudeDesktopMcpConfig.ts"() {
|
|
5903
5996
|
fs21 = __toESM(require("fs/promises"), 1);
|
|
5904
5997
|
os8 = __toESM(require("os"), 1);
|
|
5905
|
-
|
|
5906
|
-
|
|
5998
|
+
path26 = __toESM(require("path"), 1);
|
|
5999
|
+
import_node_crypto12 = require("crypto");
|
|
5907
6000
|
init_configUtils();
|
|
5908
6001
|
init_cursorGlobalMcpConfig();
|
|
5909
6002
|
init_initializeBinding();
|
|
@@ -5935,7 +6028,7 @@ async function pathExists11(filePath) {
|
|
|
5935
6028
|
}
|
|
5936
6029
|
}
|
|
5937
6030
|
function getZedProjectMcpConfigPath(repoRoot) {
|
|
5938
|
-
return
|
|
6031
|
+
return path27.join(path27.resolve(repoRoot), ".zed", "settings.json");
|
|
5939
6032
|
}
|
|
5940
6033
|
function buildMemoraoneZedMcpServer(options) {
|
|
5941
6034
|
const environment = options.environment ?? (options.devMode ? "local" : "production");
|
|
@@ -5945,7 +6038,7 @@ function buildMemoraoneZedMcpServer(options) {
|
|
|
5945
6038
|
apiUrl: options.apiUrl ?? (environment === "local" ? DEV_API_URL : void 0)
|
|
5946
6039
|
}),
|
|
5947
6040
|
MEMORAONE_IDE_TYPE: "zed",
|
|
5948
|
-
[MEMORAONE_WORKSPACE_ROOT_ENV]:
|
|
6041
|
+
[MEMORAONE_WORKSPACE_ROOT_ENV]: path27.resolve(options.workspaceRoot)
|
|
5949
6042
|
};
|
|
5950
6043
|
if (environment === "local" || options.devMode) {
|
|
5951
6044
|
env2.MEMORAONE_DEV_MODE = "1";
|
|
@@ -5970,11 +6063,11 @@ function mergeZedMcpConfigObject(existing, memoraone) {
|
|
|
5970
6063
|
};
|
|
5971
6064
|
}
|
|
5972
6065
|
async function writeZedMcpJsonAtomic(filePath, content) {
|
|
5973
|
-
const dir =
|
|
6066
|
+
const dir = path27.dirname(filePath);
|
|
5974
6067
|
await fs22.mkdir(dir, { recursive: true });
|
|
5975
|
-
const tmpPath =
|
|
6068
|
+
const tmpPath = path27.join(
|
|
5976
6069
|
dir,
|
|
5977
|
-
`.${
|
|
6070
|
+
`.${path27.basename(filePath)}.${process.pid}.${(0, import_node_crypto13.randomBytes)(8).toString("hex")}.tmp`
|
|
5978
6071
|
);
|
|
5979
6072
|
try {
|
|
5980
6073
|
await fs22.writeFile(tmpPath, content, "utf8");
|
|
@@ -6052,7 +6145,7 @@ async function buildZedMemoraoneServer(options) {
|
|
|
6052
6145
|
}
|
|
6053
6146
|
async function setupZedMcpConfig(options) {
|
|
6054
6147
|
const projectPath = options.projectConfigPath ?? getZedProjectMcpConfigPath(options.repoRoot);
|
|
6055
|
-
const workspaceRoot =
|
|
6148
|
+
const workspaceRoot = path27.resolve(options.repoRoot);
|
|
6056
6149
|
const memoraone = await buildZedMemoraoneServer({
|
|
6057
6150
|
workspaceRoot,
|
|
6058
6151
|
devMode: options.devMode,
|
|
@@ -6115,12 +6208,12 @@ function logZedMcpCliSummary(info, dryRun, println = console.log) {
|
|
|
6115
6208
|
"[setup-ide-files] Fully quit Zed and reopen this repo for MCP changes to take effect."
|
|
6116
6209
|
);
|
|
6117
6210
|
}
|
|
6118
|
-
var fs22,
|
|
6211
|
+
var fs22, path27, import_node_crypto13, ZedMcpJsonParseError;
|
|
6119
6212
|
var init_zedMcpConfig = __esm({
|
|
6120
6213
|
"src/zedMcpConfig.ts"() {
|
|
6121
6214
|
fs22 = __toESM(require("fs/promises"), 1);
|
|
6122
|
-
|
|
6123
|
-
|
|
6215
|
+
path27 = __toESM(require("path"), 1);
|
|
6216
|
+
import_node_crypto13 = require("crypto");
|
|
6124
6217
|
init_configUtils();
|
|
6125
6218
|
init_cursorGlobalMcpConfig();
|
|
6126
6219
|
init_initializeBinding();
|
|
@@ -6152,7 +6245,7 @@ async function pathExists12(filePath) {
|
|
|
6152
6245
|
}
|
|
6153
6246
|
}
|
|
6154
6247
|
function getVisualStudioProjectMcpConfigPath(repoRoot) {
|
|
6155
|
-
return
|
|
6248
|
+
return path28.join(path28.resolve(repoRoot), ".vs", "mcp.json");
|
|
6156
6249
|
}
|
|
6157
6250
|
function buildMemoraoneVisualStudioMcpServer(options) {
|
|
6158
6251
|
const environment = options.environment ?? (options.devMode ? "local" : "production");
|
|
@@ -6162,7 +6255,7 @@ function buildMemoraoneVisualStudioMcpServer(options) {
|
|
|
6162
6255
|
apiUrl: options.apiUrl ?? (environment === "local" ? DEV_API_URL : void 0)
|
|
6163
6256
|
}),
|
|
6164
6257
|
MEMORAONE_IDE_TYPE: "visual-studio",
|
|
6165
|
-
[MEMORAONE_WORKSPACE_ROOT_ENV]:
|
|
6258
|
+
[MEMORAONE_WORKSPACE_ROOT_ENV]: path28.resolve(options.workspaceRoot)
|
|
6166
6259
|
};
|
|
6167
6260
|
if (environment === "local" || options.devMode) {
|
|
6168
6261
|
env2.MEMORAONE_DEV_MODE = "1";
|
|
@@ -6185,11 +6278,11 @@ function mergeVisualStudioMcpConfigObject(existing, memoraone) {
|
|
|
6185
6278
|
return { ...base, servers: replaceMemoraoneOwnedInServerMap(servers, memoraone) };
|
|
6186
6279
|
}
|
|
6187
6280
|
async function writeVisualStudioMcpJsonAtomic(filePath, content) {
|
|
6188
|
-
const dir =
|
|
6281
|
+
const dir = path28.dirname(filePath);
|
|
6189
6282
|
await fs23.mkdir(dir, { recursive: true });
|
|
6190
|
-
const tmpPath =
|
|
6283
|
+
const tmpPath = path28.join(
|
|
6191
6284
|
dir,
|
|
6192
|
-
`.${
|
|
6285
|
+
`.${path28.basename(filePath)}.${process.pid}.${(0, import_node_crypto14.randomBytes)(8).toString("hex")}.tmp`
|
|
6193
6286
|
);
|
|
6194
6287
|
try {
|
|
6195
6288
|
await fs23.writeFile(tmpPath, content, "utf8");
|
|
@@ -6267,7 +6360,7 @@ async function buildVisualStudioMemoraoneServer(options) {
|
|
|
6267
6360
|
}
|
|
6268
6361
|
async function setupVisualStudioMcpConfig(options) {
|
|
6269
6362
|
const projectPath = options.projectConfigPath ?? getVisualStudioProjectMcpConfigPath(options.repoRoot);
|
|
6270
|
-
const workspaceRoot =
|
|
6363
|
+
const workspaceRoot = path28.resolve(options.repoRoot);
|
|
6271
6364
|
const memoraone = await buildVisualStudioMemoraoneServer({
|
|
6272
6365
|
workspaceRoot,
|
|
6273
6366
|
devMode: options.devMode,
|
|
@@ -6332,12 +6425,12 @@ function logVisualStudioMcpCliSummary(info, dryRun, println = console.log) {
|
|
|
6332
6425
|
"[setup-ide-files] Fully quit Visual Studio and reopen this repo for MCP changes to take effect."
|
|
6333
6426
|
);
|
|
6334
6427
|
}
|
|
6335
|
-
var fs23,
|
|
6428
|
+
var fs23, path28, import_node_crypto14, VisualStudioMcpJsonParseError;
|
|
6336
6429
|
var init_visualStudioMcpConfig = __esm({
|
|
6337
6430
|
"src/visualStudioMcpConfig.ts"() {
|
|
6338
6431
|
fs23 = __toESM(require("fs/promises"), 1);
|
|
6339
|
-
|
|
6340
|
-
|
|
6432
|
+
path28 = __toESM(require("path"), 1);
|
|
6433
|
+
import_node_crypto14 = require("crypto");
|
|
6341
6434
|
init_configUtils();
|
|
6342
6435
|
init_cursorGlobalMcpConfig();
|
|
6343
6436
|
init_initializeBinding();
|
|
@@ -6366,7 +6459,7 @@ async function pathExists13(filePath) {
|
|
|
6366
6459
|
}
|
|
6367
6460
|
}
|
|
6368
6461
|
function getContinueProjectMcpConfigPath(repoRoot) {
|
|
6369
|
-
return
|
|
6462
|
+
return path29.join(path29.resolve(repoRoot), ".continue", "mcpServers", "memoraone.yaml");
|
|
6370
6463
|
}
|
|
6371
6464
|
function buildMemoraoneContinueMcpServer(options) {
|
|
6372
6465
|
const environment = options.environment ?? (options.devMode ? "local" : "production");
|
|
@@ -6376,7 +6469,7 @@ function buildMemoraoneContinueMcpServer(options) {
|
|
|
6376
6469
|
apiUrl: options.apiUrl ?? (environment === "local" ? DEV_API_URL : void 0)
|
|
6377
6470
|
}),
|
|
6378
6471
|
MEMORAONE_IDE_TYPE: "continue",
|
|
6379
|
-
[MEMORAONE_WORKSPACE_ROOT_ENV]:
|
|
6472
|
+
[MEMORAONE_WORKSPACE_ROOT_ENV]: path29.resolve(options.workspaceRoot)
|
|
6380
6473
|
};
|
|
6381
6474
|
if (environment === "local" || options.devMode) {
|
|
6382
6475
|
env2.MEMORAONE_DEV_MODE = "1";
|
|
@@ -6425,11 +6518,11 @@ function mergeContinueMcpConfigObject(existing, memoraone) {
|
|
|
6425
6518
|
return base;
|
|
6426
6519
|
}
|
|
6427
6520
|
async function writeContinueMcpYamlAtomic(filePath, content) {
|
|
6428
|
-
const dir =
|
|
6521
|
+
const dir = path29.dirname(filePath);
|
|
6429
6522
|
await fs24.mkdir(dir, { recursive: true });
|
|
6430
|
-
const tmpPath =
|
|
6523
|
+
const tmpPath = path29.join(
|
|
6431
6524
|
dir,
|
|
6432
|
-
`.${
|
|
6525
|
+
`.${path29.basename(filePath)}.${process.pid}.${(0, import_node_crypto15.randomBytes)(8).toString("hex")}.tmp`
|
|
6433
6526
|
);
|
|
6434
6527
|
try {
|
|
6435
6528
|
await fs24.writeFile(tmpPath, content, "utf8");
|
|
@@ -6517,7 +6610,7 @@ async function buildContinueMemoraoneServer(options) {
|
|
|
6517
6610
|
}
|
|
6518
6611
|
async function setupContinueMcpConfig(options) {
|
|
6519
6612
|
const projectPath = options.projectConfigPath ?? getContinueProjectMcpConfigPath(options.repoRoot);
|
|
6520
|
-
const workspaceRoot =
|
|
6613
|
+
const workspaceRoot = path29.resolve(options.repoRoot);
|
|
6521
6614
|
const memoraone = await buildContinueMemoraoneServer({
|
|
6522
6615
|
workspaceRoot,
|
|
6523
6616
|
devMode: options.devMode,
|
|
@@ -6590,12 +6683,12 @@ function logContinueMcpCliSummary(info, dryRun, println = console.log) {
|
|
|
6590
6683
|
"[setup-ide-files] Fully quit Continue and reopen this repo for MCP changes to take effect."
|
|
6591
6684
|
);
|
|
6592
6685
|
}
|
|
6593
|
-
var fs24,
|
|
6686
|
+
var fs24, path29, import_node_crypto15, import_yaml, ContinueMcpYamlParseError;
|
|
6594
6687
|
var init_continueMcpConfig = __esm({
|
|
6595
6688
|
"src/continueMcpConfig.ts"() {
|
|
6596
6689
|
fs24 = __toESM(require("fs/promises"), 1);
|
|
6597
|
-
|
|
6598
|
-
|
|
6690
|
+
path29 = __toESM(require("path"), 1);
|
|
6691
|
+
import_node_crypto15 = require("crypto");
|
|
6599
6692
|
import_yaml = require("yaml");
|
|
6600
6693
|
init_configUtils();
|
|
6601
6694
|
init_cursorGlobalMcpConfig();
|
|
@@ -6627,49 +6720,8 @@ async function pathExists14(filePath) {
|
|
|
6627
6720
|
return false;
|
|
6628
6721
|
}
|
|
6629
6722
|
}
|
|
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;
|
|
6723
|
+
function getClineProjectMcpConfigPath(repoRoot) {
|
|
6724
|
+
return path30.join(path30.resolve(repoRoot), ".cline", "mcp.json");
|
|
6673
6725
|
}
|
|
6674
6726
|
function formatClineBackupTimestamp(d = /* @__PURE__ */ new Date()) {
|
|
6675
6727
|
const pad = (n) => String(n).padStart(2, "0");
|
|
@@ -6683,21 +6735,10 @@ function buildMemoraoneClineMcpServer(options) {
|
|
|
6683
6735
|
apiUrl: options.apiUrl ?? (environment === "local" ? DEV_API_URL : void 0)
|
|
6684
6736
|
}),
|
|
6685
6737
|
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
|
|
6738
|
+
[MEMORAONE_WORKSPACE_ROOT_ENV]: path30.resolve(options.workspaceRoot)
|
|
6700
6739
|
};
|
|
6740
|
+
if (environment === "local" || options.devMode) env2.MEMORAONE_DEV_MODE = "1";
|
|
6741
|
+
return { command: options.command, args: options.args, env: env2 };
|
|
6701
6742
|
}
|
|
6702
6743
|
function mergeClineMcpConfigObject(existing, memoraone) {
|
|
6703
6744
|
const base = existing && typeof existing === "object" ? { ...existing } : { mcpServers: {} };
|
|
@@ -6705,11 +6746,11 @@ function mergeClineMcpConfigObject(existing, memoraone) {
|
|
|
6705
6746
|
return { ...base, mcpServers: replaceMemoraoneOwnedInServerMap(mcpServers, memoraone) };
|
|
6706
6747
|
}
|
|
6707
6748
|
async function writeClineMcpJsonAtomic(filePath, content) {
|
|
6708
|
-
const dir =
|
|
6749
|
+
const dir = path30.dirname(filePath);
|
|
6709
6750
|
await fs25.mkdir(dir, { recursive: true });
|
|
6710
|
-
const tmpPath =
|
|
6751
|
+
const tmpPath = path30.join(
|
|
6711
6752
|
dir,
|
|
6712
|
-
`.${
|
|
6753
|
+
`.${path30.basename(filePath)}.${process.pid}.${(0, import_node_crypto16.randomBytes)(8).toString("hex")}.tmp`
|
|
6713
6754
|
);
|
|
6714
6755
|
try {
|
|
6715
6756
|
await fs25.writeFile(tmpPath, content, "utf8");
|
|
@@ -6733,11 +6774,9 @@ function validateClineMcpConfig(parsed2, expected) {
|
|
|
6733
6774
|
if (!mcpServers || typeof mcpServers !== "object" || Array.isArray(mcpServers)) {
|
|
6734
6775
|
throw new Error("[setup-ide-files] Cline MCP config missing mcpServers object.");
|
|
6735
6776
|
}
|
|
6736
|
-
const memoraone = mcpServers
|
|
6777
|
+
const memoraone = mcpServers[CANONICAL_MEMORAONE_MCP_SERVER_NAME];
|
|
6737
6778
|
if (!memoraoneServerMatches13(memoraone, expected)) {
|
|
6738
|
-
throw new Error(
|
|
6739
|
-
"[setup-ide-files] Cline MCP config mcpServers.memoraone is missing or invalid."
|
|
6740
|
-
);
|
|
6779
|
+
throw new Error("[setup-ide-files] Cline MCP config mcpServers.memoraone is missing or invalid.");
|
|
6741
6780
|
}
|
|
6742
6781
|
}
|
|
6743
6782
|
async function readJsonConfig10(filePath) {
|
|
@@ -6754,13 +6793,9 @@ async function buildClineMemoraoneServer(options) {
|
|
|
6754
6793
|
const environment = options.environment ?? (options.devMode ? "local" : "production");
|
|
6755
6794
|
if (environment === "local" || options.devMode) {
|
|
6756
6795
|
let cliPath = options.cliPathOverride;
|
|
6757
|
-
if (cliPath === void 0)
|
|
6758
|
-
cliPath = await resolveLocalCliPathAsync();
|
|
6759
|
-
}
|
|
6796
|
+
if (cliPath === void 0) cliPath = await resolveLocalCliPathAsync();
|
|
6760
6797
|
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
|
-
);
|
|
6798
|
+
throw new Error("[setup-ide-files] Dev mode requires a built CLI at packages/mcp/dist/cli.cjs. Run pnpm build first.");
|
|
6764
6799
|
}
|
|
6765
6800
|
return buildMemoraoneClineMcpServer({
|
|
6766
6801
|
command: process.execPath,
|
|
@@ -6772,82 +6807,22 @@ async function buildClineMemoraoneServer(options) {
|
|
|
6772
6807
|
});
|
|
6773
6808
|
}
|
|
6774
6809
|
let npxPath = options.npxPathOverride;
|
|
6775
|
-
if (npxPath === void 0)
|
|
6776
|
-
npxPath = await resolveNpxPath();
|
|
6777
|
-
}
|
|
6810
|
+
if (npxPath === void 0) npxPath = await resolveNpxPath();
|
|
6778
6811
|
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
|
-
);
|
|
6812
|
+
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
6813
|
}
|
|
6783
6814
|
const channel = options.npmPackageChannel ?? npmPackageChannelFromEnvironment(environment);
|
|
6784
6815
|
return buildMemoraoneClineMcpServer({
|
|
6785
6816
|
command: npxPath,
|
|
6786
6817
|
args: ["-y", memoraoneNpmPackageSpec(channel)],
|
|
6787
|
-
workspaceRoot: options.workspaceRoot,
|
|
6788
|
-
environment,
|
|
6789
|
-
|
|
6790
|
-
|
|
6791
|
-
});
|
|
6792
|
-
}
|
|
6793
|
-
async function setupOneClineHost(options) {
|
|
6794
|
-
const { configPath, hostId, memoraone, dryRun } = options;
|
|
6795
|
-
const existed = await pathExists14(configPath);
|
|
6796
|
-
let existing = null;
|
|
6797
|
-
if (existed) {
|
|
6798
|
-
try {
|
|
6799
|
-
existing = await readJsonConfig10(configPath);
|
|
6800
|
-
} catch {
|
|
6801
|
-
throw new ClineMcpJsonParseError(configPath);
|
|
6802
|
-
}
|
|
6803
|
-
if (existing !== null && (typeof existing !== "object" || Array.isArray(existing))) {
|
|
6804
|
-
throw new ClineMcpJsonParseError(configPath);
|
|
6805
|
-
}
|
|
6806
|
-
}
|
|
6807
|
-
const merged = mergeClineMcpConfigObject(existing, memoraone);
|
|
6808
|
-
const body = JSON.stringify(merged, null, 2) + "\n";
|
|
6809
|
-
if (existed && existing) {
|
|
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
|
-
};
|
|
6818
|
+
workspaceRoot: options.workspaceRoot,
|
|
6819
|
+
environment,
|
|
6820
|
+
apiUrl: options.apiUrl
|
|
6821
|
+
});
|
|
6836
6822
|
}
|
|
6837
6823
|
async function setupClineMcpConfig(options) {
|
|
6838
|
-
const
|
|
6839
|
-
const
|
|
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
|
-
}
|
|
6824
|
+
const workspaceRoot = path30.resolve(options.repoRoot);
|
|
6825
|
+
const configPath = options.projectConfigPath ?? getClineProjectMcpConfigPath(workspaceRoot);
|
|
6851
6826
|
const memoraone = await buildClineMemoraoneServer({
|
|
6852
6827
|
workspaceRoot,
|
|
6853
6828
|
devMode: options.devMode,
|
|
@@ -6857,91 +6832,63 @@ async function setupClineMcpConfig(options) {
|
|
|
6857
6832
|
npxPathOverride: options.npxPathOverride,
|
|
6858
6833
|
cliPathOverride: options.cliPathOverride
|
|
6859
6834
|
});
|
|
6860
|
-
const
|
|
6861
|
-
|
|
6862
|
-
|
|
6863
|
-
|
|
6864
|
-
|
|
6865
|
-
|
|
6866
|
-
|
|
6867
|
-
|
|
6868
|
-
|
|
6869
|
-
|
|
6835
|
+
const existed = await pathExists14(configPath);
|
|
6836
|
+
let existing = null;
|
|
6837
|
+
if (existed) {
|
|
6838
|
+
try {
|
|
6839
|
+
existing = await readJsonConfig10(configPath);
|
|
6840
|
+
} catch {
|
|
6841
|
+
throw new ClineMcpJsonParseError(configPath);
|
|
6842
|
+
}
|
|
6843
|
+
if (existing !== null && (typeof existing !== "object" || Array.isArray(existing))) {
|
|
6844
|
+
throw new ClineMcpJsonParseError(configPath);
|
|
6845
|
+
}
|
|
6846
|
+
}
|
|
6847
|
+
const merged = mergeClineMcpConfigObject(existing, memoraone);
|
|
6848
|
+
if (existed && existing && canonicalValueMatches(existing, merged)) {
|
|
6849
|
+
return { activeConfigPath: configPath, outcome: "skipped", memoraone };
|
|
6870
6850
|
}
|
|
6871
|
-
|
|
6851
|
+
const outcome = existed ? "updated" : "created";
|
|
6852
|
+
if (options.dryRun) return { activeConfigPath: configPath, outcome, memoraone };
|
|
6853
|
+
const backupPath = existed ? await backupConfigFile4(configPath) : void 0;
|
|
6854
|
+
await writeClineMcpJsonAtomic(configPath, JSON.stringify(merged, null, 2) + "\n");
|
|
6855
|
+
validateClineMcpConfig(JSON.parse(await fs25.readFile(configPath, "utf8")), memoraone);
|
|
6856
|
+
return { activeConfigPath: configPath, outcome, backupPath, memoraone };
|
|
6872
6857
|
}
|
|
6873
6858
|
function logClineMcpCliSummary(info, dryRun, println = console.log) {
|
|
6874
6859
|
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}`);
|
|
6860
|
+
if (info.outcome === "created") {
|
|
6861
|
+
println(`[setup-ide-files] Cline MCP config ${prefix}created: ${info.activeConfigPath}`);
|
|
6862
|
+
} else if (info.outcome === "updated") {
|
|
6863
|
+
println(`[setup-ide-files] Cline MCP config ${prefix}updated: ${info.activeConfigPath}`);
|
|
6864
|
+
} else {
|
|
6865
|
+
println(`[setup-ide-files] Cline MCP config unchanged: ${info.activeConfigPath}`);
|
|
6896
6866
|
}
|
|
6897
|
-
println(
|
|
6898
|
-
|
|
6899
|
-
);
|
|
6867
|
+
if (info.backupPath) println(`[setup-ide-files] Cline MCP config backup: ${info.backupPath}`);
|
|
6868
|
+
if (info.npxPath) println(`[setup-ide-files] Resolved npx: ${info.npxPath}`);
|
|
6869
|
+
println("[setup-ide-files] Fully quit Cline and reopen this repository for MCP changes to take effect.");
|
|
6900
6870
|
}
|
|
6901
|
-
var
|
|
6871
|
+
var import_node_crypto16, fs25, path30, ClineMcpJsonParseError;
|
|
6902
6872
|
var init_clineMcpConfig = __esm({
|
|
6903
6873
|
"src/clineMcpConfig.ts"() {
|
|
6874
|
+
import_node_crypto16 = require("crypto");
|
|
6904
6875
|
fs25 = __toESM(require("fs/promises"), 1);
|
|
6905
|
-
|
|
6906
|
-
path29 = __toESM(require("path"), 1);
|
|
6907
|
-
import_node_crypto15 = require("crypto");
|
|
6876
|
+
path30 = __toESM(require("path"), 1);
|
|
6908
6877
|
init_configUtils();
|
|
6909
6878
|
init_cursorGlobalMcpConfig();
|
|
6910
6879
|
init_initializeBinding();
|
|
6911
6880
|
init_jetbrainsMcpConfig();
|
|
6912
6881
|
init_packageExecutionMode();
|
|
6913
6882
|
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
6883
|
ClineMcpJsonParseError = class extends Error {
|
|
6928
6884
|
constructor(configPath) {
|
|
6929
6885
|
super(
|
|
6930
|
-
`[setup-ide-files] Invalid JSON in
|
|
6886
|
+
`[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
6887
|
);
|
|
6932
6888
|
this.name = "ClineMcpJsonParseError";
|
|
6933
6889
|
this.configPath = configPath;
|
|
6934
6890
|
}
|
|
6935
6891
|
};
|
|
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
6892
|
}
|
|
6946
6893
|
});
|
|
6947
6894
|
|
|
@@ -6958,7 +6905,7 @@ async function pathExists15(filePath) {
|
|
|
6958
6905
|
}
|
|
6959
6906
|
}
|
|
6960
6907
|
function getCopilotCliProjectMcpConfigPath(repoRoot) {
|
|
6961
|
-
return
|
|
6908
|
+
return path31.join(path31.resolve(repoRoot), ".github", "mcp.json");
|
|
6962
6909
|
}
|
|
6963
6910
|
function buildMemoraoneCopilotCliMcpServer(options) {
|
|
6964
6911
|
const environment = options.environment ?? (options.devMode ? "local" : "production");
|
|
@@ -6968,7 +6915,7 @@ function buildMemoraoneCopilotCliMcpServer(options) {
|
|
|
6968
6915
|
apiUrl: options.apiUrl ?? (environment === "local" ? DEV_API_URL : void 0)
|
|
6969
6916
|
}),
|
|
6970
6917
|
MEMORAONE_IDE_TYPE: "copilot-cli",
|
|
6971
|
-
[MEMORAONE_WORKSPACE_ROOT_ENV]:
|
|
6918
|
+
[MEMORAONE_WORKSPACE_ROOT_ENV]: path31.resolve(options.workspaceRoot)
|
|
6972
6919
|
};
|
|
6973
6920
|
if (environment === "local" || options.devMode) {
|
|
6974
6921
|
env2.MEMORAONE_DEV_MODE = "1";
|
|
@@ -6991,11 +6938,11 @@ function mergeCopilotCliMcpConfigObject(existing, memoraone) {
|
|
|
6991
6938
|
return { ...base, mcpServers: replaceMemoraoneOwnedInServerMap(mcpServers, memoraone) };
|
|
6992
6939
|
}
|
|
6993
6940
|
async function writeCopilotCliMcpJsonAtomic(filePath, content) {
|
|
6994
|
-
const dir =
|
|
6941
|
+
const dir = path31.dirname(filePath);
|
|
6995
6942
|
await fs26.mkdir(dir, { recursive: true });
|
|
6996
|
-
const tmpPath =
|
|
6943
|
+
const tmpPath = path31.join(
|
|
6997
6944
|
dir,
|
|
6998
|
-
`.${
|
|
6945
|
+
`.${path31.basename(filePath)}.${process.pid}.${(0, import_node_crypto17.randomBytes)(8).toString("hex")}.tmp`
|
|
6999
6946
|
);
|
|
7000
6947
|
try {
|
|
7001
6948
|
await fs26.writeFile(tmpPath, content, "utf8");
|
|
@@ -7073,7 +7020,7 @@ async function buildCopilotCliMemoraoneServer(options) {
|
|
|
7073
7020
|
}
|
|
7074
7021
|
async function setupCopilotCliMcpConfig(options) {
|
|
7075
7022
|
const projectPath = options.projectConfigPath ?? getCopilotCliProjectMcpConfigPath(options.repoRoot);
|
|
7076
|
-
const workspaceRoot =
|
|
7023
|
+
const workspaceRoot = path31.resolve(options.repoRoot);
|
|
7077
7024
|
const memoraone = await buildCopilotCliMemoraoneServer({
|
|
7078
7025
|
workspaceRoot,
|
|
7079
7026
|
devMode: options.devMode,
|
|
@@ -7138,12 +7085,12 @@ function logCopilotCliMcpCliSummary(info, dryRun, println = console.log) {
|
|
|
7138
7085
|
"[setup-ide-files] Fully quit Copilot CLI and reopen this repo for MCP changes to take effect."
|
|
7139
7086
|
);
|
|
7140
7087
|
}
|
|
7141
|
-
var fs26,
|
|
7088
|
+
var fs26, path31, import_node_crypto17, CopilotCliMcpJsonParseError;
|
|
7142
7089
|
var init_copilotCliMcpConfig = __esm({
|
|
7143
7090
|
"src/copilotCliMcpConfig.ts"() {
|
|
7144
7091
|
fs26 = __toESM(require("fs/promises"), 1);
|
|
7145
|
-
|
|
7146
|
-
|
|
7092
|
+
path31 = __toESM(require("path"), 1);
|
|
7093
|
+
import_node_crypto17 = require("crypto");
|
|
7147
7094
|
init_configUtils();
|
|
7148
7095
|
init_cursorGlobalMcpConfig();
|
|
7149
7096
|
init_initializeBinding();
|
|
@@ -7175,7 +7122,7 @@ async function pathExists16(filePath) {
|
|
|
7175
7122
|
}
|
|
7176
7123
|
}
|
|
7177
7124
|
function getAuggieProjectMcpConfigPath(repoRoot) {
|
|
7178
|
-
return
|
|
7125
|
+
return path32.join(path32.resolve(repoRoot), ".augment", "settings.json");
|
|
7179
7126
|
}
|
|
7180
7127
|
function buildMemoraoneAuggieMcpServer(options) {
|
|
7181
7128
|
const environment = options.environment ?? (options.devMode ? "local" : "production");
|
|
@@ -7185,7 +7132,7 @@ function buildMemoraoneAuggieMcpServer(options) {
|
|
|
7185
7132
|
apiUrl: options.apiUrl ?? (environment === "local" ? DEV_API_URL : void 0)
|
|
7186
7133
|
}),
|
|
7187
7134
|
MEMORAONE_IDE_TYPE: "auggie",
|
|
7188
|
-
[MEMORAONE_WORKSPACE_ROOT_ENV]:
|
|
7135
|
+
[MEMORAONE_WORKSPACE_ROOT_ENV]: path32.resolve(options.workspaceRoot)
|
|
7189
7136
|
};
|
|
7190
7137
|
if (environment === "local" || options.devMode) {
|
|
7191
7138
|
env2.MEMORAONE_DEV_MODE = "1";
|
|
@@ -7207,11 +7154,11 @@ function mergeAuggieMcpConfigObject(existing, memoraone) {
|
|
|
7207
7154
|
return { ...base, mcpServers: replaceMemoraoneOwnedInServerMap(mcpServers, memoraone) };
|
|
7208
7155
|
}
|
|
7209
7156
|
async function writeAuggieMcpJsonAtomic(filePath, content) {
|
|
7210
|
-
const dir =
|
|
7157
|
+
const dir = path32.dirname(filePath);
|
|
7211
7158
|
await fs27.mkdir(dir, { recursive: true });
|
|
7212
|
-
const tmpPath =
|
|
7159
|
+
const tmpPath = path32.join(
|
|
7213
7160
|
dir,
|
|
7214
|
-
`.${
|
|
7161
|
+
`.${path32.basename(filePath)}.${process.pid}.${(0, import_node_crypto18.randomBytes)(8).toString("hex")}.tmp`
|
|
7215
7162
|
);
|
|
7216
7163
|
try {
|
|
7217
7164
|
await fs27.writeFile(tmpPath, content, "utf8");
|
|
@@ -7289,7 +7236,7 @@ async function buildAuggieMemoraoneServer(options) {
|
|
|
7289
7236
|
}
|
|
7290
7237
|
async function setupAuggieMcpConfig(options) {
|
|
7291
7238
|
const projectPath = options.projectConfigPath ?? getAuggieProjectMcpConfigPath(options.repoRoot);
|
|
7292
|
-
const workspaceRoot =
|
|
7239
|
+
const workspaceRoot = path32.resolve(options.repoRoot);
|
|
7293
7240
|
const memoraone = await buildAuggieMemoraoneServer({
|
|
7294
7241
|
workspaceRoot,
|
|
7295
7242
|
devMode: options.devMode,
|
|
@@ -7354,12 +7301,12 @@ function logAuggieMcpCliSummary(info, dryRun, println = console.log) {
|
|
|
7354
7301
|
"[setup-ide-files] Fully quit Augment Code / Auggie and reopen this repo for MCP changes to take effect."
|
|
7355
7302
|
);
|
|
7356
7303
|
}
|
|
7357
|
-
var fs27,
|
|
7304
|
+
var fs27, path32, import_node_crypto18, AuggieMcpJsonParseError;
|
|
7358
7305
|
var init_auggieMcpConfig = __esm({
|
|
7359
7306
|
"src/auggieMcpConfig.ts"() {
|
|
7360
7307
|
fs27 = __toESM(require("fs/promises"), 1);
|
|
7361
|
-
|
|
7362
|
-
|
|
7308
|
+
path32 = __toESM(require("path"), 1);
|
|
7309
|
+
import_node_crypto18 = require("crypto");
|
|
7363
7310
|
init_configUtils();
|
|
7364
7311
|
init_cursorGlobalMcpConfig();
|
|
7365
7312
|
init_initializeBinding();
|
|
@@ -7391,7 +7338,7 @@ async function pathExists17(filePath) {
|
|
|
7391
7338
|
}
|
|
7392
7339
|
}
|
|
7393
7340
|
function getGeminiCliProjectMcpConfigPath(repoRoot) {
|
|
7394
|
-
return
|
|
7341
|
+
return path33.join(path33.resolve(repoRoot), ".gemini", "settings.json");
|
|
7395
7342
|
}
|
|
7396
7343
|
function buildMemoraoneGeminiCliMcpServer(options) {
|
|
7397
7344
|
const environment = options.environment ?? (options.devMode ? "local" : "production");
|
|
@@ -7401,7 +7348,7 @@ function buildMemoraoneGeminiCliMcpServer(options) {
|
|
|
7401
7348
|
apiUrl: options.apiUrl ?? (environment === "local" ? DEV_API_URL : void 0)
|
|
7402
7349
|
}),
|
|
7403
7350
|
MEMORAONE_IDE_TYPE: "gemini-cli",
|
|
7404
|
-
[MEMORAONE_WORKSPACE_ROOT_ENV]:
|
|
7351
|
+
[MEMORAONE_WORKSPACE_ROOT_ENV]: path33.resolve(options.workspaceRoot)
|
|
7405
7352
|
};
|
|
7406
7353
|
if (environment === "local" || options.devMode) {
|
|
7407
7354
|
env2.MEMORAONE_DEV_MODE = "1";
|
|
@@ -7423,11 +7370,11 @@ function mergeGeminiCliMcpConfigObject(existing, memoraone) {
|
|
|
7423
7370
|
return { ...base, mcpServers: replaceMemoraoneOwnedInServerMap(mcpServers, memoraone) };
|
|
7424
7371
|
}
|
|
7425
7372
|
async function writeGeminiCliMcpJsonAtomic(filePath, content) {
|
|
7426
|
-
const dir =
|
|
7373
|
+
const dir = path33.dirname(filePath);
|
|
7427
7374
|
await fs28.mkdir(dir, { recursive: true });
|
|
7428
|
-
const tmpPath =
|
|
7375
|
+
const tmpPath = path33.join(
|
|
7429
7376
|
dir,
|
|
7430
|
-
`.${
|
|
7377
|
+
`.${path33.basename(filePath)}.${process.pid}.${(0, import_node_crypto19.randomBytes)(8).toString("hex")}.tmp`
|
|
7431
7378
|
);
|
|
7432
7379
|
try {
|
|
7433
7380
|
await fs28.writeFile(tmpPath, content, "utf8");
|
|
@@ -7505,7 +7452,7 @@ async function buildGeminiCliMemoraoneServer(options) {
|
|
|
7505
7452
|
}
|
|
7506
7453
|
async function setupGeminiCliMcpConfig(options) {
|
|
7507
7454
|
const projectPath = options.projectConfigPath ?? getGeminiCliProjectMcpConfigPath(options.repoRoot);
|
|
7508
|
-
const workspaceRoot =
|
|
7455
|
+
const workspaceRoot = path33.resolve(options.repoRoot);
|
|
7509
7456
|
const memoraone = await buildGeminiCliMemoraoneServer({
|
|
7510
7457
|
workspaceRoot,
|
|
7511
7458
|
devMode: options.devMode,
|
|
@@ -7570,12 +7517,12 @@ function logGeminiCliMcpCliSummary(info, dryRun, println = console.log) {
|
|
|
7570
7517
|
"[setup-ide-files] Fully quit Gemini CLI and reopen this repo for MCP changes to take effect."
|
|
7571
7518
|
);
|
|
7572
7519
|
}
|
|
7573
|
-
var fs28,
|
|
7520
|
+
var fs28, path33, import_node_crypto19, GeminiCliMcpJsonParseError;
|
|
7574
7521
|
var init_geminiCliMcpConfig = __esm({
|
|
7575
7522
|
"src/geminiCliMcpConfig.ts"() {
|
|
7576
7523
|
fs28 = __toESM(require("fs/promises"), 1);
|
|
7577
|
-
|
|
7578
|
-
|
|
7524
|
+
path33 = __toESM(require("path"), 1);
|
|
7525
|
+
import_node_crypto19 = require("crypto");
|
|
7579
7526
|
init_configUtils();
|
|
7580
7527
|
init_cursorGlobalMcpConfig();
|
|
7581
7528
|
init_initializeBinding();
|
|
@@ -7607,14 +7554,14 @@ async function pathExists18(filePath) {
|
|
|
7607
7554
|
}
|
|
7608
7555
|
}
|
|
7609
7556
|
function getAntigravityUnifiedMcpConfigPath(homeDir) {
|
|
7610
|
-
return
|
|
7557
|
+
return path34.join(homeDir, ".gemini", "config", "mcp_config.json");
|
|
7611
7558
|
}
|
|
7612
7559
|
function getAntigravityLegacyMcpConfigPath(homeDir) {
|
|
7613
|
-
return
|
|
7560
|
+
return path34.join(homeDir, ".gemini", "antigravity", "mcp_config.json");
|
|
7614
7561
|
}
|
|
7615
7562
|
function getAntigravityGlobalMcpConfigPath(homeDir) {
|
|
7616
7563
|
const unified = getAntigravityUnifiedMcpConfigPath(homeDir);
|
|
7617
|
-
const migratedMarker =
|
|
7564
|
+
const migratedMarker = path34.join(homeDir, ".gemini", "config", ".migrated");
|
|
7618
7565
|
if (fsSync.existsSync(migratedMarker) || fsSync.existsSync(unified)) {
|
|
7619
7566
|
return unified;
|
|
7620
7567
|
}
|
|
@@ -7628,7 +7575,7 @@ function buildMemoraoneAntigravityMcpServer(options) {
|
|
|
7628
7575
|
apiUrl: options.apiUrl ?? (environment === "local" ? DEV_API_URL : void 0)
|
|
7629
7576
|
}),
|
|
7630
7577
|
MEMORAONE_IDE_TYPE: "antigravity",
|
|
7631
|
-
[MEMORAONE_WORKSPACE_ROOT_ENV]:
|
|
7578
|
+
[MEMORAONE_WORKSPACE_ROOT_ENV]: path34.resolve(options.workspaceRoot)
|
|
7632
7579
|
};
|
|
7633
7580
|
if (environment === "local" || options.devMode) {
|
|
7634
7581
|
env2.MEMORAONE_DEV_MODE = "1";
|
|
@@ -7644,10 +7591,10 @@ function buildMemoraoneAntigravityMcpServer(options) {
|
|
|
7644
7591
|
env: env2
|
|
7645
7592
|
};
|
|
7646
7593
|
}
|
|
7647
|
-
function mergeAntigravityMcpConfigObject(existing, memoraone) {
|
|
7594
|
+
function mergeAntigravityMcpConfigObject(existing, memoraone, ownership) {
|
|
7648
7595
|
const base = existing && typeof existing === "object" ? { ...existing } : { mcpServers: {} };
|
|
7649
7596
|
const mcpServers = typeof base.mcpServers === "object" && base.mcpServers !== null && !Array.isArray(base.mcpServers) ? { ...base.mcpServers } : {};
|
|
7650
|
-
return { ...base, mcpServers: replaceMemoraoneOwnedInServerMap(mcpServers, memoraone) };
|
|
7597
|
+
return { ...base, mcpServers: ownership ? replaceMemoraoneRepositoryBindingInServerMap(mcpServers, memoraone, ownership) : replaceMemoraoneOwnedInServerMap(mcpServers, memoraone) };
|
|
7651
7598
|
}
|
|
7652
7599
|
function stripMemoraoneFromAntigravityConfigObject(existing) {
|
|
7653
7600
|
const base = { ...existing };
|
|
@@ -7663,11 +7610,11 @@ function stripMemoraoneFromAntigravityConfigObject(existing) {
|
|
|
7663
7610
|
return { next: { ...base, mcpServers }, removed: true };
|
|
7664
7611
|
}
|
|
7665
7612
|
async function writeAntigravityMcpJsonAtomic(filePath, content) {
|
|
7666
|
-
const dir =
|
|
7613
|
+
const dir = path34.dirname(filePath);
|
|
7667
7614
|
await fs29.mkdir(dir, { recursive: true });
|
|
7668
|
-
const tmpPath =
|
|
7615
|
+
const tmpPath = path34.join(
|
|
7669
7616
|
dir,
|
|
7670
|
-
`.${
|
|
7617
|
+
`.${path34.basename(filePath)}.${process.pid}.${(0, import_node_crypto20.randomBytes)(8).toString("hex")}.tmp`
|
|
7671
7618
|
);
|
|
7672
7619
|
try {
|
|
7673
7620
|
await fs29.writeFile(tmpPath, content, "utf8");
|
|
@@ -7683,7 +7630,7 @@ async function writeAntigravityMcpJsonAtomic(filePath, content) {
|
|
|
7683
7630
|
function memoraoneServerMatches17(server, expected) {
|
|
7684
7631
|
return canonicalValueMatches(server, expected);
|
|
7685
7632
|
}
|
|
7686
|
-
function validateAntigravityMcpConfig(parsed2, expected) {
|
|
7633
|
+
function validateAntigravityMcpConfig(parsed2, expected, serverName = CANONICAL_MEMORAONE_MCP_SERVER_NAME) {
|
|
7687
7634
|
if (!parsed2 || typeof parsed2 !== "object") {
|
|
7688
7635
|
throw new Error("[setup-ide-files] Antigravity MCP config must be a JSON object.");
|
|
7689
7636
|
}
|
|
@@ -7691,7 +7638,8 @@ function validateAntigravityMcpConfig(parsed2, expected) {
|
|
|
7691
7638
|
if (!mcpServers || typeof mcpServers !== "object" || Array.isArray(mcpServers)) {
|
|
7692
7639
|
throw new Error("[setup-ide-files] Antigravity MCP config missing mcpServers object.");
|
|
7693
7640
|
}
|
|
7694
|
-
const
|
|
7641
|
+
const serverMap = mcpServers;
|
|
7642
|
+
const memoraone = serverMap[serverName] ?? Object.values(serverMap).find((entry) => memoraoneServerMatches17(entry, expected));
|
|
7695
7643
|
if (!memoraoneServerMatches17(memoraone, expected)) {
|
|
7696
7644
|
throw new Error(
|
|
7697
7645
|
"[setup-ide-files] Antigravity MCP config mcpServers.memoraone is missing or invalid."
|
|
@@ -7750,12 +7698,12 @@ async function buildAntigravityMemoraoneServer(options) {
|
|
|
7750
7698
|
});
|
|
7751
7699
|
}
|
|
7752
7700
|
async function setupAntigravityMcpConfig(options) {
|
|
7753
|
-
const homeDir = options.homeDir ??
|
|
7701
|
+
const homeDir = options.homeDir ?? os9.homedir();
|
|
7754
7702
|
const activePath = options.globalConfigPath ?? getAntigravityGlobalMcpConfigPath(homeDir);
|
|
7755
7703
|
const legacyPath = options.legacyConfigPath ?? getAntigravityLegacyMcpConfigPath(homeDir);
|
|
7756
7704
|
const unifiedPath = getAntigravityUnifiedMcpConfigPath(homeDir);
|
|
7757
|
-
const writingUnified =
|
|
7758
|
-
const workspaceRoot =
|
|
7705
|
+
const writingUnified = path34.resolve(activePath) === path34.resolve(unifiedPath) && path34.resolve(activePath) !== path34.resolve(legacyPath);
|
|
7706
|
+
const workspaceRoot = path34.resolve(options.repoRoot);
|
|
7759
7707
|
const memoraone = await buildAntigravityMemoraoneServer({
|
|
7760
7708
|
workspaceRoot,
|
|
7761
7709
|
devMode: options.devMode,
|
|
@@ -7787,13 +7735,17 @@ async function setupAntigravityMcpConfig(options) {
|
|
|
7787
7735
|
legacyMalformed = true;
|
|
7788
7736
|
}
|
|
7789
7737
|
}
|
|
7790
|
-
const merged = mergeAntigravityMcpConfigObject(activeExisting, memoraone);
|
|
7738
|
+
const merged = mergeAntigravityMcpConfigObject(activeExisting, memoraone, options.ownership);
|
|
7791
7739
|
const body = JSON.stringify(merged, null, 2) + "\n";
|
|
7792
|
-
const
|
|
7793
|
-
|
|
7740
|
+
const activeAlreadyCorrect = Boolean(
|
|
7741
|
+
activeExisted && activeExisting && canonicalValueMatches(activeExisting, merged)
|
|
7742
|
+
);
|
|
7794
7743
|
let legacyNeedsCleanup = false;
|
|
7795
7744
|
if (legacyExisted && !legacyMalformed && legacyExisting) {
|
|
7796
|
-
legacyNeedsCleanup =
|
|
7745
|
+
legacyNeedsCleanup = options.ownership && legacyExisting.mcpServers && typeof legacyExisting.mcpServers === "object" && !Array.isArray(legacyExisting.mcpServers) ? stripMemoraoneRepositoryBindingFromServerMap(
|
|
7746
|
+
legacyExisting.mcpServers,
|
|
7747
|
+
options.ownership
|
|
7748
|
+
).removedKeys.length > 0 : extractMemoraone2(legacyExisting) !== void 0;
|
|
7797
7749
|
}
|
|
7798
7750
|
if (!writingUnified) {
|
|
7799
7751
|
if (activeAlreadyCorrect) {
|
|
@@ -7817,7 +7769,7 @@ async function setupAntigravityMcpConfig(options) {
|
|
|
7817
7769
|
await writeAntigravityMcpJsonAtomic(activePath, body);
|
|
7818
7770
|
const verifyRaw = await fs29.readFile(activePath, "utf8");
|
|
7819
7771
|
const verifyParsed = JSON.parse(stripLeadingLineComments14(verifyRaw));
|
|
7820
|
-
validateAntigravityMcpConfig(verifyParsed, memoraone);
|
|
7772
|
+
validateAntigravityMcpConfig(verifyParsed, memoraone, options.ownership ? memoraoneServerNameForRepositoryBinding(options.ownership.repositoryBindingId) : CANONICAL_MEMORAONE_MCP_SERVER_NAME);
|
|
7821
7773
|
return {
|
|
7822
7774
|
outcome: activeExisted ? "updated" : "created",
|
|
7823
7775
|
memoraone,
|
|
@@ -7856,7 +7808,7 @@ async function setupAntigravityMcpConfig(options) {
|
|
|
7856
7808
|
await writeAntigravityMcpJsonAtomic(activePath, body);
|
|
7857
7809
|
const verifyRaw = await fs29.readFile(activePath, "utf8");
|
|
7858
7810
|
const verifyParsed = JSON.parse(stripLeadingLineComments14(verifyRaw));
|
|
7859
|
-
validateAntigravityMcpConfig(verifyParsed, memoraone);
|
|
7811
|
+
validateAntigravityMcpConfig(verifyParsed, memoraone, options.ownership ? memoraoneServerNameForRepositoryBinding(options.ownership.repositoryBindingId) : CANONICAL_MEMORAONE_MCP_SERVER_NAME);
|
|
7860
7812
|
}
|
|
7861
7813
|
let legacyCleanup = "absent";
|
|
7862
7814
|
let warning;
|
|
@@ -7866,7 +7818,11 @@ async function setupAntigravityMcpConfig(options) {
|
|
|
7866
7818
|
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
7819
|
} else if (legacyNeedsCleanup && legacyExisting) {
|
|
7868
7820
|
try {
|
|
7869
|
-
const
|
|
7821
|
+
const scoped = options.ownership && legacyExisting.mcpServers && typeof legacyExisting.mcpServers === "object" && !Array.isArray(legacyExisting.mcpServers) ? stripMemoraoneRepositoryBindingFromServerMap(
|
|
7822
|
+
legacyExisting.mcpServers,
|
|
7823
|
+
options.ownership
|
|
7824
|
+
) : null;
|
|
7825
|
+
const { next, removed } = scoped ? { next: { ...legacyExisting, mcpServers: scoped.next }, removed: scoped.removedKeys.length > 0 } : stripMemoraoneFromAntigravityConfigObject(legacyExisting);
|
|
7870
7826
|
if (removed) {
|
|
7871
7827
|
const legacyBody = JSON.stringify(next, null, 2) + "\n";
|
|
7872
7828
|
await writeAntigravityMcpJsonAtomic(legacyPath, legacyBody);
|
|
@@ -7932,14 +7888,14 @@ function logAntigravityMcpCliSummary(info, dryRun, println = console.log) {
|
|
|
7932
7888
|
"[setup-ide-files] Fully quit Antigravity and reopen for MCP changes to take effect."
|
|
7933
7889
|
);
|
|
7934
7890
|
}
|
|
7935
|
-
var fsSync, fs29,
|
|
7891
|
+
var fsSync, fs29, os9, path34, import_node_crypto20, AntigravityMcpJsonParseError;
|
|
7936
7892
|
var init_antigravityMcpConfig = __esm({
|
|
7937
7893
|
"src/antigravityMcpConfig.ts"() {
|
|
7938
7894
|
fsSync = __toESM(require("fs"), 1);
|
|
7939
7895
|
fs29 = __toESM(require("fs/promises"), 1);
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
|
|
7896
|
+
os9 = __toESM(require("os"), 1);
|
|
7897
|
+
path34 = __toESM(require("path"), 1);
|
|
7898
|
+
import_node_crypto20 = require("crypto");
|
|
7943
7899
|
init_configUtils();
|
|
7944
7900
|
init_cursorGlobalMcpConfig();
|
|
7945
7901
|
init_initializeBinding();
|
|
@@ -7971,7 +7927,7 @@ function isPlainObject2(value) {
|
|
|
7971
7927
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7972
7928
|
}
|
|
7973
7929
|
function getGooseGlobalMcpConfigPath(homeDir) {
|
|
7974
|
-
return
|
|
7930
|
+
return path35.join(homeDir, ".config", "goose", "config.yaml");
|
|
7975
7931
|
}
|
|
7976
7932
|
function isMemoraoneOwnedGooseExtension(key, entry) {
|
|
7977
7933
|
if (isMemoraoneOwnedServerName(key)) return true;
|
|
@@ -8019,6 +7975,34 @@ function replaceMemoraoneOwnedInGooseExtensions(extensions, canonical) {
|
|
|
8019
7975
|
next[CANONICAL_MEMORAONE_MCP_SERVER_NAME] = canonical;
|
|
8020
7976
|
return next;
|
|
8021
7977
|
}
|
|
7978
|
+
function replaceMemoraoneRepositoryBindingInGooseExtensions(extensions, canonical, ownership) {
|
|
7979
|
+
const generatedTargetKey = memoraoneServerNameForRepositoryBinding(
|
|
7980
|
+
ownership.repositoryBindingId
|
|
7981
|
+
);
|
|
7982
|
+
const targetRoot = path35.resolve(ownership.workspaceRoot);
|
|
7983
|
+
const matchingRootKeys = Object.entries(extensions).filter(([key, value]) => {
|
|
7984
|
+
const envs = isPlainObject2(value) && isPlainObject2(value.envs) ? value.envs : void 0;
|
|
7985
|
+
return key.startsWith("memoraone-") && typeof envs?.MEMORAONE_WORKSPACE_ROOT === "string" && path35.resolve(envs.MEMORAONE_WORKSPACE_ROOT) === targetRoot;
|
|
7986
|
+
}).map(([key]) => key).sort();
|
|
7987
|
+
const targetKey = matchingRootKeys.includes(generatedTargetKey) ? generatedTargetKey : matchingRootKeys[0] ?? generatedTargetKey;
|
|
7988
|
+
const staleKeys = /* @__PURE__ */ new Set([
|
|
7989
|
+
generatedTargetKey,
|
|
7990
|
+
...(ownership.replacedRepositoryBindingIds ?? []).map(
|
|
7991
|
+
memoraoneServerNameForRepositoryBinding
|
|
7992
|
+
)
|
|
7993
|
+
]);
|
|
7994
|
+
staleKeys.delete(targetKey);
|
|
7995
|
+
const next = {};
|
|
7996
|
+
for (const [key, value] of Object.entries(extensions)) {
|
|
7997
|
+
const envs = isPlainObject2(value) && isPlainObject2(value.envs) ? value.envs : void 0;
|
|
7998
|
+
const legacyForRoot = isMemoraoneOwnedServerName(key) && !key.startsWith("memoraone-") && typeof envs?.MEMORAONE_WORKSPACE_ROOT === "string" && path35.resolve(envs.MEMORAONE_WORKSPACE_ROOT) === targetRoot;
|
|
7999
|
+
if (!staleKeys.has(key) && !matchingRootKeys.includes(key) && !legacyForRoot) {
|
|
8000
|
+
next[key] = value;
|
|
8001
|
+
}
|
|
8002
|
+
}
|
|
8003
|
+
next[targetKey] = canonical;
|
|
8004
|
+
return next;
|
|
8005
|
+
}
|
|
8022
8006
|
function buildMemoraoneGooseMcpServer(options) {
|
|
8023
8007
|
const environment = options.environment ?? (options.devMode ? "local" : "production");
|
|
8024
8008
|
const envs = {
|
|
@@ -8027,7 +8011,7 @@ function buildMemoraoneGooseMcpServer(options) {
|
|
|
8027
8011
|
apiUrl: options.apiUrl ?? (environment === "local" ? DEV_API_URL : void 0)
|
|
8028
8012
|
}),
|
|
8029
8013
|
MEMORAONE_IDE_TYPE: "goose",
|
|
8030
|
-
[MEMORAONE_WORKSPACE_ROOT_ENV]:
|
|
8014
|
+
[MEMORAONE_WORKSPACE_ROOT_ENV]: path35.resolve(options.workspaceRoot)
|
|
8031
8015
|
};
|
|
8032
8016
|
if (environment === "local" || options.devMode) {
|
|
8033
8017
|
envs.MEMORAONE_DEV_MODE = "1";
|
|
@@ -8047,20 +8031,20 @@ function buildMemoraoneGooseMcpServer(options) {
|
|
|
8047
8031
|
timeout: 300
|
|
8048
8032
|
};
|
|
8049
8033
|
}
|
|
8050
|
-
function mergeGooseMcpConfigObject(existing, memoraone) {
|
|
8034
|
+
function mergeGooseMcpConfigObject(existing, memoraone, ownership) {
|
|
8051
8035
|
const base = existing && isPlainObject2(existing) ? { ...existing } : { extensions: {} };
|
|
8052
8036
|
const extensions = isPlainObject2(base.extensions) ? { ...base.extensions } : {};
|
|
8053
8037
|
return {
|
|
8054
8038
|
...base,
|
|
8055
|
-
extensions: replaceMemoraoneOwnedInGooseExtensions(extensions, memoraone)
|
|
8039
|
+
extensions: ownership ? replaceMemoraoneRepositoryBindingInGooseExtensions(extensions, memoraone, ownership) : replaceMemoraoneOwnedInGooseExtensions(extensions, memoraone)
|
|
8056
8040
|
};
|
|
8057
8041
|
}
|
|
8058
8042
|
async function writeGooseMcpYamlAtomic(filePath, content) {
|
|
8059
|
-
const dir =
|
|
8043
|
+
const dir = path35.dirname(filePath);
|
|
8060
8044
|
await fs30.mkdir(dir, { recursive: true });
|
|
8061
|
-
const tmpPath =
|
|
8045
|
+
const tmpPath = path35.join(
|
|
8062
8046
|
dir,
|
|
8063
|
-
`.${
|
|
8047
|
+
`.${path35.basename(filePath)}.${process.pid}.${(0, import_node_crypto21.randomBytes)(8).toString("hex")}.tmp`
|
|
8064
8048
|
);
|
|
8065
8049
|
try {
|
|
8066
8050
|
await fs30.writeFile(tmpPath, content, "utf8");
|
|
@@ -8076,14 +8060,14 @@ async function writeGooseMcpYamlAtomic(filePath, content) {
|
|
|
8076
8060
|
function memoraoneExtensionMatches(extension, expected) {
|
|
8077
8061
|
return canonicalValueMatches(extension, expected);
|
|
8078
8062
|
}
|
|
8079
|
-
function validateGooseMcpConfig(parsed2, expected) {
|
|
8063
|
+
function validateGooseMcpConfig(parsed2, expected, serverName = CANONICAL_MEMORAONE_MCP_SERVER_NAME) {
|
|
8080
8064
|
if (!isPlainObject2(parsed2)) {
|
|
8081
8065
|
throw new Error("[setup-ide-files] Goose MCP config must be a YAML object.");
|
|
8082
8066
|
}
|
|
8083
8067
|
if (!isPlainObject2(parsed2.extensions)) {
|
|
8084
8068
|
throw new Error("[setup-ide-files] Goose MCP config missing extensions object.");
|
|
8085
8069
|
}
|
|
8086
|
-
const memoraone = parsed2.extensions.
|
|
8070
|
+
const memoraone = parsed2.extensions[serverName] ?? Object.values(parsed2.extensions).find((entry) => memoraoneExtensionMatches(entry, expected));
|
|
8087
8071
|
if (!memoraoneExtensionMatches(memoraone, expected)) {
|
|
8088
8072
|
throw new Error(
|
|
8089
8073
|
"[setup-ide-files] Goose MCP config extensions.memoraone is missing or invalid."
|
|
@@ -8147,9 +8131,9 @@ async function buildGooseMemoraoneServer(options) {
|
|
|
8147
8131
|
});
|
|
8148
8132
|
}
|
|
8149
8133
|
async function setupGooseMcpConfig(options) {
|
|
8150
|
-
const homeDir = options.homeDir ??
|
|
8134
|
+
const homeDir = options.homeDir ?? os10.homedir();
|
|
8151
8135
|
const activePath = options.globalConfigPath ?? getGooseGlobalMcpConfigPath(homeDir);
|
|
8152
|
-
const workspaceRoot =
|
|
8136
|
+
const workspaceRoot = path35.resolve(options.repoRoot);
|
|
8153
8137
|
const memoraone = await buildGooseMemoraoneServer({
|
|
8154
8138
|
workspaceRoot,
|
|
8155
8139
|
devMode: options.devMode,
|
|
@@ -8172,10 +8156,10 @@ async function setupGooseMcpConfig(options) {
|
|
|
8172
8156
|
throw new GooseMcpYamlParseError(activePath);
|
|
8173
8157
|
}
|
|
8174
8158
|
}
|
|
8175
|
-
const merged = mergeGooseMcpConfigObject(existing, memoraone);
|
|
8159
|
+
const merged = mergeGooseMcpConfigObject(existing, memoraone, options.ownership);
|
|
8176
8160
|
const body = formatGooseYaml(merged);
|
|
8177
8161
|
if (exists && existing) {
|
|
8178
|
-
const preview = mergeGooseMcpConfigObject(existing, memoraone);
|
|
8162
|
+
const preview = mergeGooseMcpConfigObject(existing, memoraone, options.ownership);
|
|
8179
8163
|
if (formatGooseYaml(preview) === formatGooseYaml(existing)) {
|
|
8180
8164
|
return { outcome: "skipped", memoraone, activeConfigPath: activePath };
|
|
8181
8165
|
}
|
|
@@ -8195,7 +8179,7 @@ async function setupGooseMcpConfig(options) {
|
|
|
8195
8179
|
} catch {
|
|
8196
8180
|
throw new GooseMcpYamlParseError(activePath);
|
|
8197
8181
|
}
|
|
8198
|
-
validateGooseMcpConfig(verifyParsed, memoraone);
|
|
8182
|
+
validateGooseMcpConfig(verifyParsed, memoraone, options.ownership ? memoraoneServerNameForRepositoryBinding(options.ownership.repositoryBindingId) : CANONICAL_MEMORAONE_MCP_SERVER_NAME);
|
|
8199
8183
|
return {
|
|
8200
8184
|
outcome: exists ? "updated" : "created",
|
|
8201
8185
|
memoraone,
|
|
@@ -8223,13 +8207,13 @@ function logGooseMcpCliSummary(info, dryRun, println = console.log) {
|
|
|
8223
8207
|
"[setup-ide-files] Fully quit Goose and reopen for MCP changes to take effect."
|
|
8224
8208
|
);
|
|
8225
8209
|
}
|
|
8226
|
-
var fs30,
|
|
8210
|
+
var fs30, os10, path35, import_node_crypto21, import_yaml2, GooseMcpYamlParseError, MEMORAONE_PACKAGE_SPEC_RE2;
|
|
8227
8211
|
var init_gooseMcpConfig = __esm({
|
|
8228
8212
|
"src/gooseMcpConfig.ts"() {
|
|
8229
8213
|
fs30 = __toESM(require("fs/promises"), 1);
|
|
8230
|
-
|
|
8231
|
-
|
|
8232
|
-
|
|
8214
|
+
os10 = __toESM(require("os"), 1);
|
|
8215
|
+
path35 = __toESM(require("path"), 1);
|
|
8216
|
+
import_node_crypto21 = require("crypto");
|
|
8233
8217
|
import_yaml2 = require("yaml");
|
|
8234
8218
|
init_configUtils();
|
|
8235
8219
|
init_cursorGlobalMcpConfig();
|
|
@@ -8263,7 +8247,7 @@ async function pathExists20(filePath) {
|
|
|
8263
8247
|
}
|
|
8264
8248
|
}
|
|
8265
8249
|
function getJunieProjectMcpConfigPath(repoRoot) {
|
|
8266
|
-
return
|
|
8250
|
+
return path36.join(path36.resolve(repoRoot), ".junie", "mcp", "mcp.json");
|
|
8267
8251
|
}
|
|
8268
8252
|
function buildMemoraoneJunieMcpServer(options) {
|
|
8269
8253
|
const environment = options.environment ?? (options.devMode ? "local" : "production");
|
|
@@ -8273,7 +8257,7 @@ function buildMemoraoneJunieMcpServer(options) {
|
|
|
8273
8257
|
apiUrl: options.apiUrl ?? (environment === "local" ? DEV_API_URL : void 0)
|
|
8274
8258
|
}),
|
|
8275
8259
|
MEMORAONE_IDE_TYPE: "junie",
|
|
8276
|
-
[MEMORAONE_WORKSPACE_ROOT_ENV]:
|
|
8260
|
+
[MEMORAONE_WORKSPACE_ROOT_ENV]: path36.resolve(options.workspaceRoot)
|
|
8277
8261
|
};
|
|
8278
8262
|
if (environment === "local" || options.devMode) {
|
|
8279
8263
|
env2.MEMORAONE_DEV_MODE = "1";
|
|
@@ -8295,11 +8279,11 @@ function mergeJunieMcpConfigObject(existing, memoraone) {
|
|
|
8295
8279
|
return { ...base, mcpServers: replaceMemoraoneOwnedInServerMap(mcpServers, memoraone) };
|
|
8296
8280
|
}
|
|
8297
8281
|
async function writeJunieMcpJsonAtomic(filePath, content) {
|
|
8298
|
-
const dir =
|
|
8282
|
+
const dir = path36.dirname(filePath);
|
|
8299
8283
|
await fs31.mkdir(dir, { recursive: true });
|
|
8300
|
-
const tmpPath =
|
|
8284
|
+
const tmpPath = path36.join(
|
|
8301
8285
|
dir,
|
|
8302
|
-
`.${
|
|
8286
|
+
`.${path36.basename(filePath)}.${process.pid}.${(0, import_node_crypto22.randomBytes)(8).toString("hex")}.tmp`
|
|
8303
8287
|
);
|
|
8304
8288
|
try {
|
|
8305
8289
|
await fs31.writeFile(tmpPath, content, "utf8");
|
|
@@ -8377,7 +8361,7 @@ async function buildJunieMemoraoneServer(options) {
|
|
|
8377
8361
|
}
|
|
8378
8362
|
async function setupJunieMcpConfig(options) {
|
|
8379
8363
|
const projectPath = options.projectConfigPath ?? getJunieProjectMcpConfigPath(options.repoRoot);
|
|
8380
|
-
const workspaceRoot =
|
|
8364
|
+
const workspaceRoot = path36.resolve(options.repoRoot);
|
|
8381
8365
|
const memoraone = await buildJunieMemoraoneServer({
|
|
8382
8366
|
workspaceRoot,
|
|
8383
8367
|
devMode: options.devMode,
|
|
@@ -8442,12 +8426,12 @@ function logJunieMcpCliSummary(info, dryRun, println = console.log) {
|
|
|
8442
8426
|
"[setup-ide-files] Fully quit JetBrains IDE / Junie and reopen this repo for MCP changes to take effect."
|
|
8443
8427
|
);
|
|
8444
8428
|
}
|
|
8445
|
-
var fs31,
|
|
8429
|
+
var fs31, path36, import_node_crypto22, JunieMcpJsonParseError;
|
|
8446
8430
|
var init_junieMcpConfig = __esm({
|
|
8447
8431
|
"src/junieMcpConfig.ts"() {
|
|
8448
8432
|
fs31 = __toESM(require("fs/promises"), 1);
|
|
8449
|
-
|
|
8450
|
-
|
|
8433
|
+
path36 = __toESM(require("path"), 1);
|
|
8434
|
+
import_node_crypto22 = require("crypto");
|
|
8451
8435
|
init_configUtils();
|
|
8452
8436
|
init_cursorGlobalMcpConfig();
|
|
8453
8437
|
init_initializeBinding();
|
|
@@ -8479,7 +8463,7 @@ async function pathExists21(filePath) {
|
|
|
8479
8463
|
}
|
|
8480
8464
|
}
|
|
8481
8465
|
function getXcodeGlobalMcpConfigPath(homeDir) {
|
|
8482
|
-
return
|
|
8466
|
+
return path37.join(homeDir, ".config", "github-copilot", "xcode", "mcp.json");
|
|
8483
8467
|
}
|
|
8484
8468
|
function buildMemoraoneXcodeMcpServer(options) {
|
|
8485
8469
|
const environment = options.environment ?? (options.devMode ? "local" : "production");
|
|
@@ -8489,7 +8473,7 @@ function buildMemoraoneXcodeMcpServer(options) {
|
|
|
8489
8473
|
apiUrl: options.apiUrl ?? (environment === "local" ? DEV_API_URL : void 0)
|
|
8490
8474
|
}),
|
|
8491
8475
|
MEMORAONE_IDE_TYPE: "xcode",
|
|
8492
|
-
[MEMORAONE_WORKSPACE_ROOT_ENV]:
|
|
8476
|
+
[MEMORAONE_WORKSPACE_ROOT_ENV]: path37.resolve(options.workspaceRoot)
|
|
8493
8477
|
};
|
|
8494
8478
|
if (environment === "local" || options.devMode) {
|
|
8495
8479
|
env2.MEMORAONE_DEV_MODE = "1";
|
|
@@ -8506,17 +8490,17 @@ function buildMemoraoneXcodeMcpServer(options) {
|
|
|
8506
8490
|
env: env2
|
|
8507
8491
|
};
|
|
8508
8492
|
}
|
|
8509
|
-
function mergeXcodeMcpConfigObject(existing, memoraone) {
|
|
8493
|
+
function mergeXcodeMcpConfigObject(existing, memoraone, ownership) {
|
|
8510
8494
|
const base = existing && typeof existing === "object" ? { ...existing } : { servers: {} };
|
|
8511
8495
|
const servers = typeof base.servers === "object" && base.servers !== null && !Array.isArray(base.servers) ? { ...base.servers } : {};
|
|
8512
|
-
return { ...base, servers: replaceMemoraoneOwnedInServerMap(servers, memoraone) };
|
|
8496
|
+
return { ...base, servers: ownership ? replaceMemoraoneRepositoryBindingInServerMap(servers, memoraone, ownership) : replaceMemoraoneOwnedInServerMap(servers, memoraone) };
|
|
8513
8497
|
}
|
|
8514
8498
|
async function writeXcodeMcpJsonAtomic(filePath, content) {
|
|
8515
|
-
const dir =
|
|
8499
|
+
const dir = path37.dirname(filePath);
|
|
8516
8500
|
await fs32.mkdir(dir, { recursive: true });
|
|
8517
|
-
const tmpPath =
|
|
8501
|
+
const tmpPath = path37.join(
|
|
8518
8502
|
dir,
|
|
8519
|
-
`.${
|
|
8503
|
+
`.${path37.basename(filePath)}.${process.pid}.${(0, import_node_crypto23.randomBytes)(8).toString("hex")}.tmp`
|
|
8520
8504
|
);
|
|
8521
8505
|
try {
|
|
8522
8506
|
await fs32.writeFile(tmpPath, content, "utf8");
|
|
@@ -8532,7 +8516,7 @@ async function writeXcodeMcpJsonAtomic(filePath, content) {
|
|
|
8532
8516
|
function memoraoneServerMatches19(server, expected) {
|
|
8533
8517
|
return canonicalValueMatches(server, expected);
|
|
8534
8518
|
}
|
|
8535
|
-
function validateXcodeMcpConfig(parsed2, expected) {
|
|
8519
|
+
function validateXcodeMcpConfig(parsed2, expected, serverName = CANONICAL_MEMORAONE_MCP_SERVER_NAME) {
|
|
8536
8520
|
if (!parsed2 || typeof parsed2 !== "object") {
|
|
8537
8521
|
throw new Error("[setup-ide-files] Xcode MCP config must be a JSON object.");
|
|
8538
8522
|
}
|
|
@@ -8540,7 +8524,8 @@ function validateXcodeMcpConfig(parsed2, expected) {
|
|
|
8540
8524
|
if (!servers || typeof servers !== "object" || Array.isArray(servers)) {
|
|
8541
8525
|
throw new Error("[setup-ide-files] Xcode MCP config missing servers object.");
|
|
8542
8526
|
}
|
|
8543
|
-
const
|
|
8527
|
+
const serverMap = servers;
|
|
8528
|
+
const memoraone = serverMap[serverName] ?? Object.values(serverMap).find((entry) => memoraoneServerMatches19(entry, expected));
|
|
8544
8529
|
if (!memoraoneServerMatches19(memoraone, expected)) {
|
|
8545
8530
|
throw new Error(
|
|
8546
8531
|
"[setup-ide-files] Xcode MCP config servers.memoraone is missing or invalid."
|
|
@@ -8593,9 +8578,9 @@ async function buildXcodeMemoraoneServer(options) {
|
|
|
8593
8578
|
});
|
|
8594
8579
|
}
|
|
8595
8580
|
async function setupXcodeMcpConfig(options) {
|
|
8596
|
-
const homeDir = options.homeDir ??
|
|
8581
|
+
const homeDir = options.homeDir ?? os11.homedir();
|
|
8597
8582
|
const activePath = options.globalConfigPath ?? getXcodeGlobalMcpConfigPath(homeDir);
|
|
8598
|
-
const workspaceRoot =
|
|
8583
|
+
const workspaceRoot = path37.resolve(options.repoRoot);
|
|
8599
8584
|
const memoraone = await buildXcodeMemoraoneServer({
|
|
8600
8585
|
workspaceRoot,
|
|
8601
8586
|
devMode: options.devMode,
|
|
@@ -8617,11 +8602,10 @@ async function setupXcodeMcpConfig(options) {
|
|
|
8617
8602
|
throw new XcodeMcpJsonParseError(activePath);
|
|
8618
8603
|
}
|
|
8619
8604
|
}
|
|
8620
|
-
const merged = mergeXcodeMcpConfigObject(existing, memoraone);
|
|
8605
|
+
const merged = mergeXcodeMcpConfigObject(existing, memoraone, options.ownership);
|
|
8621
8606
|
const body = JSON.stringify(merged, null, 2) + "\n";
|
|
8622
8607
|
if (exists && existing) {
|
|
8623
|
-
|
|
8624
|
-
if (memoraoneServerMatches19(currentMemoraone, memoraone)) {
|
|
8608
|
+
if (canonicalValueMatches(existing, merged)) {
|
|
8625
8609
|
return { outcome: "skipped", memoraone, activeConfigPath: activePath };
|
|
8626
8610
|
}
|
|
8627
8611
|
}
|
|
@@ -8635,7 +8619,7 @@ async function setupXcodeMcpConfig(options) {
|
|
|
8635
8619
|
await writeXcodeMcpJsonAtomic(activePath, body);
|
|
8636
8620
|
const verifyRaw = await fs32.readFile(activePath, "utf8");
|
|
8637
8621
|
const verifyParsed = JSON.parse(stripLeadingLineComments16(verifyRaw));
|
|
8638
|
-
validateXcodeMcpConfig(verifyParsed, memoraone);
|
|
8622
|
+
validateXcodeMcpConfig(verifyParsed, memoraone, options.ownership ? memoraoneServerNameForRepositoryBinding(options.ownership.repositoryBindingId) : CANONICAL_MEMORAONE_MCP_SERVER_NAME);
|
|
8639
8623
|
return {
|
|
8640
8624
|
outcome: exists ? "updated" : "created",
|
|
8641
8625
|
memoraone,
|
|
@@ -8663,13 +8647,13 @@ function logXcodeMcpCliSummary(info, dryRun, println = console.log) {
|
|
|
8663
8647
|
"[setup-ide-files] Fully quit Xcode / Copilot for Xcode and reopen for MCP changes to take effect."
|
|
8664
8648
|
);
|
|
8665
8649
|
}
|
|
8666
|
-
var fs32,
|
|
8650
|
+
var fs32, os11, path37, import_node_crypto23, XcodeMcpJsonParseError;
|
|
8667
8651
|
var init_xcodeMcpConfig = __esm({
|
|
8668
8652
|
"src/xcodeMcpConfig.ts"() {
|
|
8669
8653
|
fs32 = __toESM(require("fs/promises"), 1);
|
|
8670
|
-
|
|
8671
|
-
|
|
8672
|
-
|
|
8654
|
+
os11 = __toESM(require("os"), 1);
|
|
8655
|
+
path37 = __toESM(require("path"), 1);
|
|
8656
|
+
import_node_crypto23 = require("crypto");
|
|
8673
8657
|
init_configUtils();
|
|
8674
8658
|
init_cursorGlobalMcpConfig();
|
|
8675
8659
|
init_initializeBinding();
|
|
@@ -8701,7 +8685,7 @@ async function pathExists22(filePath) {
|
|
|
8701
8685
|
}
|
|
8702
8686
|
}
|
|
8703
8687
|
function getCopilotJetBrainsGlobalMcpConfigPath(homeDir) {
|
|
8704
|
-
return
|
|
8688
|
+
return path38.join(homeDir, ".config", "github-copilot", "intellij", "mcp.json");
|
|
8705
8689
|
}
|
|
8706
8690
|
function buildMemoraoneCopilotJetBrainsMcpServer(options) {
|
|
8707
8691
|
const environment = options.environment ?? (options.devMode ? "local" : "production");
|
|
@@ -8711,7 +8695,7 @@ function buildMemoraoneCopilotJetBrainsMcpServer(options) {
|
|
|
8711
8695
|
apiUrl: options.apiUrl ?? (environment === "local" ? DEV_API_URL : void 0)
|
|
8712
8696
|
}),
|
|
8713
8697
|
MEMORAONE_IDE_TYPE: "copilot-jetbrains",
|
|
8714
|
-
[MEMORAONE_WORKSPACE_ROOT_ENV]:
|
|
8698
|
+
[MEMORAONE_WORKSPACE_ROOT_ENV]: path38.resolve(options.workspaceRoot)
|
|
8715
8699
|
};
|
|
8716
8700
|
if (environment === "local" || options.devMode) {
|
|
8717
8701
|
env2.MEMORAONE_DEV_MODE = "1";
|
|
@@ -8728,17 +8712,17 @@ function buildMemoraoneCopilotJetBrainsMcpServer(options) {
|
|
|
8728
8712
|
env: env2
|
|
8729
8713
|
};
|
|
8730
8714
|
}
|
|
8731
|
-
function mergeCopilotJetBrainsMcpConfigObject(existing, memoraone) {
|
|
8715
|
+
function mergeCopilotJetBrainsMcpConfigObject(existing, memoraone, ownership) {
|
|
8732
8716
|
const base = existing && typeof existing === "object" ? { ...existing } : { servers: {} };
|
|
8733
8717
|
const servers = typeof base.servers === "object" && base.servers !== null && !Array.isArray(base.servers) ? { ...base.servers } : {};
|
|
8734
|
-
return { ...base, servers: replaceMemoraoneOwnedInServerMap(servers, memoraone) };
|
|
8718
|
+
return { ...base, servers: ownership ? replaceMemoraoneRepositoryBindingInServerMap(servers, memoraone, ownership) : replaceMemoraoneOwnedInServerMap(servers, memoraone) };
|
|
8735
8719
|
}
|
|
8736
8720
|
async function writeCopilotJetBrainsMcpJsonAtomic(filePath, content) {
|
|
8737
|
-
const dir =
|
|
8721
|
+
const dir = path38.dirname(filePath);
|
|
8738
8722
|
await fs33.mkdir(dir, { recursive: true });
|
|
8739
|
-
const tmpPath =
|
|
8723
|
+
const tmpPath = path38.join(
|
|
8740
8724
|
dir,
|
|
8741
|
-
`.${
|
|
8725
|
+
`.${path38.basename(filePath)}.${process.pid}.${(0, import_node_crypto24.randomBytes)(8).toString("hex")}.tmp`
|
|
8742
8726
|
);
|
|
8743
8727
|
try {
|
|
8744
8728
|
await fs33.writeFile(tmpPath, content, "utf8");
|
|
@@ -8754,7 +8738,7 @@ async function writeCopilotJetBrainsMcpJsonAtomic(filePath, content) {
|
|
|
8754
8738
|
function memoraoneServerMatches20(server, expected) {
|
|
8755
8739
|
return canonicalValueMatches(server, expected);
|
|
8756
8740
|
}
|
|
8757
|
-
function validateCopilotJetBrainsMcpConfig(parsed2, expected) {
|
|
8741
|
+
function validateCopilotJetBrainsMcpConfig(parsed2, expected, serverName = CANONICAL_MEMORAONE_MCP_SERVER_NAME) {
|
|
8758
8742
|
if (!parsed2 || typeof parsed2 !== "object") {
|
|
8759
8743
|
throw new Error(
|
|
8760
8744
|
"[setup-ide-files] GitHub Copilot JetBrains MCP config must be a JSON object."
|
|
@@ -8766,7 +8750,8 @@ function validateCopilotJetBrainsMcpConfig(parsed2, expected) {
|
|
|
8766
8750
|
"[setup-ide-files] GitHub Copilot JetBrains MCP config missing servers object."
|
|
8767
8751
|
);
|
|
8768
8752
|
}
|
|
8769
|
-
const
|
|
8753
|
+
const serverMap = servers;
|
|
8754
|
+
const memoraone = serverMap[serverName] ?? Object.values(serverMap).find((entry) => memoraoneServerMatches20(entry, expected));
|
|
8770
8755
|
if (!memoraoneServerMatches20(memoraone, expected)) {
|
|
8771
8756
|
throw new Error(
|
|
8772
8757
|
"[setup-ide-files] GitHub Copilot JetBrains MCP config servers.memoraone is missing or invalid."
|
|
@@ -8819,9 +8804,9 @@ async function buildCopilotJetBrainsMemoraoneServer(options) {
|
|
|
8819
8804
|
});
|
|
8820
8805
|
}
|
|
8821
8806
|
async function setupCopilotJetBrainsMcpConfig(options) {
|
|
8822
|
-
const homeDir = options.homeDir ??
|
|
8807
|
+
const homeDir = options.homeDir ?? os12.homedir();
|
|
8823
8808
|
const activePath = options.globalConfigPath ?? getCopilotJetBrainsGlobalMcpConfigPath(homeDir);
|
|
8824
|
-
const workspaceRoot =
|
|
8809
|
+
const workspaceRoot = path38.resolve(options.repoRoot);
|
|
8825
8810
|
const memoraone = await buildCopilotJetBrainsMemoraoneServer({
|
|
8826
8811
|
workspaceRoot,
|
|
8827
8812
|
devMode: options.devMode,
|
|
@@ -8843,11 +8828,10 @@ async function setupCopilotJetBrainsMcpConfig(options) {
|
|
|
8843
8828
|
throw new CopilotJetBrainsMcpJsonParseError(activePath);
|
|
8844
8829
|
}
|
|
8845
8830
|
}
|
|
8846
|
-
const merged = mergeCopilotJetBrainsMcpConfigObject(existing, memoraone);
|
|
8831
|
+
const merged = mergeCopilotJetBrainsMcpConfigObject(existing, memoraone, options.ownership);
|
|
8847
8832
|
const body = JSON.stringify(merged, null, 2) + "\n";
|
|
8848
8833
|
if (exists && existing) {
|
|
8849
|
-
|
|
8850
|
-
if (memoraoneServerMatches20(currentMemoraone, memoraone)) {
|
|
8834
|
+
if (canonicalValueMatches(existing, merged)) {
|
|
8851
8835
|
return { outcome: "skipped", memoraone, activeConfigPath: activePath };
|
|
8852
8836
|
}
|
|
8853
8837
|
}
|
|
@@ -8861,7 +8845,7 @@ async function setupCopilotJetBrainsMcpConfig(options) {
|
|
|
8861
8845
|
await writeCopilotJetBrainsMcpJsonAtomic(activePath, body);
|
|
8862
8846
|
const verifyRaw = await fs33.readFile(activePath, "utf8");
|
|
8863
8847
|
const verifyParsed = JSON.parse(stripLeadingLineComments17(verifyRaw));
|
|
8864
|
-
validateCopilotJetBrainsMcpConfig(verifyParsed, memoraone);
|
|
8848
|
+
validateCopilotJetBrainsMcpConfig(verifyParsed, memoraone, options.ownership ? memoraoneServerNameForRepositoryBinding(options.ownership.repositoryBindingId) : CANONICAL_MEMORAONE_MCP_SERVER_NAME);
|
|
8865
8849
|
return {
|
|
8866
8850
|
outcome: exists ? "updated" : "created",
|
|
8867
8851
|
memoraone,
|
|
@@ -8893,13 +8877,13 @@ function logCopilotJetBrainsMcpCliSummary(info, dryRun, println = console.log) {
|
|
|
8893
8877
|
"[setup-ide-files] Fully quit JetBrains IDE / GitHub Copilot and reopen for MCP changes to take effect."
|
|
8894
8878
|
);
|
|
8895
8879
|
}
|
|
8896
|
-
var fs33,
|
|
8880
|
+
var fs33, os12, path38, import_node_crypto24, CopilotJetBrainsMcpJsonParseError;
|
|
8897
8881
|
var init_copilotJetBrainsMcpConfig = __esm({
|
|
8898
8882
|
"src/copilotJetBrainsMcpConfig.ts"() {
|
|
8899
8883
|
fs33 = __toESM(require("fs/promises"), 1);
|
|
8900
|
-
|
|
8901
|
-
|
|
8902
|
-
|
|
8884
|
+
os12 = __toESM(require("os"), 1);
|
|
8885
|
+
path38 = __toESM(require("path"), 1);
|
|
8886
|
+
import_node_crypto24 = require("crypto");
|
|
8903
8887
|
init_configUtils();
|
|
8904
8888
|
init_cursorGlobalMcpConfig();
|
|
8905
8889
|
init_initializeBinding();
|
|
@@ -9305,7 +9289,6 @@ var setupIdeFiles_exports = {};
|
|
|
9305
9289
|
__export(setupIdeFiles_exports, {
|
|
9306
9290
|
CANONICAL_MEMORAONE_MCP_SERVER_NAME: () => CANONICAL_MEMORAONE_MCP_SERVER_NAME,
|
|
9307
9291
|
CLINE_CLI_MCP_TIMEOUT_SECONDS: () => CLINE_CLI_MCP_TIMEOUT_SECONDS,
|
|
9308
|
-
ClineNoHostFoundError: () => ClineNoHostFoundError,
|
|
9309
9292
|
GITIGNORE_MEMORAONE_COMMENT: () => GITIGNORE_MEMORAONE_COMMENT,
|
|
9310
9293
|
GITIGNORE_MEMORAONE_ENTRY: () => GITIGNORE_MEMORAONE_ENTRY,
|
|
9311
9294
|
JETBRAINS_DEBUG_ENV_VARS: () => JETBRAINS_DEBUG_ENV_VARS,
|
|
@@ -9340,7 +9323,6 @@ __export(setupIdeFiles_exports, {
|
|
|
9340
9323
|
cliSetupIdeFiles: () => cliSetupIdeFiles,
|
|
9341
9324
|
cursorConfigHasManagedMemoraone: () => cursorConfigHasManagedMemoraone,
|
|
9342
9325
|
cursorEnvironmentFromFlags: () => cursorEnvironmentFromFlags,
|
|
9343
|
-
detectClineHosts: () => detectClineHosts,
|
|
9344
9326
|
detectCursorGlobalMcpConfig: () => detectCursorGlobalMcpConfig,
|
|
9345
9327
|
findRepoRoot: () => findRepoRoot,
|
|
9346
9328
|
formatJetBrainsBackupTimestamp: () => formatJetBrainsBackupTimestamp,
|
|
@@ -9354,8 +9336,7 @@ __export(setupIdeFiles_exports, {
|
|
|
9354
9336
|
getClineCliGlobalMcpConfigPath: () => getClineCliGlobalMcpConfigPath,
|
|
9355
9337
|
getClineCliMcpConfigPaths: () => getClineCliMcpConfigPaths,
|
|
9356
9338
|
getClineCliRootMcpConfigPath: () => getClineCliRootMcpConfigPath,
|
|
9357
|
-
|
|
9358
|
-
getClineHostMcpConfigPath: () => getClineHostMcpConfigPath,
|
|
9339
|
+
getClineProjectMcpConfigPath: () => getClineProjectMcpConfigPath,
|
|
9359
9340
|
getCodexGlobalMcpConfigPath: () => getCodexGlobalMcpConfigPath,
|
|
9360
9341
|
getCodexProjectMcpConfigPath: () => getCodexProjectMcpConfigPath,
|
|
9361
9342
|
getContinueProjectMcpConfigPath: () => getContinueProjectMcpConfigPath,
|
|
@@ -9366,7 +9347,6 @@ __export(setupIdeFiles_exports, {
|
|
|
9366
9347
|
getGooseGlobalMcpConfigPath: () => getGooseGlobalMcpConfigPath,
|
|
9367
9348
|
getJunieProjectMcpConfigPath: () => getJunieProjectMcpConfigPath,
|
|
9368
9349
|
getKiroProjectMcpConfigPath: () => getKiroProjectMcpConfigPath,
|
|
9369
|
-
getKnownClineHostCandidates: () => getKnownClineHostCandidates,
|
|
9370
9350
|
getKnownCursorGlobalMcpConfigCandidates: () => getKnownCursorGlobalMcpConfigCandidates,
|
|
9371
9351
|
getKnownJetBrainsMcpConfigLocations: () => getKnownJetBrainsMcpConfigLocations,
|
|
9372
9352
|
getOpenCodeGlobalMcpConfigPath: () => getOpenCodeGlobalMcpConfigPath,
|
|
@@ -9476,7 +9456,7 @@ function buildMemoraoneMcpServer(ideType, options = {}) {
|
|
|
9476
9456
|
};
|
|
9477
9457
|
const includeWorkspaceRoot = options.workspaceRoot !== void 0 && (environment === "local" || ideType === "cursor" || ideType === "claude-code");
|
|
9478
9458
|
if (includeWorkspaceRoot) {
|
|
9479
|
-
env2[MEMORAONE_WORKSPACE_ROOT_ENV] =
|
|
9459
|
+
env2[MEMORAONE_WORKSPACE_ROOT_ENV] = path39.resolve(options.workspaceRoot);
|
|
9480
9460
|
}
|
|
9481
9461
|
if (environment === "local") {
|
|
9482
9462
|
if (!options.cliPath) {
|
|
@@ -9496,9 +9476,9 @@ function buildMemoraoneMcpServer(ideType, options = {}) {
|
|
|
9496
9476
|
};
|
|
9497
9477
|
}
|
|
9498
9478
|
function assertUnderRepoRoot(repoRoot, absPath) {
|
|
9499
|
-
const normRoot =
|
|
9500
|
-
const normPath =
|
|
9501
|
-
if (normPath !==
|
|
9479
|
+
const normRoot = path39.resolve(repoRoot) + path39.sep;
|
|
9480
|
+
const normPath = path39.resolve(absPath);
|
|
9481
|
+
if (normPath !== path39.resolve(repoRoot) && !normPath.startsWith(normRoot)) {
|
|
9502
9482
|
throw new Error(`[setup-ide-files] Refusing to write outside repo root: ${absPath}`);
|
|
9503
9483
|
}
|
|
9504
9484
|
}
|
|
@@ -9522,18 +9502,18 @@ async function ensureGitignoreMemoraone(_repoRoot, _opts) {
|
|
|
9522
9502
|
return "skipped";
|
|
9523
9503
|
}
|
|
9524
9504
|
async function findRepoRoot(startDir) {
|
|
9525
|
-
let current =
|
|
9526
|
-
const root =
|
|
9505
|
+
let current = path39.resolve(startDir);
|
|
9506
|
+
const root = path39.parse(current).root;
|
|
9527
9507
|
while (true) {
|
|
9528
|
-
const gitPath =
|
|
9529
|
-
const m1Path =
|
|
9508
|
+
const gitPath = path39.join(current, ".git");
|
|
9509
|
+
const m1Path = path39.join(current, "memoraone.m1");
|
|
9530
9510
|
if (await pathExists23(gitPath) || await pathExists23(m1Path)) {
|
|
9531
9511
|
return current;
|
|
9532
9512
|
}
|
|
9533
9513
|
if (current === root) {
|
|
9534
9514
|
return null;
|
|
9535
9515
|
}
|
|
9536
|
-
current =
|
|
9516
|
+
current = path39.dirname(current);
|
|
9537
9517
|
}
|
|
9538
9518
|
}
|
|
9539
9519
|
function stripLeadingLineComments18(text) {
|
|
@@ -9592,11 +9572,11 @@ function buildVscodeMcpJsonBody(existing, options = {}) {
|
|
|
9592
9572
|
return mcpJsonHeader() + JSON.stringify(merged, null, 2) + "\n";
|
|
9593
9573
|
}
|
|
9594
9574
|
async function writeSharedMcpJsonAtomic(filePath, content) {
|
|
9595
|
-
const dir =
|
|
9575
|
+
const dir = path39.dirname(filePath);
|
|
9596
9576
|
await fs34.mkdir(dir, { recursive: true });
|
|
9597
|
-
const tmpPath =
|
|
9577
|
+
const tmpPath = path39.join(
|
|
9598
9578
|
dir,
|
|
9599
|
-
`.${
|
|
9579
|
+
`.${path39.basename(filePath)}.${process.pid}.${(0, import_node_crypto25.randomBytes)(8).toString("hex")}.tmp`
|
|
9600
9580
|
);
|
|
9601
9581
|
try {
|
|
9602
9582
|
await fs34.writeFile(tmpPath, content, "utf8");
|
|
@@ -9650,7 +9630,7 @@ async function writeClaudeCodeMcpJson(repoRoot, buildBody, opts) {
|
|
|
9650
9630
|
return "updated";
|
|
9651
9631
|
}
|
|
9652
9632
|
async function writeManagedMarkdown(repoRoot, relPath, fullContent, opts) {
|
|
9653
|
-
const abs =
|
|
9633
|
+
const abs = path39.join(repoRoot, relPath);
|
|
9654
9634
|
assertUnderRepoRoot(repoRoot, abs);
|
|
9655
9635
|
let prior = "";
|
|
9656
9636
|
let existed = false;
|
|
@@ -9662,25 +9642,25 @@ async function writeManagedMarkdown(repoRoot, relPath, fullContent, opts) {
|
|
|
9662
9642
|
}
|
|
9663
9643
|
if (!existed) {
|
|
9664
9644
|
if (opts.dryRun) return "created";
|
|
9665
|
-
await fs34.mkdir(
|
|
9645
|
+
await fs34.mkdir(path39.dirname(abs), { recursive: true });
|
|
9666
9646
|
await fs34.writeFile(abs, fullContent, "utf8");
|
|
9667
9647
|
return "created";
|
|
9668
9648
|
}
|
|
9669
9649
|
if (prior.includes(MANAGED_MARKER)) {
|
|
9670
9650
|
if (prior === fullContent) return "skipped";
|
|
9671
9651
|
if (opts.dryRun) return "updated";
|
|
9672
|
-
await fs34.mkdir(
|
|
9652
|
+
await fs34.mkdir(path39.dirname(abs), { recursive: true });
|
|
9673
9653
|
await fs34.writeFile(abs, fullContent, "utf8");
|
|
9674
9654
|
return "updated";
|
|
9675
9655
|
}
|
|
9676
9656
|
if (!opts.force) return "skipped-untracked";
|
|
9677
9657
|
if (opts.dryRun) return "updated";
|
|
9678
|
-
await fs34.mkdir(
|
|
9658
|
+
await fs34.mkdir(path39.dirname(abs), { recursive: true });
|
|
9679
9659
|
await fs34.writeFile(abs, fullContent, "utf8");
|
|
9680
9660
|
return "updated";
|
|
9681
9661
|
}
|
|
9682
9662
|
async function writeIdeMcpJson(repoRoot, relPath, buildBody, opts) {
|
|
9683
|
-
const abs =
|
|
9663
|
+
const abs = path39.join(repoRoot, relPath);
|
|
9684
9664
|
assertUnderRepoRoot(repoRoot, abs);
|
|
9685
9665
|
let raw = "";
|
|
9686
9666
|
let existed = false;
|
|
@@ -10274,7 +10254,7 @@ async function runSetupIdeFiles(o) {
|
|
|
10274
10254
|
let junieMcp;
|
|
10275
10255
|
let xcodeMcp;
|
|
10276
10256
|
let copilotJetBrainsMcp;
|
|
10277
|
-
const repoRoot = o.workspaceRoot !== void 0 && o.workspaceRoot !== "" ?
|
|
10257
|
+
const repoRoot = o.workspaceRoot !== void 0 && o.workspaceRoot !== "" ? path39.resolve(o.workspaceRoot) : await findRepoRoot(o.cwd);
|
|
10278
10258
|
if (!repoRoot) {
|
|
10279
10259
|
return {
|
|
10280
10260
|
exitCode: 1,
|
|
@@ -10316,6 +10296,13 @@ async function runSetupIdeFiles(o) {
|
|
|
10316
10296
|
environment: localOrDev ? "local" : cursorEnvironment,
|
|
10317
10297
|
apiUrl: resolvedApiUrl2
|
|
10318
10298
|
});
|
|
10299
|
+
const bindingRecord = o.repositoryBindingId ? void 0 : await findBindingRecordByWorkspaceRoot(repoRoot, o.homeDir);
|
|
10300
|
+
const repositoryBindingId = o.repositoryBindingId ?? bindingRecord?.repositoryBindingId;
|
|
10301
|
+
const globalOwnership = repositoryBindingId ? {
|
|
10302
|
+
repositoryBindingId,
|
|
10303
|
+
replacedRepositoryBindingIds: o.replacedRepositoryBindingIds,
|
|
10304
|
+
workspaceRoot: repoRoot
|
|
10305
|
+
} : void 0;
|
|
10319
10306
|
if (!o.dryRun && resolvedApiUrl2) {
|
|
10320
10307
|
await persistBindingApiUrl(repoRoot, effectiveApiUrl, o.homeDir, o.dryRun);
|
|
10321
10308
|
}
|
|
@@ -10496,7 +10483,7 @@ description: MemoraOne MCP \u2014 IDE agent instructions
|
|
|
10496
10483
|
{ force: o.force, dryRun: o.dryRun }
|
|
10497
10484
|
);
|
|
10498
10485
|
try {
|
|
10499
|
-
const homeDir = o.jetbrainsHomeDir ??
|
|
10486
|
+
const homeDir = o.jetbrainsHomeDir ?? os13.homedir();
|
|
10500
10487
|
const activePath = o.jetbrainsGlobalMcpConfigPath ?? getJetBrainsGlobalMcpConfigPath(homeDir);
|
|
10501
10488
|
const jetbrainsSetup = await setupJetBrainsMcpConfig({
|
|
10502
10489
|
homeDir,
|
|
@@ -10512,7 +10499,8 @@ description: MemoraOne MCP \u2014 IDE agent instructions
|
|
|
10512
10499
|
repair: o.repair ?? false,
|
|
10513
10500
|
verify: o.verifyHandshake ?? !o.dryRun,
|
|
10514
10501
|
npxPathOverride: o.npxPathOverride,
|
|
10515
|
-
cliPathOverride: o.cliPathOverride
|
|
10502
|
+
cliPathOverride: o.cliPathOverride,
|
|
10503
|
+
ownership: globalOwnership
|
|
10516
10504
|
});
|
|
10517
10505
|
jetbrainsMcp = {
|
|
10518
10506
|
activeConfigPath: activePath,
|
|
@@ -10606,7 +10594,7 @@ description: MemoraOne MCP \u2014 IDE agent instructions
|
|
|
10606
10594
|
}
|
|
10607
10595
|
if (o.targets.windsurf) {
|
|
10608
10596
|
try {
|
|
10609
|
-
const homeDir = o.windsurfHomeDir ??
|
|
10597
|
+
const homeDir = o.windsurfHomeDir ?? os13.homedir();
|
|
10610
10598
|
const activePath = o.windsurfGlobalMcpConfigPath ?? getWindsurfGlobalMcpConfigPath(homeDir);
|
|
10611
10599
|
const legacyPath = o.windsurfLegacyMcpConfigPath ?? getWindsurfLegacyMcpConfigPath(homeDir);
|
|
10612
10600
|
const windsurfSetup = await setupWindsurfMcpConfig({
|
|
@@ -10622,7 +10610,8 @@ description: MemoraOne MCP \u2014 IDE agent instructions
|
|
|
10622
10610
|
npmPackageChannel,
|
|
10623
10611
|
apiUrl: resolvedApiUrl2,
|
|
10624
10612
|
npxPathOverride: o.npxPathOverride,
|
|
10625
|
-
cliPathOverride: o.cliPathOverride ?? o.cursorLocalCliPathOverride
|
|
10613
|
+
cliPathOverride: o.cliPathOverride ?? o.cursorLocalCliPathOverride,
|
|
10614
|
+
ownership: globalOwnership
|
|
10626
10615
|
});
|
|
10627
10616
|
windsurfMcp = {
|
|
10628
10617
|
activeConfigPath: windsurfSetup.activeConfigPath,
|
|
@@ -10802,13 +10791,10 @@ description: MemoraOne MCP \u2014 IDE agent instructions
|
|
|
10802
10791
|
}
|
|
10803
10792
|
if (o.targets.cline) {
|
|
10804
10793
|
try {
|
|
10805
|
-
const
|
|
10794
|
+
const activeConfigPath = o.clineProjectMcpConfigPath ?? getClineProjectMcpConfigPath(repoRoot);
|
|
10806
10795
|
const clineSetup = await setupClineMcpConfig({
|
|
10807
|
-
homeDir,
|
|
10808
10796
|
repoRoot,
|
|
10809
|
-
|
|
10810
|
-
explicitHostIds: o.clineExplicitHostIds,
|
|
10811
|
-
explicitHostPaths: o.clineExplicitHostPaths,
|
|
10797
|
+
projectConfigPath: activeConfigPath,
|
|
10812
10798
|
dryRun: o.dryRun,
|
|
10813
10799
|
devMode: localOrDev,
|
|
10814
10800
|
environment: localOrDev ? "local" : cursorEnvironment,
|
|
@@ -10818,39 +10804,34 @@ description: MemoraOne MCP \u2014 IDE agent instructions
|
|
|
10818
10804
|
cliPathOverride: o.cliPathOverride ?? o.cursorLocalCliPathOverride
|
|
10819
10805
|
});
|
|
10820
10806
|
clineMcp = {
|
|
10821
|
-
|
|
10822
|
-
|
|
10807
|
+
activeConfigPath: clineSetup.activeConfigPath,
|
|
10808
|
+
outcome: clineSetup.outcome,
|
|
10809
|
+
npxPath: clineSetup.memoraone?.command,
|
|
10810
|
+
backupPath: clineSetup.backupPath
|
|
10823
10811
|
};
|
|
10824
|
-
|
|
10825
|
-
outcomes[`cline-${host.hostId}:${host.activeConfigPath}`] = host.outcome;
|
|
10826
|
-
}
|
|
10812
|
+
outcomes[".cline/mcp.json"] = clineSetup.outcome;
|
|
10827
10813
|
} 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
|
-
}
|
|
10814
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
10815
|
+
return {
|
|
10816
|
+
exitCode: 1,
|
|
10817
|
+
repoRoot,
|
|
10818
|
+
outcomes,
|
|
10819
|
+
cursorMcp,
|
|
10820
|
+
jetbrainsMcp,
|
|
10821
|
+
windsurfMcp,
|
|
10822
|
+
opencodeMcp,
|
|
10823
|
+
codexMcp,
|
|
10824
|
+
kiroMcp,
|
|
10825
|
+
rooCodeMcp,
|
|
10826
|
+
clineMcp,
|
|
10827
|
+
daemonCleanup,
|
|
10828
|
+
error: message
|
|
10829
|
+
};
|
|
10849
10830
|
}
|
|
10850
10831
|
}
|
|
10851
10832
|
if (o.targets.clineCli) {
|
|
10852
10833
|
try {
|
|
10853
|
-
const homeDir = o.clineCliHomeDir ?? o.homeDir ??
|
|
10834
|
+
const homeDir = o.clineCliHomeDir ?? o.homeDir ?? os13.homedir();
|
|
10854
10835
|
const settingsPath = o.clineCliGlobalMcpConfigPath ?? getClineCliGlobalMcpConfigPath(homeDir);
|
|
10855
10836
|
const rootPath = o.clineCliRootMcpConfigPath ?? getClineCliRootMcpConfigPath(homeDir);
|
|
10856
10837
|
const clineCliSetup = await setupClineCliMcpConfig({
|
|
@@ -10864,7 +10845,8 @@ description: MemoraOne MCP \u2014 IDE agent instructions
|
|
|
10864
10845
|
npmPackageChannel,
|
|
10865
10846
|
apiUrl: resolvedApiUrl2,
|
|
10866
10847
|
npxPathOverride: o.npxPathOverride,
|
|
10867
|
-
cliPathOverride: o.cliPathOverride ?? o.cursorLocalCliPathOverride
|
|
10848
|
+
cliPathOverride: o.cliPathOverride ?? o.cursorLocalCliPathOverride,
|
|
10849
|
+
ownership: globalOwnership
|
|
10868
10850
|
});
|
|
10869
10851
|
clineCliMcp = {
|
|
10870
10852
|
activeConfigPath: clineCliSetup.activeConfigPath,
|
|
@@ -10899,7 +10881,7 @@ description: MemoraOne MCP \u2014 IDE agent instructions
|
|
|
10899
10881
|
}
|
|
10900
10882
|
if (o.targets.claudeDesktop) {
|
|
10901
10883
|
try {
|
|
10902
|
-
const homeDir = o.claudeDesktopHomeDir ?? o.homeDir ??
|
|
10884
|
+
const homeDir = o.claudeDesktopHomeDir ?? o.homeDir ?? os13.homedir();
|
|
10903
10885
|
const activePath = o.claudeDesktopGlobalMcpConfigPath ?? getClaudeDesktopGlobalMcpConfigPath(homeDir);
|
|
10904
10886
|
const claudeDesktopSetup = await setupClaudeDesktopMcpConfig({
|
|
10905
10887
|
homeDir,
|
|
@@ -10911,7 +10893,8 @@ description: MemoraOne MCP \u2014 IDE agent instructions
|
|
|
10911
10893
|
npmPackageChannel,
|
|
10912
10894
|
apiUrl: resolvedApiUrl2,
|
|
10913
10895
|
npxPathOverride: o.npxPathOverride,
|
|
10914
|
-
cliPathOverride: o.cliPathOverride ?? o.cursorLocalCliPathOverride
|
|
10896
|
+
cliPathOverride: o.cliPathOverride ?? o.cursorLocalCliPathOverride,
|
|
10897
|
+
ownership: globalOwnership
|
|
10915
10898
|
});
|
|
10916
10899
|
claudeDesktopMcp = {
|
|
10917
10900
|
activeConfigPath: claudeDesktopSetup.activeConfigPath,
|
|
@@ -11206,7 +11189,7 @@ description: MemoraOne MCP \u2014 IDE agent instructions
|
|
|
11206
11189
|
}
|
|
11207
11190
|
if (o.targets.antigravity) {
|
|
11208
11191
|
try {
|
|
11209
|
-
const homeDir = o.antigravityHomeDir ?? o.homeDir ??
|
|
11192
|
+
const homeDir = o.antigravityHomeDir ?? o.homeDir ?? os13.homedir();
|
|
11210
11193
|
const activePath = o.antigravityGlobalMcpConfigPath ?? getAntigravityGlobalMcpConfigPath(homeDir);
|
|
11211
11194
|
const legacyPath = o.antigravityLegacyMcpConfigPath ?? getAntigravityLegacyMcpConfigPath(homeDir);
|
|
11212
11195
|
const antigravitySetup = await setupAntigravityMcpConfig({
|
|
@@ -11220,7 +11203,8 @@ description: MemoraOne MCP \u2014 IDE agent instructions
|
|
|
11220
11203
|
npmPackageChannel,
|
|
11221
11204
|
apiUrl: resolvedApiUrl2,
|
|
11222
11205
|
npxPathOverride: o.npxPathOverride,
|
|
11223
|
-
cliPathOverride: o.cliPathOverride ?? o.cursorLocalCliPathOverride
|
|
11206
|
+
cliPathOverride: o.cliPathOverride ?? o.cursorLocalCliPathOverride,
|
|
11207
|
+
ownership: globalOwnership
|
|
11224
11208
|
});
|
|
11225
11209
|
antigravityMcp = {
|
|
11226
11210
|
activeConfigPath: antigravitySetup.activeConfigPath,
|
|
@@ -11261,7 +11245,7 @@ description: MemoraOne MCP \u2014 IDE agent instructions
|
|
|
11261
11245
|
}
|
|
11262
11246
|
if (o.targets.goose) {
|
|
11263
11247
|
try {
|
|
11264
|
-
const homeDir = o.gooseHomeDir ?? o.homeDir ??
|
|
11248
|
+
const homeDir = o.gooseHomeDir ?? o.homeDir ?? os13.homedir();
|
|
11265
11249
|
const activePath = o.gooseGlobalMcpConfigPath ?? getGooseGlobalMcpConfigPath(homeDir);
|
|
11266
11250
|
const gooseSetup = await setupGooseMcpConfig({
|
|
11267
11251
|
homeDir,
|
|
@@ -11273,7 +11257,8 @@ description: MemoraOne MCP \u2014 IDE agent instructions
|
|
|
11273
11257
|
npmPackageChannel,
|
|
11274
11258
|
apiUrl: resolvedApiUrl2,
|
|
11275
11259
|
npxPathOverride: o.npxPathOverride,
|
|
11276
|
-
cliPathOverride: o.cliPathOverride ?? o.cursorLocalCliPathOverride
|
|
11260
|
+
cliPathOverride: o.cliPathOverride ?? o.cursorLocalCliPathOverride,
|
|
11261
|
+
ownership: globalOwnership
|
|
11277
11262
|
});
|
|
11278
11263
|
gooseMcp = {
|
|
11279
11264
|
activeConfigPath: gooseSetup.activeConfigPath,
|
|
@@ -11362,7 +11347,7 @@ description: MemoraOne MCP \u2014 IDE agent instructions
|
|
|
11362
11347
|
}
|
|
11363
11348
|
if (o.targets.xcode) {
|
|
11364
11349
|
try {
|
|
11365
|
-
const homeDir = o.xcodeHomeDir ?? o.homeDir ??
|
|
11350
|
+
const homeDir = o.xcodeHomeDir ?? o.homeDir ?? os13.homedir();
|
|
11366
11351
|
const activePath = o.xcodeGlobalMcpConfigPath ?? getXcodeGlobalMcpConfigPath(homeDir);
|
|
11367
11352
|
const xcodeSetup = await setupXcodeMcpConfig({
|
|
11368
11353
|
homeDir,
|
|
@@ -11374,7 +11359,8 @@ description: MemoraOne MCP \u2014 IDE agent instructions
|
|
|
11374
11359
|
npmPackageChannel,
|
|
11375
11360
|
apiUrl: resolvedApiUrl2,
|
|
11376
11361
|
npxPathOverride: o.npxPathOverride,
|
|
11377
|
-
cliPathOverride: o.cliPathOverride ?? o.cursorLocalCliPathOverride
|
|
11362
|
+
cliPathOverride: o.cliPathOverride ?? o.cursorLocalCliPathOverride,
|
|
11363
|
+
ownership: globalOwnership
|
|
11378
11364
|
});
|
|
11379
11365
|
xcodeMcp = {
|
|
11380
11366
|
activeConfigPath: xcodeSetup.activeConfigPath,
|
|
@@ -11415,7 +11401,7 @@ description: MemoraOne MCP \u2014 IDE agent instructions
|
|
|
11415
11401
|
}
|
|
11416
11402
|
if (o.targets.copilotJetBrains) {
|
|
11417
11403
|
try {
|
|
11418
|
-
const homeDir = o.copilotJetBrainsHomeDir ?? o.homeDir ??
|
|
11404
|
+
const homeDir = o.copilotJetBrainsHomeDir ?? o.homeDir ?? os13.homedir();
|
|
11419
11405
|
const activePath = o.copilotJetBrainsGlobalMcpConfigPath ?? getCopilotJetBrainsGlobalMcpConfigPath(homeDir);
|
|
11420
11406
|
const copilotJetBrainsSetup = await setupCopilotJetBrainsMcpConfig({
|
|
11421
11407
|
homeDir,
|
|
@@ -11427,7 +11413,8 @@ description: MemoraOne MCP \u2014 IDE agent instructions
|
|
|
11427
11413
|
npmPackageChannel,
|
|
11428
11414
|
apiUrl: resolvedApiUrl2,
|
|
11429
11415
|
npxPathOverride: o.npxPathOverride,
|
|
11430
|
-
cliPathOverride: o.cliPathOverride ?? o.cursorLocalCliPathOverride
|
|
11416
|
+
cliPathOverride: o.cliPathOverride ?? o.cursorLocalCliPathOverride,
|
|
11417
|
+
ownership: globalOwnership
|
|
11431
11418
|
});
|
|
11432
11419
|
copilotJetBrainsMcp = {
|
|
11433
11420
|
activeConfigPath: copilotJetBrainsSetup.activeConfigPath,
|
|
@@ -11601,13 +11588,13 @@ async function cliSetupIdeFiles(argv, options = {}) {
|
|
|
11601
11588
|
}
|
|
11602
11589
|
return 0;
|
|
11603
11590
|
}
|
|
11604
|
-
var fs34,
|
|
11591
|
+
var fs34, os13, path39, import_node_crypto25, MANAGED_MARKER, GITIGNORE_MEMORAONE_COMMENT, GITIGNORE_MEMORAONE_ENTRY, SharedMcpJsonParseError;
|
|
11605
11592
|
var init_setupIdeFiles = __esm({
|
|
11606
11593
|
"src/setupIdeFiles.ts"() {
|
|
11607
11594
|
fs34 = __toESM(require("fs/promises"), 1);
|
|
11608
|
-
|
|
11609
|
-
|
|
11610
|
-
|
|
11595
|
+
os13 = __toESM(require("os"), 1);
|
|
11596
|
+
path39 = __toESM(require("path"), 1);
|
|
11597
|
+
import_node_crypto25 = require("crypto");
|
|
11611
11598
|
init_cleanup();
|
|
11612
11599
|
init_cursorGlobalMcpConfig();
|
|
11613
11600
|
init_jetbrainsMcpConfig();
|
|
@@ -11677,10 +11664,10 @@ var init_setupIdeFiles = __esm({
|
|
|
11677
11664
|
|
|
11678
11665
|
// src/localState/replaceRootLocalState.ts
|
|
11679
11666
|
function canonicalizeWorkspaceRoot(workspaceRoot) {
|
|
11680
|
-
return
|
|
11667
|
+
return path40.resolve(workspaceRoot);
|
|
11681
11668
|
}
|
|
11682
11669
|
function getWorkspaceMapPathForHome(homeDir) {
|
|
11683
|
-
return
|
|
11670
|
+
return path40.join(getMemoraoneStateDir(homeDir), WORKSPACE_MAP_FILENAME);
|
|
11684
11671
|
}
|
|
11685
11672
|
async function loadWorkspaceMapFile(homeDir) {
|
|
11686
11673
|
const filePath = getWorkspaceMapPathForHome(homeDir);
|
|
@@ -11695,7 +11682,7 @@ async function saveWorkspaceMapFile(map, homeDir) {
|
|
|
11695
11682
|
await writeJsonAtomic(getWorkspaceMapPathForHome(homeDir), map);
|
|
11696
11683
|
}
|
|
11697
11684
|
function rootsMatch(a, b) {
|
|
11698
|
-
return
|
|
11685
|
+
return path40.resolve(a) === path40.resolve(b);
|
|
11699
11686
|
}
|
|
11700
11687
|
async function collectRootAssociatedBindingIds(workspaceRoot, options = {}) {
|
|
11701
11688
|
const canonicalRoot = canonicalizeWorkspaceRoot(workspaceRoot);
|
|
@@ -11852,11 +11839,11 @@ async function restoreRootLocalState(snapshot, options = {}) {
|
|
|
11852
11839
|
await writeInstallationCredentials(creds, options.credentialOptions);
|
|
11853
11840
|
}
|
|
11854
11841
|
}
|
|
11855
|
-
var fs35,
|
|
11842
|
+
var fs35, path40, WORKSPACE_MAP_FILENAME, FINGERPRINT_REGEX;
|
|
11856
11843
|
var init_replaceRootLocalState = __esm({
|
|
11857
11844
|
"src/localState/replaceRootLocalState.ts"() {
|
|
11858
11845
|
fs35 = __toESM(require("fs/promises"), 1);
|
|
11859
|
-
|
|
11846
|
+
path40 = __toESM(require("path"), 1);
|
|
11860
11847
|
init_installationCredentials();
|
|
11861
11848
|
init_bindingStore();
|
|
11862
11849
|
init_localLocks();
|
|
@@ -11920,9 +11907,6 @@ async function defaultRemoveSocket2(socketPath) {
|
|
|
11920
11907
|
} catch {
|
|
11921
11908
|
}
|
|
11922
11909
|
}
|
|
11923
|
-
function rootsMatch2(a, b) {
|
|
11924
|
-
return path40.resolve(a) === path40.resolve(b);
|
|
11925
|
-
}
|
|
11926
11910
|
function classifyMemoraoneDaemonForConnect(proc, opts) {
|
|
11927
11911
|
const newBinding = opts.newRepositoryBindingId.trim();
|
|
11928
11912
|
if (proc.repositoryBindingId && proc.repositoryBindingId === newBinding) {
|
|
@@ -11937,11 +11921,11 @@ function classifyMemoraoneDaemonForConnect(proc, opts) {
|
|
|
11937
11921
|
}
|
|
11938
11922
|
return "preserve";
|
|
11939
11923
|
}
|
|
11940
|
-
function classifyClineHubForConnect(
|
|
11941
|
-
return
|
|
11924
|
+
function classifyClineHubForConnect(_proc, _workspaceRoot) {
|
|
11925
|
+
return "preserve";
|
|
11942
11926
|
}
|
|
11943
11927
|
async function runConnectRuntimeCleanup(options) {
|
|
11944
|
-
const workspaceRoot =
|
|
11928
|
+
const workspaceRoot = path41.resolve(options.workspaceRoot);
|
|
11945
11929
|
const newRepositoryBindingId = options.newRepositoryBindingId.trim();
|
|
11946
11930
|
const replacedBindingIds = new Set(
|
|
11947
11931
|
(options.replacedBindingIds ?? []).map((id) => id.trim()).filter(Boolean)
|
|
@@ -12112,10 +12096,10 @@ async function runConnectRuntimeCleanup(options) {
|
|
|
12112
12096
|
staleRuntimeRemains
|
|
12113
12097
|
};
|
|
12114
12098
|
}
|
|
12115
|
-
var
|
|
12099
|
+
var path41, import_node_child_process6, import_node_util5, fs36, execFileAsync5, CLINE_HUB_DAEMON_MARKER;
|
|
12116
12100
|
var init_connectRuntimeCleanup = __esm({
|
|
12117
12101
|
"src/connectRuntimeCleanup.ts"() {
|
|
12118
|
-
|
|
12102
|
+
path41 = __toESM(require("path"), 1);
|
|
12119
12103
|
import_node_child_process6 = require("child_process");
|
|
12120
12104
|
import_node_util5 = require("util");
|
|
12121
12105
|
fs36 = __toESM(require("fs/promises"), 1);
|
|
@@ -12149,7 +12133,7 @@ function normalizeGitRemote(remoteUrl) {
|
|
|
12149
12133
|
return normalized.toLowerCase() || null;
|
|
12150
12134
|
}
|
|
12151
12135
|
async function detectLegacyM1Warning2(workspaceRoot) {
|
|
12152
|
-
const candidate =
|
|
12136
|
+
const candidate = path42.join(path42.resolve(workspaceRoot), CANONICAL_M1_FILENAME);
|
|
12153
12137
|
try {
|
|
12154
12138
|
await fs37.access(candidate);
|
|
12155
12139
|
return candidate;
|
|
@@ -12166,9 +12150,9 @@ async function rollbackFailedConnect(options) {
|
|
|
12166
12150
|
}
|
|
12167
12151
|
async function runConnectCommand(options) {
|
|
12168
12152
|
const code = normalizeConnectCode(options.code);
|
|
12169
|
-
const cwd2 =
|
|
12153
|
+
const cwd2 = path42.resolve(options.cwd ?? process.cwd());
|
|
12170
12154
|
const apiUrl = (options.apiUrl ?? config2.apiUrl).replace(/\/+$/, "");
|
|
12171
|
-
const homeDir = options.homeDir ??
|
|
12155
|
+
const homeDir = options.homeDir ?? os14.homedir();
|
|
12172
12156
|
const environment = "local";
|
|
12173
12157
|
const verifyLocalBinding = options.verifyLocalBinding ?? resolveLocalBinding;
|
|
12174
12158
|
const executionMode = await resolvePackageExecutionMode({
|
|
@@ -12195,7 +12179,7 @@ async function runConnectCommand(options) {
|
|
|
12195
12179
|
const legacyM1WarningPath = await detectLegacyM1Warning2(cwd2);
|
|
12196
12180
|
if (legacyM1WarningPath) {
|
|
12197
12181
|
process.stderr.write(
|
|
12198
|
-
`[memoraone-mcp] warning: ignoring legacy ${
|
|
12182
|
+
`[memoraone-mcp] warning: ignoring legacy ${path42.basename(legacyM1WarningPath)} at ${legacyM1WarningPath} (credentials and binding are package-managed)
|
|
12199
12183
|
`
|
|
12200
12184
|
);
|
|
12201
12185
|
}
|
|
@@ -12379,6 +12363,8 @@ async function runConnectCommand(options) {
|
|
|
12379
12363
|
cwd: cwd2,
|
|
12380
12364
|
// Use the exact bound workspace root — do not rediscover via .git / .m1.
|
|
12381
12365
|
workspaceRoot: cwd2,
|
|
12366
|
+
repositoryBindingId,
|
|
12367
|
+
replacedRepositoryBindingIds: snapshot.bindingIds,
|
|
12382
12368
|
targets,
|
|
12383
12369
|
force: true,
|
|
12384
12370
|
dryRun: false,
|
|
@@ -12388,8 +12374,6 @@ async function runConnectCommand(options) {
|
|
|
12388
12374
|
homeDir,
|
|
12389
12375
|
// Propagate the redeemed binding API URL (backend only — not execution mode).
|
|
12390
12376
|
apiUrl,
|
|
12391
|
-
// Connect configures every writer; skip Cline when no host IDE is installed.
|
|
12392
|
-
requireClineHosts: false,
|
|
12393
12377
|
...modeSetup,
|
|
12394
12378
|
...options.setupIdeOptions
|
|
12395
12379
|
});
|
|
@@ -12599,12 +12583,12 @@ async function cliConnect(argv, options = {}) {
|
|
|
12599
12583
|
return 1;
|
|
12600
12584
|
}
|
|
12601
12585
|
}
|
|
12602
|
-
var fs37,
|
|
12586
|
+
var fs37, path42, os14;
|
|
12603
12587
|
var init_connectCommand = __esm({
|
|
12604
12588
|
"src/localState/connectCommand.ts"() {
|
|
12605
12589
|
fs37 = __toESM(require("fs/promises"), 1);
|
|
12606
|
-
|
|
12607
|
-
|
|
12590
|
+
path42 = __toESM(require("path"), 1);
|
|
12591
|
+
os14 = __toESM(require("os"), 1);
|
|
12608
12592
|
init_config();
|
|
12609
12593
|
init_projectBinding();
|
|
12610
12594
|
init_packageExecutionMode();
|
|
@@ -12765,8 +12749,8 @@ var init_bridgeClientRoots = __esm({
|
|
|
12765
12749
|
if (this.closed) {
|
|
12766
12750
|
return null;
|
|
12767
12751
|
}
|
|
12768
|
-
return new Promise((
|
|
12769
|
-
this.waiters.push(
|
|
12752
|
+
return new Promise((resolve39) => {
|
|
12753
|
+
this.waiters.push(resolve39);
|
|
12770
12754
|
});
|
|
12771
12755
|
}
|
|
12772
12756
|
/** Re-queue lines read during an intermediate protocol step (e.g. roots/list) for the main bridge loop. */
|
|
@@ -12993,9 +12977,9 @@ function extractJsonRpcId(line) {
|
|
|
12993
12977
|
}
|
|
12994
12978
|
}
|
|
12995
12979
|
function connectWithRetry(socketPath, log, maxRetries, retryDelayMs, connect2) {
|
|
12996
|
-
return new Promise((
|
|
12980
|
+
return new Promise((resolve39, reject) => {
|
|
12997
12981
|
const tryConnect = (attempt) => {
|
|
12998
|
-
connect2(socketPath).then(
|
|
12982
|
+
connect2(socketPath).then(resolve39).catch((err) => {
|
|
12999
12983
|
if (attempt >= maxRetries) {
|
|
13000
12984
|
reject(err);
|
|
13001
12985
|
return;
|
|
@@ -13191,8 +13175,8 @@ var init_bridgeProxy = __esm({
|
|
|
13191
13175
|
this.maxRetries = options.maxRetries ?? 5;
|
|
13192
13176
|
this.retryDelayMs = options.retryDelayMs ?? 200;
|
|
13193
13177
|
this.lineReader = options.lineReader ?? null;
|
|
13194
|
-
this.connectImpl = options.connect ?? ((socketPath) => new Promise((
|
|
13195
|
-
const socket = net.connect(socketPath, () =>
|
|
13178
|
+
this.connectImpl = options.connect ?? ((socketPath) => new Promise((resolve39, reject) => {
|
|
13179
|
+
const socket = net.connect(socketPath, () => resolve39(socket));
|
|
13196
13180
|
socket.on("error", reject);
|
|
13197
13181
|
}));
|
|
13198
13182
|
this.spawnDaemonImpl = options.spawnDaemon ?? (async (binding) => {
|
|
@@ -13324,7 +13308,7 @@ var init_bridgeProxy = __esm({
|
|
|
13324
13308
|
}
|
|
13325
13309
|
waitForDaemonJsonRpcResponse(id, timeoutMs = 3e4) {
|
|
13326
13310
|
const key = this.waiterKey(id);
|
|
13327
|
-
return new Promise((
|
|
13311
|
+
return new Promise((resolve39, reject) => {
|
|
13328
13312
|
const timer = setTimeout(() => {
|
|
13329
13313
|
this.pendingDaemonResponseWaiters.delete(key);
|
|
13330
13314
|
reject(
|
|
@@ -13333,7 +13317,7 @@ var init_bridgeProxy = __esm({
|
|
|
13333
13317
|
)
|
|
13334
13318
|
);
|
|
13335
13319
|
}, timeoutMs);
|
|
13336
|
-
this.pendingDaemonResponseWaiters.set(key, { resolve:
|
|
13320
|
+
this.pendingDaemonResponseWaiters.set(key, { resolve: resolve39, reject, timer });
|
|
13337
13321
|
});
|
|
13338
13322
|
}
|
|
13339
13323
|
notifyDaemonResponseWaiters(line) {
|