@morphllm/morph-setup 1.0.2 → 1.0.4
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/index.js +13 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -621,12 +621,20 @@ async function writeJson(filePath, data) {
|
|
|
621
621
|
function tomlEscapeString(value) {
|
|
622
622
|
return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\n/g, "\\n");
|
|
623
623
|
}
|
|
624
|
+
function buildMorphArgs(input) {
|
|
625
|
+
const args = ["-y", "@morphllm/morphmcp"];
|
|
626
|
+
if (input.apiKey) args.push("--api-key", input.apiKey);
|
|
627
|
+
return args;
|
|
628
|
+
}
|
|
624
629
|
function buildCodexMorphBlock(input) {
|
|
625
630
|
const lines = [];
|
|
626
631
|
lines.push("[mcp_servers.morph-mcp]");
|
|
627
632
|
lines.push('command = "npx"');
|
|
628
|
-
|
|
633
|
+
const morphArgs = buildMorphArgs(input);
|
|
634
|
+
const argsToml = morphArgs.map((a) => `"${tomlEscapeString(a)}"`).join(", ");
|
|
635
|
+
lines.push(`args = [${argsToml}]`);
|
|
629
636
|
lines.push("enabled = true");
|
|
637
|
+
lines.push("startup_timeout_sec = 45");
|
|
630
638
|
const env = [];
|
|
631
639
|
if (input.apiKey) env.push(`MORPH_API_KEY = "${tomlEscapeString(input.apiKey)}"`);
|
|
632
640
|
if (input.enabledTools) env.push(`ENABLED_TOOLS = "${tomlEscapeString(input.enabledTools)}"`);
|
|
@@ -700,7 +708,7 @@ async function installToMcpServersJson(configPath, input, options) {
|
|
|
700
708
|
servers[key] = {
|
|
701
709
|
...existing ?? {},
|
|
702
710
|
command: "npx",
|
|
703
|
-
args:
|
|
711
|
+
args: buildMorphArgs(input),
|
|
704
712
|
...env ? { env } : {}
|
|
705
713
|
};
|
|
706
714
|
await writeJson(configPath, obj);
|
|
@@ -727,7 +735,7 @@ async function installToClaudeCodeUserConfig(configPath, input) {
|
|
|
727
735
|
...existing ?? {},
|
|
728
736
|
type: "stdio",
|
|
729
737
|
command: "npx",
|
|
730
|
-
args:
|
|
738
|
+
args: buildMorphArgs(input),
|
|
731
739
|
...env ? { env } : {}
|
|
732
740
|
};
|
|
733
741
|
await writeJson(configPath, obj);
|
|
@@ -761,7 +769,7 @@ async function installToOpenCodeConfig(configPath, input) {
|
|
|
761
769
|
mcp[key] = {
|
|
762
770
|
...existing ?? {},
|
|
763
771
|
type: "local",
|
|
764
|
-
command: ["npx",
|
|
772
|
+
command: ["npx", ...buildMorphArgs(input)],
|
|
765
773
|
enabled: true,
|
|
766
774
|
...Object.keys(environment).length > 0 ? { environment } : {}
|
|
767
775
|
};
|
|
@@ -798,7 +806,7 @@ async function installToAmpSettings(configPath, input) {
|
|
|
798
806
|
servers[serverKey] = {
|
|
799
807
|
...existing ?? {},
|
|
800
808
|
command: "npx",
|
|
801
|
-
args:
|
|
809
|
+
args: buildMorphArgs(input),
|
|
802
810
|
...env ? { env } : {}
|
|
803
811
|
};
|
|
804
812
|
await writeJson(configPath, obj);
|