@morphllm/morph-setup 1.0.1 → 1.0.2
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 +23 -31
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -930,18 +930,28 @@ function getBundledSkillsDir() {
|
|
|
930
930
|
function getAllAgentTypes() {
|
|
931
931
|
return Object.keys(agents);
|
|
932
932
|
}
|
|
933
|
-
async function
|
|
934
|
-
const
|
|
933
|
+
async function selectPlatforms(opts) {
|
|
934
|
+
const supportedMcpIds = new Set(listSupportedMcpClients().map((c) => c.id));
|
|
935
|
+
const allPlatforms = getAllAgentTypes().filter((id) => supportedMcpIds.has(id));
|
|
935
936
|
if (opts.cliAgents.length > 0) return opts.cliAgents;
|
|
936
|
-
if (opts.yes)
|
|
937
|
-
|
|
938
|
-
|
|
937
|
+
if (opts.yes) {
|
|
938
|
+
const detectedAgents2 = await detectInstalledAgents();
|
|
939
|
+
const detectedMcp2 = detectMcpClients();
|
|
940
|
+
const detected2 = [.../* @__PURE__ */ new Set([...detectedAgents2, ...detectedMcp2])].filter(
|
|
941
|
+
(id) => supportedMcpIds.has(id)
|
|
942
|
+
);
|
|
943
|
+
return detected2.length > 0 ? detected2 : allPlatforms;
|
|
944
|
+
}
|
|
945
|
+
const detectedAgents = await detectInstalledAgents();
|
|
946
|
+
const detectedMcp = detectMcpClients();
|
|
947
|
+
const detected = /* @__PURE__ */ new Set([...detectedAgents, ...detectedMcp]);
|
|
948
|
+
const initial = detected.size > 0 ? [...detected] : allPlatforms;
|
|
939
949
|
const res = await p.multiselect({
|
|
940
|
-
message: "Choose which
|
|
941
|
-
options:
|
|
950
|
+
message: "Choose which platforms you want to install into:",
|
|
951
|
+
options: allPlatforms.map((id) => ({
|
|
942
952
|
value: id,
|
|
943
953
|
label: agents[id].displayName,
|
|
944
|
-
hint: detected.
|
|
954
|
+
hint: detected.has(id) ? "detected" : void 0
|
|
945
955
|
})),
|
|
946
956
|
initialValues: initial,
|
|
947
957
|
required: true
|
|
@@ -949,25 +959,6 @@ async function selectAgents(opts) {
|
|
|
949
959
|
if (p.isCancel(res)) process.exit(0);
|
|
950
960
|
return res;
|
|
951
961
|
}
|
|
952
|
-
async function selectMcpClients(opts) {
|
|
953
|
-
const supported = listSupportedMcpClients();
|
|
954
|
-
const detected = detectMcpClients();
|
|
955
|
-
if (opts.yes) {
|
|
956
|
-
return detected.length > 0 ? detected : supported.map((c) => c.id);
|
|
957
|
-
}
|
|
958
|
-
const res = await p.multiselect({
|
|
959
|
-
message: "Choose which apps to install the MCP into",
|
|
960
|
-
options: supported.map((c) => ({
|
|
961
|
-
value: c.id,
|
|
962
|
-
label: c.label,
|
|
963
|
-
hint: detected.includes(c.id) ? "detected" : void 0
|
|
964
|
-
})),
|
|
965
|
-
initialValues: detected.length > 0 ? detected : supported.map((c) => c.id),
|
|
966
|
-
required: true
|
|
967
|
-
});
|
|
968
|
-
if (p.isCancel(res)) process.exit(0);
|
|
969
|
-
return res;
|
|
970
|
-
}
|
|
971
962
|
async function getMorphMcpInput(opts) {
|
|
972
963
|
const envApiKey = process.env.MORPH_API_KEY;
|
|
973
964
|
const effectiveApiKey = opts.cliApiKey ?? envApiKey;
|
|
@@ -1037,22 +1028,23 @@ async function main() {
|
|
|
1037
1028
|
const pkg = require2("../package.json");
|
|
1038
1029
|
setVersion(pkg.version);
|
|
1039
1030
|
await showMorphSplash();
|
|
1040
|
-
const program = new Command().name("morph-setup").description("Install Morph MCP and bundled skills onto coding agents").argument("[source]", "Optional skills source (repo/path). Bundled skills are always installed.").option("--morph-api-key <key>", "MORPH_API_KEY to write into MCP config (overrides env)").option("-g, --global", "Install skills globally (default)").option("
|
|
1031
|
+
const program = new Command().name("morph-setup").description("Install Morph MCP and bundled skills onto coding agents").argument("[source]", "Optional skills source (repo/path). Bundled skills are always installed.").option("--morph-api-key <key>", "MORPH_API_KEY to write into MCP config (overrides env)").option("-g, --global", "Install skills globally (default)").option("-a, --agent <agents...>", "Target specific agents (repeatable)").option("-s, --skill <skills...>", "Install specific skills by name (only affects <source> skills)").option("-l, --list", "List available skills without installing").option("-y, --yes", "Skip all confirmation prompts").version(pkg.version);
|
|
1041
1032
|
const argv = process.argv.slice();
|
|
1042
1033
|
if (argv[2] === "--") argv.splice(2, 1);
|
|
1043
1034
|
program.parse(argv);
|
|
1044
1035
|
const opts = program.opts();
|
|
1045
1036
|
const source = program.args[0];
|
|
1046
1037
|
const yes = !!opts.yes;
|
|
1047
|
-
const global =
|
|
1038
|
+
const global = true;
|
|
1048
1039
|
p.intro(chalk.greenBright(" Morph MCP Install "));
|
|
1049
|
-
const mcpClients = await selectMcpClients({ yes });
|
|
1050
1040
|
const mcpInput = await getMorphMcpInput({
|
|
1051
1041
|
yes,
|
|
1052
1042
|
cliApiKey: opts.morphApiKey
|
|
1053
1043
|
});
|
|
1054
1044
|
const cliAgents = (opts.agent ?? []).map((a) => a);
|
|
1055
|
-
const
|
|
1045
|
+
const selectedPlatforms = await selectPlatforms({ yes, cliAgents });
|
|
1046
|
+
const mcpClients = selectedPlatforms;
|
|
1047
|
+
const targetAgents = selectedPlatforms;
|
|
1056
1048
|
if (opts.list) {
|
|
1057
1049
|
const bundled = await discoverSkills(getBundledSkillsDir());
|
|
1058
1050
|
p.log.info(chalk.greenBright("Bundled skills:"));
|