@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,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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rules-writer.d.ts","sourceRoot":"","sources":["../../../src/lib/setup/rules-writer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAK9E;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,eAAe,EACtB,KAAK,EAAE,KAAK,EACZ,UAAU,CAAC,EAAE,MAAM,GAClB,MAAM,GAAG,IAAI,CAgBf;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE;IAC/C,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,EAAE,KAAK,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAgDtC;AAED;;;;GAIG;AACH,wBAAsB,qBAAqB,CAAC,OAAO,EAAE;IACnD,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,EAAE,KAAK,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,OAAO,CAAC,OAAO,CAAC,CAuBnB;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE;IAChD,KAAK,EAAE,eAAe,CAAC;IACvB,KAAK,EAAE,KAAK,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAQzB"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Steering file writer — reads, merges, and writes agent instruction files
|
|
4
|
+
* using section markers for non-destructive updates.
|
|
5
|
+
*/
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.resolveSteeringPath = resolveSteeringPath;
|
|
11
|
+
exports.writeSteeringFile = writeSteeringFile;
|
|
12
|
+
exports.removeSteeringSection = removeSteeringSection;
|
|
13
|
+
exports.getSteeringVersion = getSteeringVersion;
|
|
14
|
+
const node_fs_1 = require("node:fs");
|
|
15
|
+
const promises_1 = require("node:fs/promises");
|
|
16
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
17
|
+
const detector_js_1 = require("./detector.js");
|
|
18
|
+
const rules_templates_js_1 = require("./rules-templates.js");
|
|
19
|
+
const package_json_1 = __importDefault(require("../../../package.json"));
|
|
20
|
+
/**
|
|
21
|
+
* Resolve the steering file path for a given agent, scope, and platform.
|
|
22
|
+
* Returns null if the agent has no steering config or the scope is unsupported.
|
|
23
|
+
*/
|
|
24
|
+
function resolveSteeringPath(agent, scope, projectDir) {
|
|
25
|
+
if (!agent.steering)
|
|
26
|
+
return null;
|
|
27
|
+
const platform = process.platform;
|
|
28
|
+
if (scope === 'project') {
|
|
29
|
+
if (!projectDir)
|
|
30
|
+
return null;
|
|
31
|
+
if (!agent.steering.projectFilePath)
|
|
32
|
+
return null;
|
|
33
|
+
return node_path_1.default.join(projectDir, agent.steering.projectFilePath);
|
|
34
|
+
}
|
|
35
|
+
// Global scope
|
|
36
|
+
if (!agent.steering.globalFilePath)
|
|
37
|
+
return null;
|
|
38
|
+
const globalPath = agent.steering.globalFilePath[platform];
|
|
39
|
+
if (!globalPath)
|
|
40
|
+
return null;
|
|
41
|
+
return (0, detector_js_1.resolvePath)(globalPath);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Write or update the steering file for an agent.
|
|
45
|
+
* Uses section markers for non-destructive merging with existing content.
|
|
46
|
+
*/
|
|
47
|
+
async function writeSteeringFile(options) {
|
|
48
|
+
const { agent, scope, projectDir, dryRun } = options;
|
|
49
|
+
const filePath = resolveSteeringPath(agent, scope, projectDir);
|
|
50
|
+
if (!filePath)
|
|
51
|
+
return null;
|
|
52
|
+
const contentFocus = agent.steering?.contentFocus ?? 'full';
|
|
53
|
+
const rulesContent = (0, rules_templates_js_1.composeRules)(agent.id, package_json_1.default.version, contentFocus);
|
|
54
|
+
let backupPath;
|
|
55
|
+
let action = 'created';
|
|
56
|
+
let finalContent;
|
|
57
|
+
if ((0, node_fs_1.existsSync)(filePath)) {
|
|
58
|
+
action = 'updated';
|
|
59
|
+
const existing = await (0, promises_1.readFile)(filePath, 'utf-8');
|
|
60
|
+
// Check if markers already exist — replace section in-place
|
|
61
|
+
const beginIdx = existing.indexOf(rules_templates_js_1.BEGIN_MARKER);
|
|
62
|
+
const endIdx = existing.indexOf(rules_templates_js_1.END_MARKER);
|
|
63
|
+
if (beginIdx !== -1 && endIdx !== -1 && endIdx > beginIdx) {
|
|
64
|
+
// Replace existing section
|
|
65
|
+
const before = existing.slice(0, beginIdx);
|
|
66
|
+
const after = existing.slice(endIdx + rules_templates_js_1.END_MARKER.length);
|
|
67
|
+
finalContent = before + rulesContent + after;
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
// Append section at end
|
|
71
|
+
const separator = existing.endsWith('\n') ? '\n' : '\n\n';
|
|
72
|
+
finalContent = existing + separator + rulesContent;
|
|
73
|
+
}
|
|
74
|
+
// Backup before modifying
|
|
75
|
+
if (!dryRun) {
|
|
76
|
+
backupPath = filePath + '.bak';
|
|
77
|
+
await (0, promises_1.copyFile)(filePath, backupPath);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
// New file — just the rules content
|
|
82
|
+
finalContent = rulesContent;
|
|
83
|
+
}
|
|
84
|
+
if (!dryRun) {
|
|
85
|
+
await (0, promises_1.mkdir)(node_path_1.default.dirname(filePath), { recursive: true });
|
|
86
|
+
await (0, promises_1.writeFile)(filePath, finalContent, 'utf-8');
|
|
87
|
+
}
|
|
88
|
+
return { filePath, backupPath, content: finalContent, action };
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Remove the MemNexus steering section from an agent's instruction file.
|
|
92
|
+
* Preserves all content outside the section markers.
|
|
93
|
+
* Returns true if the section was found and removed.
|
|
94
|
+
*/
|
|
95
|
+
async function removeSteeringSection(options) {
|
|
96
|
+
const { agent, scope, projectDir } = options;
|
|
97
|
+
const filePath = resolveSteeringPath(agent, scope, projectDir);
|
|
98
|
+
if (!filePath || !(0, node_fs_1.existsSync)(filePath))
|
|
99
|
+
return false;
|
|
100
|
+
const existing = await (0, promises_1.readFile)(filePath, 'utf-8');
|
|
101
|
+
const beginIdx = existing.indexOf(rules_templates_js_1.BEGIN_MARKER);
|
|
102
|
+
const endIdx = existing.indexOf(rules_templates_js_1.END_MARKER);
|
|
103
|
+
if (beginIdx === -1 || endIdx === -1 || endIdx <= beginIdx)
|
|
104
|
+
return false;
|
|
105
|
+
const before = existing.slice(0, beginIdx);
|
|
106
|
+
const after = existing.slice(endIdx + rules_templates_js_1.END_MARKER.length);
|
|
107
|
+
// Clean up: remove trailing newlines at the splice point
|
|
108
|
+
const cleaned = (before.trimEnd() + after).trimEnd() + '\n';
|
|
109
|
+
// If only whitespace remains, delete the file content but keep the file
|
|
110
|
+
const finalContent = cleaned.trim() ? cleaned : '';
|
|
111
|
+
await (0, promises_1.writeFile)(filePath, finalContent, 'utf-8');
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Get the MemNexus rules version from an agent's steering file.
|
|
116
|
+
* Returns null if no steering file or no markers found.
|
|
117
|
+
*/
|
|
118
|
+
async function getSteeringVersion(options) {
|
|
119
|
+
const { agent, scope, projectDir } = options;
|
|
120
|
+
const filePath = resolveSteeringPath(agent, scope, projectDir);
|
|
121
|
+
if (!filePath || !(0, node_fs_1.existsSync)(filePath))
|
|
122
|
+
return null;
|
|
123
|
+
const content = await (0, promises_1.readFile)(filePath, 'utf-8');
|
|
124
|
+
return (0, rules_templates_js_1.parseSteeringVersion)(content);
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=rules-writer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rules-writer.js","sourceRoot":"","sources":["../../../src/lib/setup/rules-writer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;AAcH,kDAoBC;AAMD,8CAqDC;AAOD,sDA2BC;AAMD,gDAYC;AA/ID,qCAAqC;AACrC,+CAAwE;AACxE,0DAA6B;AAE7B,+CAA4C;AAC5C,6DAAoG;AACpG,yEAAgD;AAEhD;;;GAGG;AACH,SAAgB,mBAAmB,CACjC,KAAsB,EACtB,KAAY,EACZ,UAAmB;IAEnB,IAAI,CAAC,KAAK,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC;IAEjC,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAwC,CAAC;IAElE,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,IAAI,CAAC,UAAU;YAAE,OAAO,IAAI,CAAC;QAC7B,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,eAAe;YAAE,OAAO,IAAI,CAAC;QACjD,OAAO,mBAAI,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;IAC/D,CAAC;IAED,eAAe;IACf,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC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AAC;QAAE,OAAO,IAAI,CAAC;IAEpD,MAAM,OAAO,GAAG,MAAM,IAAA,mBAAQ,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAClD,OAAO,IAAA,yCAAoB,EAAC,OAAO,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for the mx setup command — MCP agent configuration.
|
|
3
|
+
*/
|
|
4
|
+
/** Supported operating systems. */
|
|
5
|
+
export type Platform = 'darwin' | 'linux' | 'win32';
|
|
6
|
+
/** Supported CPU architectures. */
|
|
7
|
+
export type Arch = 'x64' | 'arm64';
|
|
8
|
+
/** Transport strategy for an agent's MCP config. */
|
|
9
|
+
export type Transport = 'mcp-proxy-stdio' | 'toml-env-var';
|
|
10
|
+
/** Scope of the configuration (global user-level or project-level). */
|
|
11
|
+
export type Scope = 'global' | 'project';
|
|
12
|
+
/** JSON key used for MCP servers in the agent's config file. */
|
|
13
|
+
export type ServersKey = 'mcpServers' | 'servers';
|
|
14
|
+
/** Config file format. */
|
|
15
|
+
export type ConfigFormat = 'json' | 'toml';
|
|
16
|
+
/** Per-platform paths for global config files. */
|
|
17
|
+
export interface PlatformPaths {
|
|
18
|
+
darwin?: string;
|
|
19
|
+
linux?: string;
|
|
20
|
+
win32?: string;
|
|
21
|
+
}
|
|
22
|
+
/** Detection rules for finding an agent. */
|
|
23
|
+
export interface AgentDetection {
|
|
24
|
+
/** Directories to check in project root (e.g., ".claude/", ".vscode/"). */
|
|
25
|
+
projectDirs: string[];
|
|
26
|
+
/** Binaries to check in PATH. */
|
|
27
|
+
binaries: string[];
|
|
28
|
+
/** Global config directories per platform. */
|
|
29
|
+
globalDirs: PlatformPaths;
|
|
30
|
+
}
|
|
31
|
+
/** What kind of steering content to generate. */
|
|
32
|
+
export type SteeringContentFocus = 'full' | 'mcp-only';
|
|
33
|
+
/** Steering file configuration for an agent. */
|
|
34
|
+
export interface AgentSteeringConfig {
|
|
35
|
+
/** Steering file path relative to project root (for project scope). */
|
|
36
|
+
projectFilePath: string;
|
|
37
|
+
/** Global steering file path per platform (null if project-only). */
|
|
38
|
+
globalFilePath: PlatformPaths | null;
|
|
39
|
+
/** Whether to generate full CLI + MCP rules or MCP-only rules. */
|
|
40
|
+
contentFocus: SteeringContentFocus;
|
|
41
|
+
}
|
|
42
|
+
/** Result of writing a steering file. */
|
|
43
|
+
export interface SteeringWriteResult {
|
|
44
|
+
/** Path to the steering file that was written. */
|
|
45
|
+
filePath: string;
|
|
46
|
+
/** Backup path if existing file was modified. */
|
|
47
|
+
backupPath?: string;
|
|
48
|
+
/** The content that was written (or would be written in dry-run). */
|
|
49
|
+
content: string;
|
|
50
|
+
/** Whether the file was created new or an existing file was updated. */
|
|
51
|
+
action: 'created' | 'updated' | 'skipped';
|
|
52
|
+
}
|
|
53
|
+
/** MCP configuration details for an agent. */
|
|
54
|
+
export interface AgentMcpConfig {
|
|
55
|
+
/** Config file path relative to project root (for project scope). */
|
|
56
|
+
projectConfigPath: string;
|
|
57
|
+
/** Global config file path per platform (with ~ for home dir). */
|
|
58
|
+
globalConfigPath: PlatformPaths;
|
|
59
|
+
/** JSON key for the servers object. */
|
|
60
|
+
serversKey: ServersKey;
|
|
61
|
+
/** Config file format. */
|
|
62
|
+
configFormat: ConfigFormat;
|
|
63
|
+
/** Transport strategy. */
|
|
64
|
+
transport: Transport;
|
|
65
|
+
}
|
|
66
|
+
/** Complete definition of a supported agent. */
|
|
67
|
+
export interface AgentDefinition {
|
|
68
|
+
/** CLI identifier (e.g., "claude-code"). */
|
|
69
|
+
id: string;
|
|
70
|
+
/** Display name (e.g., "Claude Code"). */
|
|
71
|
+
name: string;
|
|
72
|
+
/** Short description. */
|
|
73
|
+
description: string;
|
|
74
|
+
/** Detection rules. */
|
|
75
|
+
detection: AgentDetection;
|
|
76
|
+
/** MCP configuration details. */
|
|
77
|
+
mcp: AgentMcpConfig;
|
|
78
|
+
/** Steering file configuration (null if no file-based steering, e.g., Claude Desktop). */
|
|
79
|
+
steering: AgentSteeringConfig | null;
|
|
80
|
+
/** Sort order in interactive menu. */
|
|
81
|
+
sortOrder: number;
|
|
82
|
+
}
|
|
83
|
+
/** Result of detecting agents on the system. */
|
|
84
|
+
export interface DetectedAgent {
|
|
85
|
+
agent: AgentDefinition;
|
|
86
|
+
/** Where the agent was found. */
|
|
87
|
+
detectedAt: 'project' | 'global' | 'both';
|
|
88
|
+
/** Existing MCP config file path (if config file already exists). */
|
|
89
|
+
existingConfigPath?: string;
|
|
90
|
+
/** Whether memnexus is already configured in the existing config. */
|
|
91
|
+
alreadyConfigured?: boolean;
|
|
92
|
+
}
|
|
93
|
+
/** Result of running setup for one agent. */
|
|
94
|
+
export interface SetupResult {
|
|
95
|
+
agentId: string;
|
|
96
|
+
agentName: string;
|
|
97
|
+
success: boolean;
|
|
98
|
+
configPath: string;
|
|
99
|
+
scope: Scope;
|
|
100
|
+
/** What was done. */
|
|
101
|
+
action: 'created' | 'updated' | 'skipped' | 'failed';
|
|
102
|
+
/** Error message if failed. */
|
|
103
|
+
error?: string;
|
|
104
|
+
/** Backup path if existing config was modified. */
|
|
105
|
+
backupPath?: string;
|
|
106
|
+
}
|
|
107
|
+
/** Verification check result. */
|
|
108
|
+
export interface VerifyCheck {
|
|
109
|
+
name: string;
|
|
110
|
+
passed: boolean;
|
|
111
|
+
message: string;
|
|
112
|
+
}
|
|
113
|
+
/** Full verification result for one agent. */
|
|
114
|
+
export interface VerifyResult {
|
|
115
|
+
agentId: string;
|
|
116
|
+
agentName: string;
|
|
117
|
+
checks: VerifyCheck[];
|
|
118
|
+
allPassed: boolean;
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/setup/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,mCAAmC;AACnC,MAAM,MAAM,QAAQ,GAAG,QAAQ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C,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,iCAAiC;AACjC,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,8CAA8C;AAC9C,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/lib/setup/types.ts"],"names":[],"mappings":";AAAA;;GAEG"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Setup verification — health checks for configured agents.
|
|
3
|
+
*/
|
|
4
|
+
import type { AgentDefinition, VerifyResult } from './types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Verify a single agent's setup.
|
|
7
|
+
*/
|
|
8
|
+
export declare function verifyAgent(agent: AgentDefinition): Promise<VerifyResult>;
|
|
9
|
+
/**
|
|
10
|
+
* Verify all configured agents.
|
|
11
|
+
*/
|
|
12
|
+
export declare function verifyAll(): Promise<VerifyResult[]>;
|
|
13
|
+
//# sourceMappingURL=verifier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verifier.d.ts","sourceRoot":"","sources":["../../../src/lib/setup/verifier.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAAE,eAAe,EAAyB,YAAY,EAAE,MAAM,YAAY,CAAC;AAUvF;;GAEG;AACH,wBAAsB,WAAW,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,YAAY,CAAC,CA8H/E;AAED;;GAEG;AACH,wBAAsB,SAAS,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,CAczD"}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Setup verification — health checks for configured agents.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.verifyAgent = verifyAgent;
|
|
43
|
+
exports.verifyAll = verifyAll;
|
|
44
|
+
const node_fs_1 = require("node:fs");
|
|
45
|
+
const node_child_process_1 = require("node:child_process");
|
|
46
|
+
const node_os_1 = __importDefault(require("node:os"));
|
|
47
|
+
const registry_js_1 = require("./registry.js");
|
|
48
|
+
const detector_js_1 = require("./detector.js");
|
|
49
|
+
const proxy_js_1 = require("./proxy.js");
|
|
50
|
+
const rules_writer_js_1 = require("./rules-writer.js");
|
|
51
|
+
const rules_templates_js_1 = require("./rules-templates.js");
|
|
52
|
+
const promises_1 = require("node:fs/promises");
|
|
53
|
+
const config_js_1 = require("../config.js");
|
|
54
|
+
const package_json_1 = __importDefault(require("../../../package.json"));
|
|
55
|
+
/**
|
|
56
|
+
* Verify a single agent's setup.
|
|
57
|
+
*/
|
|
58
|
+
async function verifyAgent(agent) {
|
|
59
|
+
const checks = [];
|
|
60
|
+
const platform = node_os_1.default.platform();
|
|
61
|
+
// 1. Check config file exists
|
|
62
|
+
const globalPath = agent.mcp.globalConfigPath[platform];
|
|
63
|
+
const configExists = globalPath !== undefined && (0, node_fs_1.existsSync)((0, detector_js_1.resolvePath)(globalPath));
|
|
64
|
+
checks.push({
|
|
65
|
+
name: 'Config file exists',
|
|
66
|
+
passed: configExists,
|
|
67
|
+
message: configExists
|
|
68
|
+
? `Found: ${globalPath}`
|
|
69
|
+
: `Not found: ${globalPath || '(no path for this platform)'}`,
|
|
70
|
+
});
|
|
71
|
+
// 2. Check proxy binary (for mcp-proxy-stdio agents)
|
|
72
|
+
if (agent.mcp.transport === 'mcp-proxy-stdio') {
|
|
73
|
+
const proxyInstalled = await (0, proxy_js_1.isProxyInstalled)();
|
|
74
|
+
checks.push({
|
|
75
|
+
name: 'mcp-proxy binary installed',
|
|
76
|
+
passed: proxyInstalled,
|
|
77
|
+
message: proxyInstalled ? `Found: ${(0, proxy_js_1.getProxyPath)()}` : `Not found. Run: mx setup ${agent.id}`,
|
|
78
|
+
});
|
|
79
|
+
// 3. Check proxy binary is executable
|
|
80
|
+
if (proxyInstalled) {
|
|
81
|
+
try {
|
|
82
|
+
const proxyPath = (0, proxy_js_1.getProxyPath)();
|
|
83
|
+
(0, node_child_process_1.execFileSync)(proxyPath, ['--version'], {
|
|
84
|
+
timeout: 5000,
|
|
85
|
+
stdio: 'pipe',
|
|
86
|
+
windowsHide: true,
|
|
87
|
+
});
|
|
88
|
+
checks.push({
|
|
89
|
+
name: 'mcp-proxy binary runs',
|
|
90
|
+
passed: true,
|
|
91
|
+
message: 'Binary is executable',
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
catch (e) {
|
|
95
|
+
checks.push({
|
|
96
|
+
name: 'mcp-proxy binary runs',
|
|
97
|
+
passed: false,
|
|
98
|
+
message: `Binary failed to execute: ${e.message}`,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
// 4. Check steering file (if agent supports it)
|
|
104
|
+
if (agent.steering) {
|
|
105
|
+
const steeringPath = (0, rules_writer_js_1.resolveSteeringPath)(agent, 'global');
|
|
106
|
+
if (steeringPath) {
|
|
107
|
+
const steeringExists = (0, node_fs_1.existsSync)(steeringPath);
|
|
108
|
+
if (steeringExists) {
|
|
109
|
+
try {
|
|
110
|
+
const steeringContent = await (0, promises_1.readFile)(steeringPath, 'utf-8');
|
|
111
|
+
const version = (0, rules_templates_js_1.parseSteeringVersion)(steeringContent);
|
|
112
|
+
if (version) {
|
|
113
|
+
const isCurrent = version === package_json_1.default.version;
|
|
114
|
+
checks.push({
|
|
115
|
+
name: 'Steering rules',
|
|
116
|
+
passed: true,
|
|
117
|
+
message: isCurrent
|
|
118
|
+
? `Found (v${version}, current)`
|
|
119
|
+
: `Found (v${version}, CLI is v${package_json_1.default.version} — run \`mx setup rules --agent ${agent.id}\` to update)`,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
checks.push({
|
|
124
|
+
name: 'Steering rules',
|
|
125
|
+
passed: false,
|
|
126
|
+
message: `File exists but no MemNexus section found: ${steeringPath}`,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
catch {
|
|
131
|
+
checks.push({
|
|
132
|
+
name: 'Steering rules',
|
|
133
|
+
passed: false,
|
|
134
|
+
message: `Failed to read: ${steeringPath}`,
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
checks.push({
|
|
140
|
+
name: 'Steering rules',
|
|
141
|
+
passed: false,
|
|
142
|
+
message: `Not found: ${steeringPath}. Run: mx setup rules --agent ${agent.id}`,
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
// 5. Check API key is configured
|
|
148
|
+
const apiKey = config_js_1.config.getApiKey();
|
|
149
|
+
checks.push({
|
|
150
|
+
name: 'API key configured',
|
|
151
|
+
passed: !!apiKey,
|
|
152
|
+
message: apiKey
|
|
153
|
+
? `Configured (source: ${config_js_1.config.getApiKey() ? 'config/env' : 'none'})`
|
|
154
|
+
: 'Not configured. Run: mx auth login',
|
|
155
|
+
});
|
|
156
|
+
// 6. Check API is reachable (if key is configured)
|
|
157
|
+
if (apiKey) {
|
|
158
|
+
try {
|
|
159
|
+
const { getSdk } = await Promise.resolve().then(() => __importStar(require('../api-client.js')));
|
|
160
|
+
const sdk = getSdk();
|
|
161
|
+
await sdk.users.getCurrentUser();
|
|
162
|
+
checks.push({
|
|
163
|
+
name: 'API reachable',
|
|
164
|
+
passed: true,
|
|
165
|
+
message: 'Successfully connected to MemNexus API',
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
catch (e) {
|
|
169
|
+
checks.push({
|
|
170
|
+
name: 'API reachable',
|
|
171
|
+
passed: false,
|
|
172
|
+
message: `Connection failed: ${e.message}`,
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return {
|
|
177
|
+
agentId: agent.id,
|
|
178
|
+
agentName: agent.name,
|
|
179
|
+
checks,
|
|
180
|
+
allPassed: checks.every((c) => c.passed),
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Verify all configured agents.
|
|
185
|
+
*/
|
|
186
|
+
async function verifyAll() {
|
|
187
|
+
const agents = (0, registry_js_1.getSortedAgents)();
|
|
188
|
+
const platform = node_os_1.default.platform();
|
|
189
|
+
const results = [];
|
|
190
|
+
for (const agent of agents) {
|
|
191
|
+
// Only verify agents that have a config file present
|
|
192
|
+
const globalPath = agent.mcp.globalConfigPath[platform];
|
|
193
|
+
if (globalPath && (0, node_fs_1.existsSync)((0, detector_js_1.resolvePath)(globalPath))) {
|
|
194
|
+
results.push(await verifyAgent(agent));
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return results;
|
|
198
|
+
}
|
|
199
|
+
//# sourceMappingURL=verifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verifier.js","sourceRoot":"","sources":["../../../src/lib/setup/verifier.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBH,kCA8HC;AAKD,8BAcC;AAjKD,qCAAqC;AACrC,2DAAkD;AAClD,sDAAyB;AAEzB,+CAAgD;AAChD,+CAA4C;AAC5C,yCAA4D;AAC5D,uDAAwD;AACxD,6DAA4D;AAC5D,+CAA4C;AAC5C,4CAAsC;AACtC,yEAAgD;AAEhD;;GAEG;AACI,KAAK,UAAU,WAAW,CAAC,KAAsB;IACtD,MAAM,MAAM,GAAkB,EAAE,CAAC;IACjC,MAAM,QAAQ,GAAG,iBAAE,CAAC,QAAQ,EAAc,CAAC;IAE3C,8BAA8B;IAC9B,MAAM,UAAU,GAAG,K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AM;QACN,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;KACzC,CAAC;AACJ,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,SAAS;IAC7B,MAAM,MAAM,GAAG,IAAA,6BAAe,GAAE,CAAC;IACjC,MAAM,QAAQ,GAAG,iBAAE,CAAC,QAAQ,EAAc,CAAC;IAC3C,MAAM,OAAO,GAAmB,EAAE,CAAC;IAEnC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,qDAAqD;QACrD,MAAM,UAAU,GAAG,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QACxD,IAAI,UAAU,IAAI,IAAA,oBAAU,EAAC,IAAA,yBAAW,EAAC,UAAU,CAAC,CAAC,EAAE,CAAC;YACtD,OAAO,CAAC,IAAI,CAAC,MAAM,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;QACzC,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memnexus-ai/cli",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.44",
|
|
4
4
|
"description": "Command-line interface for MemNexus Core API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"node": ">=18.0.0"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@memnexus-ai/typescript-sdk": "^1.
|
|
36
|
+
"@memnexus-ai/typescript-sdk": "^1.42.10",
|
|
37
37
|
"axios": "^1.13.5",
|
|
38
38
|
"chalk": "^5.3.0",
|
|
39
39
|
"cli-table3": "^0.6.3",
|