@peppermint-mcp/wizard 0.1.2 → 0.1.3
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.js +29 -5
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -590,12 +590,29 @@ async function removeCursor(dryRun) {
|
|
|
590
590
|
|
|
591
591
|
// src/hosts/codex.ts
|
|
592
592
|
import { execFile as execFile4 } from "child_process";
|
|
593
|
+
import { existsSync as existsSync5, readFileSync as readFileSync5, writeFileSync as writeFileSync3, mkdirSync as mkdirSync3 } from "fs";
|
|
594
|
+
import { homedir as homedir6 } from "os";
|
|
595
|
+
import { join as join6 } from "path";
|
|
593
596
|
import { promisify as promisify4 } from "util";
|
|
594
597
|
var exec4 = promisify4(execFile4);
|
|
598
|
+
function persistCodexEnvVar(apiKey) {
|
|
599
|
+
const codexDir = join6(homedir6(), ".codex");
|
|
600
|
+
const envPath = join6(codexDir, ".env");
|
|
601
|
+
if (!existsSync5(codexDir)) {
|
|
602
|
+
mkdirSync3(codexDir, { recursive: true });
|
|
603
|
+
}
|
|
604
|
+
let content = "";
|
|
605
|
+
if (existsSync5(envPath)) {
|
|
606
|
+
content = readFileSync5(envPath, "utf-8");
|
|
607
|
+
}
|
|
608
|
+
const lines = content.split("\n").filter((l) => !l.startsWith("PEPPERMINT_TOKEN="));
|
|
609
|
+
lines.push(`PEPPERMINT_TOKEN=${apiKey}`);
|
|
610
|
+
writeFileSync3(envPath, lines.filter(Boolean).join("\n") + "\n", { mode: 384 });
|
|
611
|
+
}
|
|
595
612
|
async function installCodex(serverUrl, apiKey, dryRun) {
|
|
596
613
|
const addArgs = ["mcp", "add", "peppermint-memory", "--url", serverUrl];
|
|
597
614
|
if (apiKey) {
|
|
598
|
-
addArgs.push("--
|
|
615
|
+
addArgs.push("--bearer-token-env-var", "PEPPERMINT_TOKEN");
|
|
599
616
|
}
|
|
600
617
|
if (dryRun) {
|
|
601
618
|
return {
|
|
@@ -605,7 +622,14 @@ async function installCodex(serverUrl, apiKey, dryRun) {
|
|
|
605
622
|
};
|
|
606
623
|
}
|
|
607
624
|
try {
|
|
608
|
-
|
|
625
|
+
if (apiKey) {
|
|
626
|
+
persistCodexEnvVar(apiKey);
|
|
627
|
+
}
|
|
628
|
+
const env = { ...process.env };
|
|
629
|
+
if (apiKey) {
|
|
630
|
+
env.PEPPERMINT_TOKEN = apiKey;
|
|
631
|
+
}
|
|
632
|
+
await exec4("codex", addArgs, { timeout: 15e3, env });
|
|
609
633
|
return {
|
|
610
634
|
success: true,
|
|
611
635
|
message: "Added peppermint-memory via codex mcp add",
|
|
@@ -656,7 +680,7 @@ async function checkServerReachable(serverUrl) {
|
|
|
656
680
|
}
|
|
657
681
|
|
|
658
682
|
// src/verify/host.ts
|
|
659
|
-
import { existsSync as
|
|
683
|
+
import { existsSync as existsSync6, readFileSync as readFileSync6 } from "fs";
|
|
660
684
|
import * as jsonc4 from "jsonc-parser";
|
|
661
685
|
function checkHostConfig(hostId, configPath) {
|
|
662
686
|
if (!configPath) {
|
|
@@ -666,7 +690,7 @@ function checkHostConfig(hostId, configPath) {
|
|
|
666
690
|
message: "Installed via CLI"
|
|
667
691
|
};
|
|
668
692
|
}
|
|
669
|
-
if (!
|
|
693
|
+
if (!existsSync6(configPath)) {
|
|
670
694
|
return {
|
|
671
695
|
hostId,
|
|
672
696
|
status: "fail",
|
|
@@ -674,7 +698,7 @@ function checkHostConfig(hostId, configPath) {
|
|
|
674
698
|
};
|
|
675
699
|
}
|
|
676
700
|
try {
|
|
677
|
-
const content =
|
|
701
|
+
const content = readFileSync6(configPath, "utf-8");
|
|
678
702
|
const parsed = jsonc4.parse(content);
|
|
679
703
|
const hasPeppermint = !!parsed?.mcpServers?.peppermint;
|
|
680
704
|
if (!hasPeppermint) {
|