@memoraone/mcp 0.1.24 → 0.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +12 -53
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -30,7 +30,7 @@ var require_package = __commonJS({
|
|
|
30
30
|
"package.json"(exports2, module2) {
|
|
31
31
|
module2.exports = {
|
|
32
32
|
name: "@memoraone/mcp",
|
|
33
|
-
version: "0.1.
|
|
33
|
+
version: "0.1.25",
|
|
34
34
|
type: "module",
|
|
35
35
|
main: "dist/index.cjs",
|
|
36
36
|
bin: {
|
|
@@ -685,44 +685,14 @@ async function cliCleanup(argv) {
|
|
|
685
685
|
return result.exitCode;
|
|
686
686
|
}
|
|
687
687
|
|
|
688
|
-
// src/configUtils.ts
|
|
689
|
-
var PROD_API_URL = "https://api.memoraone.com";
|
|
690
|
-
|
|
691
688
|
// src/setupIdeFiles.ts
|
|
692
689
|
var MANAGED_MARKER = "<!-- MemoraOne managed IDE helper -->";
|
|
693
690
|
var GITIGNORE_MEMORAONE_COMMENT = "# MemoraOne local project binding / API key";
|
|
694
691
|
var GITIGNORE_MEMORAONE_ENTRY = "memoraone.m1";
|
|
695
|
-
var
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
const lower = environment.toLowerCase();
|
|
700
|
-
return lower === "production" || lower === "prod";
|
|
701
|
-
}
|
|
702
|
-
async function readMemoraoneM1Environment(repoRoot) {
|
|
703
|
-
const m1Path = path4.join(repoRoot, "memoraone.m1");
|
|
704
|
-
try {
|
|
705
|
-
const content = await fs4.readFile(m1Path, "utf8");
|
|
706
|
-
const parsed = JSON.parse(content);
|
|
707
|
-
if (typeof parsed?.environment === "string") {
|
|
708
|
-
const trimmed = parsed.environment.trim();
|
|
709
|
-
if (trimmed !== "") return trimmed;
|
|
710
|
-
}
|
|
711
|
-
} catch {
|
|
712
|
-
}
|
|
713
|
-
return void 0;
|
|
714
|
-
}
|
|
715
|
-
async function buildMemoraoneMcpServerEntry(repoRoot) {
|
|
716
|
-
const entry = {
|
|
717
|
-
command: "npx",
|
|
718
|
-
args: ["-y", MCP_PACKAGE_ARG]
|
|
719
|
-
};
|
|
720
|
-
const environment = await readMemoraoneM1Environment(repoRoot);
|
|
721
|
-
if (isProdBoundEnvironment(environment)) {
|
|
722
|
-
entry.env = { MEMORAONE_API_URL: PROD_API_URL };
|
|
723
|
-
}
|
|
724
|
-
return entry;
|
|
725
|
-
}
|
|
692
|
+
var MEMORAONE_MCP_SERVER = {
|
|
693
|
+
command: "npx",
|
|
694
|
+
args: ["-y", "@memoraone/mcp@latest"]
|
|
695
|
+
};
|
|
726
696
|
function assertUnderRepoRoot(repoRoot, absPath) {
|
|
727
697
|
const normRoot = path4.resolve(repoRoot) + path4.sep;
|
|
728
698
|
const normPath = path4.resolve(absPath);
|
|
@@ -830,21 +800,11 @@ function mcpJsonHeader() {
|
|
|
830
800
|
return `// ${MANAGED_MARKER}
|
|
831
801
|
`;
|
|
832
802
|
}
|
|
833
|
-
function
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
return { ...existing.mcpServers };
|
|
839
|
-
}
|
|
840
|
-
return {};
|
|
841
|
-
}
|
|
842
|
-
function buildMcpJsonBody(existing, memoraoneServer) {
|
|
843
|
-
const base = existing && typeof existing === "object" ? { ...existing } : { [VSCODE_MCP_SERVERS_KEY]: {} };
|
|
844
|
-
const servers = extractExistingMcpServers(base);
|
|
845
|
-
servers.memoraone = memoraoneServer;
|
|
846
|
-
const { mcpServers: _legacy, ...rest } = base;
|
|
847
|
-
const merged = { ...rest, [VSCODE_MCP_SERVERS_KEY]: servers };
|
|
803
|
+
function buildMcpJsonBody(existing) {
|
|
804
|
+
const base = existing && typeof existing === "object" ? { ...existing } : { servers: {} };
|
|
805
|
+
const servers = typeof base.servers === "object" && base.servers !== null && !Array.isArray(base.servers) ? { ...base.servers } : {};
|
|
806
|
+
servers.memoraone = { ...MEMORAONE_MCP_SERVER };
|
|
807
|
+
const merged = { ...base, servers };
|
|
848
808
|
return mcpJsonHeader() + JSON.stringify(merged, null, 2) + "\n";
|
|
849
809
|
}
|
|
850
810
|
async function writeManagedMarkdown(repoRoot, relPath, fullContent, opts) {
|
|
@@ -888,9 +848,8 @@ async function writeMcpJson(repoRoot, opts) {
|
|
|
888
848
|
} catch (err) {
|
|
889
849
|
if (err?.code !== "ENOENT") throw err;
|
|
890
850
|
}
|
|
891
|
-
const memoraoneServer = await buildMemoraoneMcpServerEntry(repoRoot);
|
|
892
851
|
if (!existed) {
|
|
893
|
-
const body = buildMcpJsonBody(null
|
|
852
|
+
const body = buildMcpJsonBody(null);
|
|
894
853
|
if (opts.dryRun) return "created";
|
|
895
854
|
await fs4.mkdir(path4.dirname(abs), { recursive: true });
|
|
896
855
|
await fs4.writeFile(abs, body, "utf8");
|
|
@@ -905,7 +864,7 @@ async function writeMcpJson(repoRoot, opts) {
|
|
|
905
864
|
parsed = null;
|
|
906
865
|
}
|
|
907
866
|
if (!parsed && !opts.force) return "skipped-untracked";
|
|
908
|
-
const next = buildMcpJsonBody(parsed
|
|
867
|
+
const next = buildMcpJsonBody(parsed);
|
|
909
868
|
if (managed && next === raw) return "skipped";
|
|
910
869
|
if (opts.dryRun) return "updated";
|
|
911
870
|
await fs4.mkdir(path4.dirname(abs), { recursive: true });
|