@memnexus-ai/cli 1.7.42 → 1.7.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/auth.d.ts.map +1 -1
- package/dist/commands/auth.js +24 -0
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/memories.d.ts.map +1 -1
- package/dist/commands/memories.js +20 -2
- package/dist/commands/memories.js.map +1 -1
- package/dist/commands/setup.d.ts +6 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +406 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/index.js +21 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/agent-help.d.ts.map +1 -1
- package/dist/lib/agent-help.js +42 -0
- package/dist/lib/agent-help.js.map +1 -1
- package/dist/lib/auth.d.ts.map +1 -1
- package/dist/lib/auth.js +0 -1
- package/dist/lib/auth.js.map +1 -1
- package/dist/lib/setup/config-writer.d.ts +37 -0
- package/dist/lib/setup/config-writer.d.ts.map +1 -0
- package/dist/lib/setup/config-writer.js +186 -0
- package/dist/lib/setup/config-writer.js.map +1 -0
- package/dist/lib/setup/detector.d.ts +13 -0
- package/dist/lib/setup/detector.d.ts.map +1 -0
- package/dist/lib/setup/detector.js +163 -0
- package/dist/lib/setup/detector.js.map +1 -0
- package/dist/lib/setup/index.d.ts +9 -0
- package/dist/lib/setup/index.d.ts.map +1 -0
- package/dist/lib/setup/index.js +33 -0
- package/dist/lib/setup/index.js.map +1 -0
- package/dist/lib/setup/proxy.d.ts +28 -0
- package/dist/lib/setup/proxy.d.ts.map +1 -0
- package/dist/lib/setup/proxy.js +201 -0
- package/dist/lib/setup/proxy.js.map +1 -0
- package/dist/lib/setup/registry.d.ts +12 -0
- package/dist/lib/setup/registry.d.ts.map +1 -0
- package/dist/lib/setup/registry.js +179 -0
- package/dist/lib/setup/registry.js.map +1 -0
- package/dist/lib/setup/rules-templates.d.ts +18 -0
- package/dist/lib/setup/rules-templates.d.ts.map +1 -0
- package/dist/lib/setup/rules-templates.js +195 -0
- package/dist/lib/setup/rules-templates.js.map +1 -0
- package/dist/lib/setup/rules-writer.d.ts +40 -0
- package/dist/lib/setup/rules-writer.d.ts.map +1 -0
- package/dist/lib/setup/rules-writer.js +126 -0
- package/dist/lib/setup/rules-writer.js.map +1 -0
- package/dist/lib/setup/types.d.ts +120 -0
- package/dist/lib/setup/types.d.ts.map +1 -0
- package/dist/lib/setup/types.js +6 -0
- package/dist/lib/setup/types.js.map +1 -0
- package/dist/lib/setup/verifier.d.ts +13 -0
- package/dist/lib/setup/verifier.d.ts.map +1 -0
- package/dist/lib/setup/verifier.js +199 -0
- package/dist/lib/setup/verifier.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* mcp-proxy binary management — download, verify, and locate the compiled
|
|
4
|
+
* Rust binary that bridges stdio ↔ streamable HTTP for MCP connections.
|
|
5
|
+
*
|
|
6
|
+
* Source: https://github.com/tidewave-ai/mcp_proxy_rust
|
|
7
|
+
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
+
}) : function(o, v) {
|
|
22
|
+
o["default"] = v;
|
|
23
|
+
});
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
42
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.detectPlatform = detectPlatform;
|
|
46
|
+
exports.getProxyDir = getProxyDir;
|
|
47
|
+
exports.getProxyPath = getProxyPath;
|
|
48
|
+
exports.isProxyInstalled = isProxyInstalled;
|
|
49
|
+
exports.ensureProxy = ensureProxy;
|
|
50
|
+
exports.removeProxy = removeProxy;
|
|
51
|
+
exports.getProxyVersion = getProxyVersion;
|
|
52
|
+
const node_fs_1 = require("node:fs");
|
|
53
|
+
const promises_1 = require("node:fs/promises");
|
|
54
|
+
const promises_2 = require("node:stream/promises");
|
|
55
|
+
const node_child_process_1 = require("node:child_process");
|
|
56
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
57
|
+
const node_os_1 = __importDefault(require("node:os"));
|
|
58
|
+
/** Pinned mcp-proxy version. Upgrade only after testing. */
|
|
59
|
+
const PROXY_VERSION = '0.2.3';
|
|
60
|
+
/** GitHub release URL pattern. */
|
|
61
|
+
const RELEASE_BASE = `https://github.com/tidewave-ai/mcp_proxy_rust/releases/download/v${PROXY_VERSION}`;
|
|
62
|
+
/** Map (os, arch) → release archive filename. */
|
|
63
|
+
const ARCHIVE_MAP = {
|
|
64
|
+
'darwin-arm64': `mcp-proxy-aarch64-apple-darwin.tar.gz`,
|
|
65
|
+
'darwin-x64': `mcp-proxy-x86_64-apple-darwin.tar.gz`,
|
|
66
|
+
'linux-arm64': `mcp-proxy-aarch64-unknown-linux-musl.tar.gz`,
|
|
67
|
+
'linux-x64': `mcp-proxy-x86_64-unknown-linux-musl.tar.gz`,
|
|
68
|
+
'win32-x64': `mcp-proxy-x86_64-pc-windows-msvc.zip`,
|
|
69
|
+
};
|
|
70
|
+
/** Detect current platform. */
|
|
71
|
+
function detectPlatform() {
|
|
72
|
+
const p = node_os_1.default.platform();
|
|
73
|
+
const a = node_os_1.default.arch() === 'arm64' ? 'arm64' : 'x64';
|
|
74
|
+
return { os: p, arch: a };
|
|
75
|
+
}
|
|
76
|
+
/** Get the directory where we store the proxy binary. */
|
|
77
|
+
function getProxyDir() {
|
|
78
|
+
return node_path_1.default.join(node_os_1.default.homedir(), '.memnexus', 'bin');
|
|
79
|
+
}
|
|
80
|
+
/** Get the full path to the proxy binary. */
|
|
81
|
+
function getProxyPath() {
|
|
82
|
+
const binaryName = node_os_1.default.platform() === 'win32' ? 'mcp-proxy.exe' : 'mcp-proxy';
|
|
83
|
+
return node_path_1.default.join(getProxyDir(), binaryName);
|
|
84
|
+
}
|
|
85
|
+
/** Get the version file path. */
|
|
86
|
+
function getVersionPath() {
|
|
87
|
+
return node_path_1.default.join(getProxyDir(), '.mcp-proxy-version');
|
|
88
|
+
}
|
|
89
|
+
/** Check if the proxy binary is installed and matches the pinned version. */
|
|
90
|
+
async function isProxyInstalled() {
|
|
91
|
+
const proxyPath = getProxyPath();
|
|
92
|
+
if (!(0, node_fs_1.existsSync)(proxyPath))
|
|
93
|
+
return false;
|
|
94
|
+
const versionPath = getVersionPath();
|
|
95
|
+
if (!(0, node_fs_1.existsSync)(versionPath))
|
|
96
|
+
return false;
|
|
97
|
+
try {
|
|
98
|
+
const installed = (await (0, promises_1.readFile)(versionPath, 'utf-8')).trim();
|
|
99
|
+
return installed === PROXY_VERSION;
|
|
100
|
+
}
|
|
101
|
+
catch {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Ensure the proxy binary is available. Downloads if not present or outdated.
|
|
107
|
+
* Returns the absolute path to the binary.
|
|
108
|
+
*/
|
|
109
|
+
async function ensureProxy(onProgress) {
|
|
110
|
+
if (await isProxyInstalled()) {
|
|
111
|
+
return getProxyPath();
|
|
112
|
+
}
|
|
113
|
+
const { os: platform, arch } = detectPlatform();
|
|
114
|
+
const key = `${platform}-${arch}`;
|
|
115
|
+
const archive = ARCHIVE_MAP[key];
|
|
116
|
+
if (!archive) {
|
|
117
|
+
throw new Error(`Unsupported platform: ${platform}-${arch}. ` +
|
|
118
|
+
`mcp-proxy supports: ${Object.keys(ARCHIVE_MAP).join(', ')}`);
|
|
119
|
+
}
|
|
120
|
+
const url = `${RELEASE_BASE}/${archive}`;
|
|
121
|
+
const dir = getProxyDir();
|
|
122
|
+
await (0, promises_1.mkdir)(dir, { recursive: true });
|
|
123
|
+
onProgress?.(`Downloading mcp-proxy v${PROXY_VERSION} for ${key}...`);
|
|
124
|
+
if (platform === 'win32') {
|
|
125
|
+
await downloadAndExtractZip(url, dir);
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
await downloadAndExtractTarGz(url, dir);
|
|
129
|
+
}
|
|
130
|
+
// Make executable on unix
|
|
131
|
+
if (platform !== 'win32') {
|
|
132
|
+
await (0, promises_1.chmod)(getProxyPath(), 0o755);
|
|
133
|
+
}
|
|
134
|
+
// Write version file
|
|
135
|
+
await (0, promises_1.writeFile)(getVersionPath(), PROXY_VERSION, 'utf-8');
|
|
136
|
+
onProgress?.(`mcp-proxy v${PROXY_VERSION} installed to ${dir}`);
|
|
137
|
+
return getProxyPath();
|
|
138
|
+
}
|
|
139
|
+
/** Remove the proxy binary and version file. */
|
|
140
|
+
async function removeProxy() {
|
|
141
|
+
const dir = getProxyDir();
|
|
142
|
+
const proxyPath = getProxyPath();
|
|
143
|
+
const versionPath = getVersionPath();
|
|
144
|
+
if ((0, node_fs_1.existsSync)(proxyPath))
|
|
145
|
+
await (0, promises_1.rm)(proxyPath);
|
|
146
|
+
if ((0, node_fs_1.existsSync)(versionPath))
|
|
147
|
+
await (0, promises_1.rm)(versionPath);
|
|
148
|
+
// Remove dir if empty
|
|
149
|
+
try {
|
|
150
|
+
const { readdir } = await Promise.resolve().then(() => __importStar(require('node:fs/promises')));
|
|
151
|
+
const entries = await readdir(dir);
|
|
152
|
+
if (entries.length === 0)
|
|
153
|
+
await (0, promises_1.rm)(dir, { recursive: true });
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
// ignore — dir may not exist
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
/** Get the pinned proxy version. */
|
|
160
|
+
function getProxyVersion() {
|
|
161
|
+
return PROXY_VERSION;
|
|
162
|
+
}
|
|
163
|
+
// ── Download helpers ──────────────────────────────────────────
|
|
164
|
+
async function downloadToFile(url, destPath) {
|
|
165
|
+
const response = await fetch(url);
|
|
166
|
+
if (!response.ok || !response.body) {
|
|
167
|
+
throw new Error(`Failed to download ${url}: ${response.status} ${response.statusText}`);
|
|
168
|
+
}
|
|
169
|
+
const fileStream = (0, node_fs_1.createWriteStream)(destPath);
|
|
170
|
+
await (0, promises_2.pipeline)(response.body, fileStream);
|
|
171
|
+
}
|
|
172
|
+
async function downloadAndExtractTarGz(url, destDir) {
|
|
173
|
+
const tempPath = node_path_1.default.join(destDir, '.download.tar.gz');
|
|
174
|
+
try {
|
|
175
|
+
await downloadToFile(url, tempPath);
|
|
176
|
+
// System tar is available on macOS, Linux, and Windows 10+.
|
|
177
|
+
// Use --strip-components to flatten any top-level directory.
|
|
178
|
+
(0, node_child_process_1.execFileSync)('tar', ['-xzf', tempPath, '-C', destDir, '--strip-components=1'], {
|
|
179
|
+
windowsHide: true,
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
finally {
|
|
183
|
+
if ((0, node_fs_1.existsSync)(tempPath))
|
|
184
|
+
await (0, promises_1.rm)(tempPath);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
async function downloadAndExtractZip(url, destDir) {
|
|
188
|
+
const tempPath = node_path_1.default.join(destDir, '.download.zip');
|
|
189
|
+
try {
|
|
190
|
+
await downloadToFile(url, tempPath);
|
|
191
|
+
// Windows 10+ includes tar which can extract zip files.
|
|
192
|
+
(0, node_child_process_1.execFileSync)('tar', ['-xf', tempPath, '-C', destDir], {
|
|
193
|
+
windowsHide: true,
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
finally {
|
|
197
|
+
if ((0, node_fs_1.existsSync)(tempPath))
|
|
198
|
+
await (0, promises_1.rm)(tempPath);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
//# sourceMappingURL=proxy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../../src/lib/setup/proxy.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BH,wCAIC;AAGD,kCAEC;AAGD,oCAGC;AAQD,4CAaC;AAMD,kCAwCC;AAGD,kCAgBC;AAGD,0CAEC;AAlID,qCAAwD;AACxD,+CAAyE;AACzE,mDAAgD;AAChD,2DAAkD;AAClD,0DAA6B;AAC7B,sDAAyB;AAGzB,4DAA4D;AAC5D,MAAM,aAAa,GAAG,OAAO,CAAC;AAE9B,kCAAkC;AAClC,MAAM,YAAY,GAAG,oEAAoE,aAAa,EAAE,CAAC;AAEzG,iDAAiD;AACjD,MAAM,WAAW,GAA2B;IAC1C,cAAc,EAAE,uCAAuC;IACvD,YAA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IAAI,IAAA,oBAAU,EAAC,QAAQ,CAAC;YAAE,MAAM,IAAA,aAAE,EAAC,QAAQ,CAAC,CAAC;IAC/C,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bundled agent registry — defines the 5 launch agents and their config patterns.
|
|
3
|
+
*/
|
|
4
|
+
import type { AgentDefinition } from './types.js';
|
|
5
|
+
export declare const AGENTS: AgentDefinition[];
|
|
6
|
+
/** Get an agent definition by ID. */
|
|
7
|
+
export declare function getAgent(id: string): AgentDefinition | undefined;
|
|
8
|
+
/** Get all agent IDs. */
|
|
9
|
+
export declare function getAgentIds(): string[];
|
|
10
|
+
/** Get agents sorted by sortOrder. */
|
|
11
|
+
export declare function getSortedAgents(): AgentDefinition[];
|
|
12
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/lib/setup/registry.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,eAAO,MAAM,MAAM,EAAE,eAAe,EA4JnC,CAAC;AAEF,qCAAqC;AACrC,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAEhE;AAED,yBAAyB;AACzB,wBAAgB,WAAW,IAAI,MAAM,EAAE,CAEtC;AAED,sCAAsC;AACtC,wBAAgB,eAAe,IAAI,eAAe,EAAE,CAEnD"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Bundled agent registry — defines the 5 launch agents and their config patterns.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AGENTS = void 0;
|
|
7
|
+
exports.getAgent = getAgent;
|
|
8
|
+
exports.getAgentIds = getAgentIds;
|
|
9
|
+
exports.getSortedAgents = getSortedAgents;
|
|
10
|
+
exports.AGENTS = [
|
|
11
|
+
{
|
|
12
|
+
id: 'claude-code',
|
|
13
|
+
name: 'Claude Code',
|
|
14
|
+
description: "Anthropic's CLI coding agent",
|
|
15
|
+
detection: {
|
|
16
|
+
projectDirs: ['.claude'],
|
|
17
|
+
binaries: ['claude'],
|
|
18
|
+
globalDirs: {
|
|
19
|
+
darwin: '~/.claude',
|
|
20
|
+
linux: '~/.claude',
|
|
21
|
+
win32: '~/.claude',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
mcp: {
|
|
25
|
+
projectConfigPath: '.claude/mcp.json',
|
|
26
|
+
globalConfigPath: {
|
|
27
|
+
darwin: '~/.claude/mcp.json',
|
|
28
|
+
linux: '~/.claude/mcp.json',
|
|
29
|
+
win32: '~/.claude/mcp.json',
|
|
30
|
+
},
|
|
31
|
+
serversKey: 'mcpServers',
|
|
32
|
+
configFormat: 'json',
|
|
33
|
+
transport: 'mcp-proxy-stdio',
|
|
34
|
+
},
|
|
35
|
+
steering: {
|
|
36
|
+
projectFilePath: 'CLAUDE.md',
|
|
37
|
+
globalFilePath: {
|
|
38
|
+
darwin: '~/.claude/CLAUDE.md',
|
|
39
|
+
linux: '~/.claude/CLAUDE.md',
|
|
40
|
+
win32: '~/.claude/CLAUDE.md',
|
|
41
|
+
},
|
|
42
|
+
contentFocus: 'full',
|
|
43
|
+
},
|
|
44
|
+
sortOrder: 1,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
id: 'claude-desktop',
|
|
48
|
+
name: 'Claude Desktop',
|
|
49
|
+
description: "Anthropic's desktop chat application",
|
|
50
|
+
detection: {
|
|
51
|
+
projectDirs: [], // Claude Desktop is global-only
|
|
52
|
+
binaries: [],
|
|
53
|
+
globalDirs: {
|
|
54
|
+
darwin: '~/Library/Application Support/Claude',
|
|
55
|
+
linux: '~/.config/Claude',
|
|
56
|
+
win32: '%APPDATA%/Claude',
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
mcp: {
|
|
60
|
+
projectConfigPath: '', // Not applicable — global only
|
|
61
|
+
globalConfigPath: {
|
|
62
|
+
darwin: '~/Library/Application Support/Claude/claude_desktop_config.json',
|
|
63
|
+
linux: '~/.config/Claude/claude_desktop_config.json',
|
|
64
|
+
win32: '%APPDATA%/Claude/claude_desktop_config.json',
|
|
65
|
+
},
|
|
66
|
+
serversKey: 'mcpServers',
|
|
67
|
+
configFormat: 'json',
|
|
68
|
+
transport: 'mcp-proxy-stdio',
|
|
69
|
+
},
|
|
70
|
+
steering: null, // Claude Desktop uses UI-based Project Knowledge
|
|
71
|
+
sortOrder: 2,
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
id: 'copilot',
|
|
75
|
+
name: 'GitHub Copilot (VS Code)',
|
|
76
|
+
description: "GitHub's AI pair programmer in VS Code",
|
|
77
|
+
detection: {
|
|
78
|
+
projectDirs: ['.vscode'],
|
|
79
|
+
binaries: ['code'],
|
|
80
|
+
globalDirs: {
|
|
81
|
+
darwin: '~/.vscode',
|
|
82
|
+
linux: '~/.vscode',
|
|
83
|
+
win32: '~/.vscode',
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
mcp: {
|
|
87
|
+
projectConfigPath: '.vscode/mcp.json',
|
|
88
|
+
globalConfigPath: {
|
|
89
|
+
darwin: '~/.vscode/mcp.json',
|
|
90
|
+
linux: '~/.vscode/mcp.json',
|
|
91
|
+
win32: '~/.vscode/mcp.json',
|
|
92
|
+
},
|
|
93
|
+
serversKey: 'servers',
|
|
94
|
+
configFormat: 'json',
|
|
95
|
+
transport: 'mcp-proxy-stdio',
|
|
96
|
+
},
|
|
97
|
+
steering: {
|
|
98
|
+
projectFilePath: '.github/copilot-instructions.md',
|
|
99
|
+
globalFilePath: null, // Copilot instructions are project-scoped only
|
|
100
|
+
contentFocus: 'full',
|
|
101
|
+
},
|
|
102
|
+
sortOrder: 3,
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
id: 'cursor',
|
|
106
|
+
name: 'Cursor',
|
|
107
|
+
description: 'AI-powered code editor',
|
|
108
|
+
detection: {
|
|
109
|
+
projectDirs: ['.cursor'],
|
|
110
|
+
binaries: ['cursor'],
|
|
111
|
+
globalDirs: {
|
|
112
|
+
darwin: '~/.cursor',
|
|
113
|
+
linux: '~/.cursor',
|
|
114
|
+
win32: '~/.cursor',
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
mcp: {
|
|
118
|
+
projectConfigPath: '.cursor/mcp.json',
|
|
119
|
+
globalConfigPath: {
|
|
120
|
+
darwin: '~/.cursor/mcp.json',
|
|
121
|
+
linux: '~/.cursor/mcp.json',
|
|
122
|
+
win32: '~/.cursor/mcp.json',
|
|
123
|
+
},
|
|
124
|
+
serversKey: 'mcpServers',
|
|
125
|
+
configFormat: 'json',
|
|
126
|
+
transport: 'mcp-proxy-stdio',
|
|
127
|
+
},
|
|
128
|
+
steering: {
|
|
129
|
+
projectFilePath: '.cursor/rules/memnexus.md',
|
|
130
|
+
globalFilePath: null, // Cursor rules are project-scoped only
|
|
131
|
+
contentFocus: 'full',
|
|
132
|
+
},
|
|
133
|
+
sortOrder: 4,
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
id: 'codex',
|
|
137
|
+
name: 'Codex CLI',
|
|
138
|
+
description: "OpenAI's CLI coding agent",
|
|
139
|
+
detection: {
|
|
140
|
+
projectDirs: ['.codex'],
|
|
141
|
+
binaries: ['codex'],
|
|
142
|
+
globalDirs: {
|
|
143
|
+
darwin: '~/.codex',
|
|
144
|
+
linux: '~/.codex',
|
|
145
|
+
win32: '~/.codex',
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
mcp: {
|
|
149
|
+
projectConfigPath: '.codex/config.toml',
|
|
150
|
+
globalConfigPath: {
|
|
151
|
+
darwin: '~/.codex/config.toml',
|
|
152
|
+
linux: '~/.codex/config.toml',
|
|
153
|
+
win32: '~/.codex/config.toml',
|
|
154
|
+
},
|
|
155
|
+
serversKey: 'mcpServers', // Not used for TOML
|
|
156
|
+
configFormat: 'toml',
|
|
157
|
+
transport: 'toml-env-var',
|
|
158
|
+
},
|
|
159
|
+
steering: {
|
|
160
|
+
projectFilePath: 'AGENTS.md',
|
|
161
|
+
globalFilePath: null, // AGENTS.md is project-scoped only
|
|
162
|
+
contentFocus: 'full',
|
|
163
|
+
},
|
|
164
|
+
sortOrder: 5,
|
|
165
|
+
},
|
|
166
|
+
];
|
|
167
|
+
/** Get an agent definition by ID. */
|
|
168
|
+
function getAgent(id) {
|
|
169
|
+
return exports.AGENTS.find((a) => a.id === id);
|
|
170
|
+
}
|
|
171
|
+
/** Get all agent IDs. */
|
|
172
|
+
function getAgentIds() {
|
|
173
|
+
return exports.AGENTS.map((a) => a.id);
|
|
174
|
+
}
|
|
175
|
+
/** Get agents sorted by sortOrder. */
|
|
176
|
+
function getSortedAgents() {
|
|
177
|
+
return [...exports.AGENTS].sort((a, b) => a.sortOrder - b.sortOrder);
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/lib/setup/registry.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAmKH,4BAEC;AAGD,kCAEC;AAGD,0CAEC;AA3KY,QAAA,MAAM,GAAsB;IACvC;QACE,EAAE,EAAE,aAAa;QACjB,IAAI,EAAE,aAAa;QACnB,WAAW,EAAE,8BAA8B;QAC3C,SAAS,EAAE;YACT,WAAW,EAAE,CAAC,SAAS,CAAC;YACxB,QAAQ,EAAE,CAAC,QAAQ,CAAC;YACpB,UAAU,EAAE;gBACV,MAAM,EAAE,WAAW;gBACnB,KAAK,EAAE,WAAW;gBAClB,KAAK,EAAE,WAAW;aACnB;SACF;QACD,GAAG,EAAE;YACH,iBAAiB,EAAE,kBAAkB;YACrC,gBAAgB,EAAE;gBAChB,MAAM,EAAE,oBAAoB;gB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,KAAK,EAAE,UAAU;gBACjB,KAAK,EAAE,UAAU;aAClB;SACF;QACD,GAAG,EAAE;YACH,iBAAiB,EAAE,oBAAoB;YACvC,gBAAgB,EAAE;gBAChB,MAAM,EAAE,sBAAsB;gBAC9B,KAAK,EAAE,sBAAsB;gBAC7B,KAAK,EAAE,sBAAsB;aAC9B;YACD,UAAU,EAAE,YAAY,EAAE,oBAAoB;YAC9C,YAAY,EAAE,MAAM;YACpB,SAAS,EAAE,cAAc;SAC1B;QACD,QAAQ,EAAE;YACR,eAAe,EAAE,WAAW;YAC5B,cAAc,EAAE,IAAI,EAAE,mCAAmC;YACzD,YAAY,EAAE,MAAM;SACrB;QACD,SAAS,EAAE,CAAC;KACb;CACF,CAAC;AAEF,qCAAqC;AACrC,SAAgB,QAAQ,CAAC,EAAU;IACjC,OAAO,cAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AACzC,CAAC;AAED,yBAAyB;AACzB,SAAgB,WAAW;IACzB,OAAO,cAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;AACjC,CAAC;AAED,sCAAsC;AACtC,SAAgB,eAAe;IAC7B,OAAO,CAAC,GAAG,cAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC;AAC/D,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Steering file content templates — MCP-first core rules shared across all
|
|
3
|
+
* agents, with an optional CLI appendix for agents that have terminal access.
|
|
4
|
+
*/
|
|
5
|
+
import type { SteeringContentFocus } from './types.js';
|
|
6
|
+
declare const BEGIN_MARKER = "<!-- BEGIN MEMNEXUS RULES (managed by mx setup \u2014 do not edit this section) -->";
|
|
7
|
+
declare const END_MARKER = "<!-- END MEMNEXUS RULES -->";
|
|
8
|
+
export { BEGIN_MARKER, END_MARKER };
|
|
9
|
+
/**
|
|
10
|
+
* Compose the full steering content for an agent, wrapped in section markers.
|
|
11
|
+
*/
|
|
12
|
+
export declare function composeRules(agentId: string, version: string, contentFocus: SteeringContentFocus): string;
|
|
13
|
+
/**
|
|
14
|
+
* Parse the version string from an existing steering file's markers.
|
|
15
|
+
* Returns null if no markers found or version can't be parsed.
|
|
16
|
+
*/
|
|
17
|
+
export declare function parseSteeringVersion(content: string): string | null;
|
|
18
|
+
//# sourceMappingURL=rules-templates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rules-templates.d.ts","sourceRoot":"","sources":["../../../src/lib/setup/rules-templates.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,QAAA,MAAM,YAAY,wFACgE,CAAC;AACnF,QAAA,MAAM,UAAU,gCAAgC,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC;AAsKpC;;GAEG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,oBAAoB,GACjC,MAAM,CAkBR;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGnE"}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Steering file content templates — MCP-first core rules shared across all
|
|
4
|
+
* agents, with an optional CLI appendix for agents that have terminal access.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.END_MARKER = exports.BEGIN_MARKER = void 0;
|
|
8
|
+
exports.composeRules = composeRules;
|
|
9
|
+
exports.parseSteeringVersion = parseSteeringVersion;
|
|
10
|
+
const BEGIN_MARKER = '<!-- BEGIN MEMNEXUS RULES (managed by mx setup — do not edit this section) -->';
|
|
11
|
+
exports.BEGIN_MARKER = BEGIN_MARKER;
|
|
12
|
+
const END_MARKER = '<!-- END MEMNEXUS RULES -->';
|
|
13
|
+
exports.END_MARKER = END_MARKER;
|
|
14
|
+
// ── MCP Core Rules (shared by ALL agents) ────────────────────────
|
|
15
|
+
function getMcpCoreRules() {
|
|
16
|
+
return `# MemNexus Memory Management
|
|
17
|
+
|
|
18
|
+
MemNexus gives you persistent memory across sessions via MCP tools. Save important context, search past work, and build on previous decisions.
|
|
19
|
+
|
|
20
|
+
## When to Save Memories
|
|
21
|
+
|
|
22
|
+
Save a memory after:
|
|
23
|
+
- Completing significant milestones (features, bug fixes, architectural changes)
|
|
24
|
+
- Making important technical decisions (why an approach was chosen)
|
|
25
|
+
- Resolving complex bugs (root cause, solution, lessons learned)
|
|
26
|
+
- Discovering patterns or gotchas (reusable knowledge)
|
|
27
|
+
- Before switching tasks (current progress, next steps, blockers)
|
|
28
|
+
|
|
29
|
+
## MCP Tools Quick Reference
|
|
30
|
+
|
|
31
|
+
### Save & Update
|
|
32
|
+
| Tool | Purpose |
|
|
33
|
+
|------|---------|
|
|
34
|
+
| \`create_memory\` | Save a new memory with content, optional topics, and conversationId |
|
|
35
|
+
| \`manage_memory\` | Update content/topics of an existing memory, or delete by ID |
|
|
36
|
+
|
|
37
|
+
### Search & Retrieve
|
|
38
|
+
| Tool | Purpose |
|
|
39
|
+
|------|---------|
|
|
40
|
+
| \`search_memories\` | Search by query (semantic), filter by topics/time, or list recent memories |
|
|
41
|
+
| \`get_memory\` | Retrieve full memory by ID or by named key (includes relationships/context) |
|
|
42
|
+
| \`recall\` | AI-synthesized digest of a topic — structured, narrative, timeline, or status-report |
|
|
43
|
+
| \`conversations\` | List conversations, or get a summary/timeline for a specific conversation |
|
|
44
|
+
|
|
45
|
+
### Explore & Analyze
|
|
46
|
+
| Tool | Purpose |
|
|
47
|
+
|------|---------|
|
|
48
|
+
| \`knowledge_graph\` | Explore extracted facts (\`type: "facts"\`), browse/search topics (\`type: "topics"\`), or discover related topics (\`type: "related_topics"\`) |
|
|
49
|
+
| \`patterns\` | Detect behavioral patterns (\`action: "detect"\`), analyze trends (\`action: "analyze"\`), or list stored patterns (\`action: "list"\`) |
|
|
50
|
+
|
|
51
|
+
### Account
|
|
52
|
+
| Tool | Purpose |
|
|
53
|
+
|------|---------|
|
|
54
|
+
| \`get_user_profile\` | Check plan, quota, usage stats — the ONLY way to get account info |
|
|
55
|
+
|
|
56
|
+
## Conversation Tracking (Critical)
|
|
57
|
+
|
|
58
|
+
Group related memories into conversations to maintain context:
|
|
59
|
+
|
|
60
|
+
1. **First memory of a new task** — set \`conversationId\` to \`"NEW"\`
|
|
61
|
+
2. **Parse the response** — it returns the new conversation ID (e.g., \`conv_abc123\`)
|
|
62
|
+
3. **Store that ID** — use it for all subsequent memories in this task
|
|
63
|
+
4. **Subsequent memories** — set \`conversationId\` to \`"conv_abc123"\`
|
|
64
|
+
5. **New topic/task** — use \`"NEW"\` again to start a fresh conversation
|
|
65
|
+
|
|
66
|
+
Example flow:
|
|
67
|
+
\`\`\`
|
|
68
|
+
create_memory({ conversationId: "NEW", content: "Starting work on auth refactor..." })
|
|
69
|
+
→ response includes conversationId: "conv_abc123"
|
|
70
|
+
|
|
71
|
+
create_memory({ conversationId: "conv_abc123", content: "Switched to JWT tokens..." })
|
|
72
|
+
|
|
73
|
+
create_memory({ conversationId: "conv_abc123", content: "Auth refactor complete..." })
|
|
74
|
+
\`\`\`
|
|
75
|
+
|
|
76
|
+
## Search & Retrieval Strategies
|
|
77
|
+
|
|
78
|
+
- **\`search_memories\`** — primary search tool. Supports \`query\` for semantic search, \`topics\`/\`excludeTopics\` for filtering, \`recent\` for time-limiting (e.g. \`"24h"\`, \`"7d"\`). Omit \`query\` to list recent memories.
|
|
79
|
+
- **\`recall\`** — AI-synthesized digest. Use for "give me an overview of X" or "get me up to speed on Y". Set \`format\` to \`"structured"\`, \`"narrative"\`, \`"timeline"\`, or \`"status-report"\`.
|
|
80
|
+
- **\`conversations\`** — list work sessions with \`recent\` filter, or get a \`"summary"\`/\`"timeline"\` view for a specific conversation.
|
|
81
|
+
- **\`knowledge_graph\`** — explore extracted knowledge:
|
|
82
|
+
- \`type: "facts"\` + \`query\` — search structured facts extracted from memories
|
|
83
|
+
- \`type: "topics"\` — list all topics, or search with \`query\`
|
|
84
|
+
- \`type: "related_topics"\` + \`topicId\` — discover connected topics
|
|
85
|
+
- **\`patterns\`** — behavioral analysis:
|
|
86
|
+
- \`action: "detect"\` — find new patterns in your memories
|
|
87
|
+
- \`action: "analyze"\` — AI-generated insights and recommendations
|
|
88
|
+
- \`action: "list"\` — view stored patterns
|
|
89
|
+
|
|
90
|
+
## Topic Conventions
|
|
91
|
+
|
|
92
|
+
Topics are auto-extracted from content. Only add manual \`topics\` for:
|
|
93
|
+
- **Status**: \`completed\`, \`in-progress\`, \`blocked\`, \`needs-review\`
|
|
94
|
+
- **Component**: project-specific component names (e.g. \`mx-cli\`, \`mx-core-api\`)
|
|
95
|
+
|
|
96
|
+
Example: \`topics: ["mx-core-api", "completed"]\`
|
|
97
|
+
|
|
98
|
+
Do NOT manually tag things like \`debugging\`, \`authentication\`, \`api-development\` — the extraction pipeline handles these automatically from well-written content.
|
|
99
|
+
|
|
100
|
+
## Best Practices
|
|
101
|
+
|
|
102
|
+
- **Search before asking** — use \`search_memories\` to check for existing context before starting new work
|
|
103
|
+
- **Use \`get_user_profile\` for account info** — never search memories for plan/quota details
|
|
104
|
+
- **Use \`recall\` for overviews, \`search_memories\` for specific results** — recall synthesizes, search returns raw matches
|
|
105
|
+
- **Use named memories for living documents** — pass \`name\` param (e.g. \`"project-status"\`) for memories you update regularly
|
|
106
|
+
- **Include references** — mention issue numbers, commit hashes, file paths in content
|
|
107
|
+
- **Write for others** — assume future readers are unfamiliar with the work`;
|
|
108
|
+
}
|
|
109
|
+
// ── CLI Appendix (only for agents with terminal access) ──────────
|
|
110
|
+
function getCliSection() {
|
|
111
|
+
return `
|
|
112
|
+
|
|
113
|
+
## CLI Workflows (Terminal)
|
|
114
|
+
|
|
115
|
+
The \`mx\` CLI provides additional workflows beyond MCP tools:
|
|
116
|
+
|
|
117
|
+
| Workflow | Command |
|
|
118
|
+
|----------|---------|
|
|
119
|
+
| Recent work recap | \`mx memories recap --recent 24h\` |
|
|
120
|
+
| AI digest of topic | \`mx memories digest --query "..." --digest-format structured\` |
|
|
121
|
+
| Timeline search | \`mx memories search --query "..." --timeline\` |
|
|
122
|
+
| Grouped by session | \`mx memories search --query "..." --group-by conversation\` |
|
|
123
|
+
| Full CLI help | \`mx agent-help\` |
|
|
124
|
+
|
|
125
|
+
Run \`mx agent-help\` for full AI-optimized documentation of all commands.`;
|
|
126
|
+
}
|
|
127
|
+
// ── Agent-Specific Additions ─────────────────────────────────────
|
|
128
|
+
const AGENT_RULES = {
|
|
129
|
+
'claude-code': `
|
|
130
|
+
|
|
131
|
+
## Claude Code Tips
|
|
132
|
+
|
|
133
|
+
- MCP tools are your primary interface — use them directly for all memory operations
|
|
134
|
+
- Use the terminal to run \`mx\` CLI commands for additional workflows (recaps, digests, timelines)
|
|
135
|
+
- Run \`mx agent-help\` in the terminal for full CLI documentation`,
|
|
136
|
+
cursor: `
|
|
137
|
+
|
|
138
|
+
## Cursor Tips
|
|
139
|
+
|
|
140
|
+
- MCP tools are available in Composer — use them for all memory operations
|
|
141
|
+
- Use the terminal to run \`mx\` CLI commands for additional workflows (recaps, digests, timelines)
|
|
142
|
+
- Run \`mx agent-help\` in the terminal for full CLI documentation`,
|
|
143
|
+
copilot: `
|
|
144
|
+
|
|
145
|
+
## Copilot Tips
|
|
146
|
+
|
|
147
|
+
- MCP tools are available in Copilot Chat for all memory operations
|
|
148
|
+
- Use the terminal to run \`mx\` CLI commands for additional workflows (recaps, digests, timelines)
|
|
149
|
+
- Run \`mx agent-help\` in the terminal for full CLI documentation`,
|
|
150
|
+
codex: `
|
|
151
|
+
|
|
152
|
+
## Codex CLI Tips
|
|
153
|
+
|
|
154
|
+
- MCP tools are your primary interface — use them for all memory operations
|
|
155
|
+
- Use shell execution for \`mx\` CLI workflows (recaps, digests, timelines)
|
|
156
|
+
- Run \`mx agent-help\` for full CLI documentation`,
|
|
157
|
+
'claude-desktop': `
|
|
158
|
+
|
|
159
|
+
## Claude Desktop Tips
|
|
160
|
+
|
|
161
|
+
- All memory operations use MCP tools — no CLI access needed
|
|
162
|
+
- Use \`create_memory\` to save and \`search_memories\` or \`recall\` to find past context
|
|
163
|
+
- Use \`knowledge_graph\` to explore extracted facts and topic relationships
|
|
164
|
+
- Use \`get_user_profile\` to check your account status and quota`,
|
|
165
|
+
};
|
|
166
|
+
// ── Composition ──────────────────────────────────────────────────
|
|
167
|
+
/**
|
|
168
|
+
* Compose the full steering content for an agent, wrapped in section markers.
|
|
169
|
+
*/
|
|
170
|
+
function composeRules(agentId, version, contentFocus) {
|
|
171
|
+
const core = getMcpCoreRules();
|
|
172
|
+
const cli = contentFocus === 'full' ? getCliSection() : '';
|
|
173
|
+
const agentSpecific = AGENT_RULES[agentId] || '';
|
|
174
|
+
const lines = [
|
|
175
|
+
BEGIN_MARKER,
|
|
176
|
+
`<!-- version: ${version} | agent: ${agentId} -->`,
|
|
177
|
+
'',
|
|
178
|
+
core,
|
|
179
|
+
cli,
|
|
180
|
+
agentSpecific,
|
|
181
|
+
'',
|
|
182
|
+
END_MARKER,
|
|
183
|
+
'',
|
|
184
|
+
];
|
|
185
|
+
return lines.join('\n');
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Parse the version string from an existing steering file's markers.
|
|
189
|
+
* Returns null if no markers found or version can't be parsed.
|
|
190
|
+
*/
|
|
191
|
+
function parseSteeringVersion(content) {
|
|
192
|
+
const match = content.match(/<!-- version: ([^\s|]+)/);
|
|
193
|
+
return match ? match[1] : null;
|
|
194
|
+
}
|
|
195
|
+
//# sourceMappingURL=rules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