@pionex/pionex-ai-kit 0.2.53 → 0.2.54
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/{chunk-I6Z3QX5T.js → chunk-P3F7NIBO.js} +49 -3
- package/dist/chunk-P3F7NIBO.js.map +1 -0
- package/dist/index.js +2 -2
- package/dist/{kit-DBQGQY64.js → kit-CR5ACHEN.js} +3 -3
- package/dist/kit-CR5ACHEN.js.map +1 -0
- package/dist/{trade-4DUOU56K.js → trade-PUFF7IDV.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-I6Z3QX5T.js.map +0 -1
- package/dist/kit-DBQGQY64.js.map +0 -1
- /package/dist/{trade-4DUOU56K.js.map → trade-PUFF7IDV.js.map} +0 -0
|
@@ -863,7 +863,8 @@ var CLIENT_NAMES = {
|
|
|
863
863
|
windsurf: "Windsurf",
|
|
864
864
|
vscode: "VS Code",
|
|
865
865
|
"claude-code": "Claude Code CLI",
|
|
866
|
-
openclaw: "OpenClaw (mcporter)"
|
|
866
|
+
openclaw: "OpenClaw (mcporter)",
|
|
867
|
+
codex: "OpenAI Codex CLI"
|
|
867
868
|
};
|
|
868
869
|
var SUPPORTED_CLIENTS = Object.keys(CLIENT_NAMES);
|
|
869
870
|
function appData() {
|
|
@@ -915,6 +916,8 @@ function getConfigPath(client) {
|
|
|
915
916
|
return null;
|
|
916
917
|
case "openclaw":
|
|
917
918
|
return path.join(home, ".openclaw", "workspace", "config", "mcporter.json");
|
|
919
|
+
case "codex":
|
|
920
|
+
return path.join(home, ".codex", "config.yaml");
|
|
918
921
|
}
|
|
919
922
|
}
|
|
920
923
|
var NPX_PACKAGE = "@pionex/pionex-trade-mcp";
|
|
@@ -922,6 +925,9 @@ function buildEntry(client) {
|
|
|
922
925
|
if (client === "vscode") {
|
|
923
926
|
return { type: "stdio", command: "npx", args: ["-y", NPX_PACKAGE] };
|
|
924
927
|
}
|
|
928
|
+
if (client === "codex") {
|
|
929
|
+
return { command: "npx", args: ["-y", NPX_PACKAGE] };
|
|
930
|
+
}
|
|
925
931
|
return { command: "npx", args: ["-y", NPX_PACKAGE] };
|
|
926
932
|
}
|
|
927
933
|
function mergeJsonConfig(configPath, serverName, entry) {
|
|
@@ -942,6 +948,42 @@ function mergeJsonConfig(configPath, serverName, entry) {
|
|
|
942
948
|
data.mcpServers[serverName] = entry;
|
|
943
949
|
fs.writeFileSync(configPath, JSON.stringify(data, null, 2) + "\n", "utf-8");
|
|
944
950
|
}
|
|
951
|
+
function mergeCodexYaml(configPath, serverName, entry) {
|
|
952
|
+
const dir = path.dirname(configPath);
|
|
953
|
+
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
|
|
954
|
+
const args = entry.args;
|
|
955
|
+
const argsYaml = args.map((a) => ` - "${a}"`).join("\n");
|
|
956
|
+
const serverBlock = ` ${serverName}:
|
|
957
|
+
command: "${entry.command}"
|
|
958
|
+
args:
|
|
959
|
+
` + argsYaml;
|
|
960
|
+
if (!fs.existsSync(configPath)) {
|
|
961
|
+
const content = `mcpServers:
|
|
962
|
+
${serverBlock}
|
|
963
|
+
`;
|
|
964
|
+
fs.writeFileSync(configPath, content, "utf-8");
|
|
965
|
+
return;
|
|
966
|
+
}
|
|
967
|
+
const raw = fs.readFileSync(configPath, "utf-8");
|
|
968
|
+
const serverEntryRegex = new RegExp(
|
|
969
|
+
`( ${serverName}:\\n(?: [^\\n]*\\n| [^\\n]*\\n)*)`,
|
|
970
|
+
"g"
|
|
971
|
+
);
|
|
972
|
+
if (serverEntryRegex.test(raw)) {
|
|
973
|
+
fs.writeFileSync(configPath, raw.replace(serverEntryRegex, serverBlock + "\n"), "utf-8");
|
|
974
|
+
return;
|
|
975
|
+
}
|
|
976
|
+
if (raw.includes("mcpServers:")) {
|
|
977
|
+
const updated = raw.replace("mcpServers:", `mcpServers:
|
|
978
|
+
${serverBlock}`);
|
|
979
|
+
fs.writeFileSync(configPath, updated, "utf-8");
|
|
980
|
+
return;
|
|
981
|
+
}
|
|
982
|
+
fs.writeFileSync(configPath, raw.trimEnd() + `
|
|
983
|
+
mcpServers:
|
|
984
|
+
${serverBlock}
|
|
985
|
+
`, "utf-8");
|
|
986
|
+
}
|
|
945
987
|
function runSetup(options) {
|
|
946
988
|
const { client } = options;
|
|
947
989
|
const name = CLIENT_NAMES[client];
|
|
@@ -972,7 +1014,11 @@ function runSetup(options) {
|
|
|
972
1014
|
throw new Error(`${name} is not supported on this platform`);
|
|
973
1015
|
}
|
|
974
1016
|
const entry = buildEntry(client);
|
|
975
|
-
|
|
1017
|
+
if (client === "codex") {
|
|
1018
|
+
mergeCodexYaml(configPath, serverName, entry);
|
|
1019
|
+
} else {
|
|
1020
|
+
mergeJsonConfig(configPath, serverName, entry);
|
|
1021
|
+
}
|
|
976
1022
|
process.stdout.write(
|
|
977
1023
|
`\u2713 Configured ${name}
|
|
978
1024
|
${configPath}
|
|
@@ -3126,4 +3172,4 @@ smol-toml/dist/index.js:
|
|
|
3126
3172
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
3127
3173
|
*)
|
|
3128
3174
|
*/
|
|
3129
|
-
//# sourceMappingURL=chunk-
|
|
3175
|
+
//# sourceMappingURL=chunk-P3F7NIBO.js.map
|