@memnexus-ai/cli 1.7.41 → 1.7.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/commands/auth.d.ts.map +1 -1
  2. package/dist/commands/auth.js +24 -0
  3. package/dist/commands/auth.js.map +1 -1
  4. package/dist/commands/memories.d.ts.map +1 -1
  5. package/dist/commands/memories.js +20 -2
  6. package/dist/commands/memories.js.map +1 -1
  7. package/dist/commands/setup.d.ts +6 -0
  8. package/dist/commands/setup.d.ts.map +1 -0
  9. package/dist/commands/setup.js +406 -0
  10. package/dist/commands/setup.js.map +1 -0
  11. package/dist/index.js +21 -2
  12. package/dist/index.js.map +1 -1
  13. package/dist/lib/agent-help.d.ts.map +1 -1
  14. package/dist/lib/agent-help.js +42 -0
  15. package/dist/lib/agent-help.js.map +1 -1
  16. package/dist/lib/auth.d.ts.map +1 -1
  17. package/dist/lib/auth.js +0 -1
  18. package/dist/lib/auth.js.map +1 -1
  19. package/dist/lib/config.d.ts +6 -0
  20. package/dist/lib/config.d.ts.map +1 -1
  21. package/dist/lib/config.js +13 -0
  22. package/dist/lib/config.js.map +1 -1
  23. package/dist/lib/setup/config-writer.d.ts +37 -0
  24. package/dist/lib/setup/config-writer.d.ts.map +1 -0
  25. package/dist/lib/setup/config-writer.js +186 -0
  26. package/dist/lib/setup/config-writer.js.map +1 -0
  27. package/dist/lib/setup/detector.d.ts +13 -0
  28. package/dist/lib/setup/detector.d.ts.map +1 -0
  29. package/dist/lib/setup/detector.js +163 -0
  30. package/dist/lib/setup/detector.js.map +1 -0
  31. package/dist/lib/setup/index.d.ts +9 -0
  32. package/dist/lib/setup/index.d.ts.map +1 -0
  33. package/dist/lib/setup/index.js +33 -0
  34. package/dist/lib/setup/index.js.map +1 -0
  35. package/dist/lib/setup/proxy.d.ts +28 -0
  36. package/dist/lib/setup/proxy.d.ts.map +1 -0
  37. package/dist/lib/setup/proxy.js +201 -0
  38. package/dist/lib/setup/proxy.js.map +1 -0
  39. package/dist/lib/setup/registry.d.ts +12 -0
  40. package/dist/lib/setup/registry.d.ts.map +1 -0
  41. package/dist/lib/setup/registry.js +179 -0
  42. package/dist/lib/setup/registry.js.map +1 -0
  43. package/dist/lib/setup/rules-templates.d.ts +18 -0
  44. package/dist/lib/setup/rules-templates.d.ts.map +1 -0
  45. package/dist/lib/setup/rules-templates.js +184 -0
  46. package/dist/lib/setup/rules-templates.js.map +1 -0
  47. package/dist/lib/setup/rules-writer.d.ts +40 -0
  48. package/dist/lib/setup/rules-writer.d.ts.map +1 -0
  49. package/dist/lib/setup/rules-writer.js +126 -0
  50. package/dist/lib/setup/rules-writer.js.map +1 -0
  51. package/dist/lib/setup/types.d.ts +120 -0
  52. package/dist/lib/setup/types.d.ts.map +1 -0
  53. package/dist/lib/setup/types.js +6 -0
  54. package/dist/lib/setup/types.js.map +1 -0
  55. package/dist/lib/setup/verifier.d.ts +13 -0
  56. package/dist/lib/setup/verifier.d.ts.map +1 -0
  57. package/dist/lib/setup/verifier.js +199 -0
  58. package/dist/lib/setup/verifier.js.map +1 -0
  59. package/package.json +4 -4
@@ -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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C;YAAS,CAAC;QACT,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;gBAC5B,KAAK,EAAE,oBAAoB;gBAC3B,KAAK,EAAE,oBAAoB;aAC5B;YACD,UAAU,EAAE,YAAY;YACxB,YAAY,EAAE,MAAM;YACpB,SAAS,EAAE,iBAAiB;SAC7B;QACD,QAAQ,EAAE;YACR,eAAe,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AsB;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 — core rules shared across all agents
3
+ * plus agent-specific additions.
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;AA6JpC;;GAEG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,oBAAoB,GACjC,MAAM,CAgBR;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGnE"}
@@ -0,0 +1,184 @@
1
+ "use strict";
2
+ /**
3
+ * Steering file content templates — core rules shared across all agents
4
+ * plus agent-specific additions.
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
+ // ── Core Rules (shared across all agents with CLI access) ────────
15
+ function getCoreRules() {
16
+ return `# MemNexus Memory Management
17
+
18
+ MemNexus gives you persistent memory across sessions. 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
+ ## Quick Reference
30
+
31
+ | Task | Command |
32
+ |------|---------|
33
+ | Create memory | \`mx memories create --content "..." --conversation-id "NEW"\` |
34
+ | Search memories | \`mx memories search --query "..."\` |
35
+ | Recent work recap | \`mx memories recap --recent 24h\` |
36
+ | AI digest of topic | \`mx memories digest --query "..." --digest-format structured\` |
37
+ | Get memory details | \`mx memories get <id>\` |
38
+ | Timeline view | \`mx memories search --query "..." --timeline\` |
39
+ | Check account/quota | \`mx auth status\` |
40
+
41
+ ## Conversation Tracking
42
+
43
+ Group related memories into conversations:
44
+
45
+ 1. First memory of a new task: \`--conversation-id "NEW"\`
46
+ 2. Parse output for the returned conversation ID (e.g., \`conv_abc123\`)
47
+ 3. Subsequent related memories: \`--conversation-id "conv_abc123"\`
48
+ 4. New topic/task: use \`"NEW"\` again
49
+
50
+ ## Search Strategies
51
+
52
+ - **\`mx memories search\`** — keyword/vector search. Use \`--timeline\` for chronological, \`--recent 24h\` for time-limited.
53
+ - **\`mx memories recap\`** — raw content grouped by conversation. Fast. Use for "what did I work on?"
54
+ - **\`mx memories digest\`** — AI-synthesized summary. Slower. Use for "give me an overview of X."
55
+ - **\`mx memories search --mode facts\`** — search extracted structured knowledge only.
56
+ - **\`mx memories search --group-by conversation\`** — results organized by work session.
57
+
58
+ ## Topic Conventions
59
+
60
+ Topics are auto-extracted from content. Only add manual \`--topics\` for:
61
+ - **Status**: \`completed\`, \`in-progress\`, \`blocked\`
62
+ - **Component**: \`mx-cli\`, \`mx-core-api\`, etc.
63
+
64
+ Example: \`--topics "mx-core-api,completed"\`
65
+
66
+ ## Best Practices
67
+
68
+ - **Search before asking** — check memories for existing context before starting new work
69
+ - **Use \`--content\` flag** — always use non-interactive mode for automation compatibility
70
+ - **Never run mx in background** — all commands complete in <1 second
71
+ - **Include references** — mention issue numbers, commit hashes, file paths in content
72
+ - **Write for others** — assume future readers are unfamiliar with the work
73
+ - **Use \`mx auth status\` for account info** — do NOT search memories for plan/quota details`;
74
+ }
75
+ // ── MCP-Only Rules (for agents without CLI access) ───────────────
76
+ function getMcpOnlyRules() {
77
+ return `# MemNexus Memory Management
78
+
79
+ MemNexus gives you persistent memory across sessions via MCP tools. Save important context, search past work, and build on previous decisions.
80
+
81
+ ## When to Save Memories
82
+
83
+ Save a memory after:
84
+ - Completing significant milestones (features, bug fixes, architectural changes)
85
+ - Making important technical decisions (why an approach was chosen)
86
+ - Resolving complex bugs (root cause, solution, lessons learned)
87
+ - Before switching tasks (current progress, next steps, blockers)
88
+
89
+ ## MCP Tools Reference
90
+
91
+ | Tool | Purpose |
92
+ |------|---------|
93
+ | \`create_memory\` | Save a new memory with content and optional topics |
94
+ | \`search_memories\` | Search by query, filter by topics or time |
95
+ | \`recall\` | Get an AI-synthesized digest of a topic |
96
+ | \`get_memory\` | Retrieve a specific memory by ID |
97
+ | \`manage_memory\` | Update or delete a memory |
98
+ | \`conversations\` | List or summarize conversations |
99
+ | \`knowledge_graph\` | Explore extracted facts and topics |
100
+ | \`get_user_profile\` | Check account, plan, and quota |
101
+
102
+ ## Conversation Tracking
103
+
104
+ Group related memories into conversations:
105
+ - First memory: set \`conversationId\` to \`"NEW"\`
106
+ - Follow-ups: reuse the returned conversation ID
107
+ - New topic: use \`"NEW"\` again
108
+
109
+ ## Topic Conventions
110
+
111
+ Topics are auto-extracted from content. Only add manual topics for:
112
+ - **Status**: \`completed\`, \`in-progress\`, \`blocked\`
113
+ - **Component**: project-specific component names
114
+
115
+ ## Best Practices
116
+
117
+ - **Search before asking** — use \`search_memories\` to check for existing context
118
+ - **Be specific in content** — mention issue numbers, file paths, version numbers
119
+ - **Use \`get_user_profile\` for account info** — do NOT search memories for plan/quota details
120
+ - **Write for others** — assume future readers are unfamiliar with the work`;
121
+ }
122
+ // ── Agent-Specific Additions ─────────────────────────────────────
123
+ const AGENT_RULES = {
124
+ 'claude-code': `
125
+ ## Claude Code Tips
126
+
127
+ - Use \`/mx-save\` for quick progress snapshots after completing tasks
128
+ - Use \`/mx-checkpoint\` for comprehensive project-level memories
129
+ - Run \`mx agent-help\` for full AI-optimized CLI documentation
130
+ - Run \`mx agent-help memories\` for memory-specific workflows`,
131
+ cursor: `
132
+ ## Cursor Tips
133
+
134
+ - MCP tools are available in Composer — reference them with @memnexus
135
+ - Use the terminal tool to run \`mx\` CLI commands for richer workflows
136
+ - Run \`mx agent-help\` in the terminal for full CLI documentation`,
137
+ copilot: `
138
+ ## Copilot Tips
139
+
140
+ - MCP tools are available in Copilot Chat for searching and creating memories
141
+ - Use the terminal to run \`mx\` CLI commands for richer workflows (digests, recaps, timeline)
142
+ - Run \`mx agent-help\` in the terminal for full CLI documentation`,
143
+ codex: `
144
+ ## Codex CLI Tips
145
+
146
+ - Run \`mx\` CLI commands via shell execution for richer workflows
147
+ - Use \`mx memories recap --recent 24h\` to get context at session start
148
+ - Run \`mx agent-help\` for full CLI documentation`,
149
+ 'claude-desktop': `
150
+ ## Claude Desktop Tips
151
+
152
+ - All memory operations use MCP tools — no CLI access needed
153
+ - Use \`create_memory\` to save important context from conversations
154
+ - Use \`search_memories\` or \`recall\` to find past context
155
+ - Use \`get_user_profile\` to check your account status and quota`,
156
+ };
157
+ // ── Composition ──────────────────────────────────────────────────
158
+ /**
159
+ * Compose the full steering content for an agent, wrapped in section markers.
160
+ */
161
+ function composeRules(agentId, version, contentFocus) {
162
+ const core = contentFocus === 'mcp-only' ? getMcpOnlyRules() : getCoreRules();
163
+ const agentSpecific = AGENT_RULES[agentId] || '';
164
+ const lines = [
165
+ BEGIN_MARKER,
166
+ `<!-- version: ${version} | agent: ${agentId} -->`,
167
+ '',
168
+ core,
169
+ agentSpecific,
170
+ '',
171
+ END_MARKER,
172
+ '',
173
+ ];
174
+ return lines.join('\n');
175
+ }
176
+ /**
177
+ * Parse the version string from an existing steering file's markers.
178
+ * Returns null if no markers found or version can't be parsed.
179
+ */
180
+ function parseSteeringVersion(content) {
181
+ const match = content.match(/<!-- version: ([^\s|]+)/);
182
+ return match ? match[1] : null;
183
+ }
184
+ //# sourceMappingURL=rules-templates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rules-templates.js","sourceRoot":"","sources":["../../../src/lib/setup/rules-templates.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAwKH,oCAoBC;AAMD,oDAGC;AAjMD,MAAM,YAAY,GAChB,gFAAgF,CAAC;AAG1E,oCAAY;AAFrB,MAAM,UAAU,GAAG,6BAA6B,CAAC;AAE1B,gCAAU;AAEjC,oEAAoE;AAEpE,SAAS,YAAY;IACnB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8FAyDqF,CAAC;AAC/F,CAAC;AAED,oEAAoE;AAEpE,SAAS,eAAe;IACtB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4EA2CmE,CAAC;AAC7E,CAAC;AAED,oEAAoE;AAEpE,MAAM,WAAW,GAA2B;IAC1C,aAAa,EAAE;;;;;;+DAM8C;IAE7D,MAAM,EAAE;;;;;mEAKyD;IAEjE,OAAO,EAAE;;;;;mEAKwD;IAEjE,KAAK,EAAE;;;;;mDAK0C;IAEjD,gBAAgB,EAAE;;;;;;kEAM8C;CACjE,CAAC;AAEF,oEAAoE;AAEpE;;GAEG;AACH,SAAgB,YAAY,CAC1B,OAAe,EACf,OAAe,EACf,YAAkC;IAElC,MAAM,IAAI,GAAG,YAAY,KAAK,UAAU,CAAC,CAAC,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC;IAC9E,MAAM,aAAa,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;IAEjD,MAAM,KAAK,GAAG;QACZ,YAAY;QACZ,iBAAiB,OAAO,aAAa,OAAO,MAAM;QAClD,EAAE;QACF,IAAI;QACJ,aAAa;QACb,EAAE;QACF,UAAU;QACV,EAAE;KACH,CAAC;IAEF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED;;;GAGG;AACH,SAAgB,oBAAoB,CAAC,OAAe;IAClD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;IACvD,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACjC,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Steering file writer — reads, merges, and writes agent instruction files
3
+ * using section markers for non-destructive updates.
4
+ */
5
+ import type { AgentDefinition, Scope, SteeringWriteResult } from './types.js';
6
+ /**
7
+ * Resolve the steering file path for a given agent, scope, and platform.
8
+ * Returns null if the agent has no steering config or the scope is unsupported.
9
+ */
10
+ export declare function resolveSteeringPath(agent: AgentDefinition, scope: Scope, projectDir?: string): string | null;
11
+ /**
12
+ * Write or update the steering file for an agent.
13
+ * Uses section markers for non-destructive merging with existing content.
14
+ */
15
+ export declare function writeSteeringFile(options: {
16
+ agent: AgentDefinition;
17
+ scope: Scope;
18
+ projectDir?: string;
19
+ dryRun?: boolean;
20
+ }): Promise<SteeringWriteResult | null>;
21
+ /**
22
+ * Remove the MemNexus steering section from an agent's instruction file.
23
+ * Preserves all content outside the section markers.
24
+ * Returns true if the section was found and removed.
25
+ */
26
+ export declare function removeSteeringSection(options: {
27
+ agent: AgentDefinition;
28
+ scope: Scope;
29
+ projectDir?: string;
30
+ }): Promise<boolean>;
31
+ /**
32
+ * Get the MemNexus rules version from an agent's steering file.
33
+ * Returns null if no steering file or no markers found.
34
+ */
35
+ export declare function getSteeringVersion(options: {
36
+ agent: AgentDefinition;
37
+ scope: Scope;
38
+ projectDir?: string;
39
+ }): Promise<string | null>;
40
+ //# sourceMappingURL=rules-writer.d.ts.map