@candleswarm/mcp 0.1.2 → 0.1.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/README.md +20 -6
- package/bin/mcp.js +6 -0
- package/bin/update.js +5 -0
- package/dist/doctor.js +8 -8
- package/dist/server.js +49 -49
- package/dist/update.js +15 -0
- package/package.json +2 -1
package/dist/update.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import{stdout as i}from"process";import{chmod as l,readFile as g,rename as w,stat as h,unlink as C,writeFile as k}from"fs/promises";import{homedir as E}from"os";import{join as c}from"path";var m=/@candleswarm\/mcp(?:@[0-9A-Za-z][0-9A-Za-z.+-]*)?(?![0-9A-Za-z._/-])/g,y=/^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(?:-[0-9A-Za-z.-]+)?$/;async function u(e){if(!y.test(e.version))throw new Error(`Invalid MCP package version: ${e.version}`);let t=e.home??E(),n=e.env??process.env,r=P(n.CODEX_HOME)??c(t,".codex"),o=[{client:"Codex",path:c(r,"config.toml")},{client:"Claude Code",path:c(t,".claude.json")},{client:"Grok",path:c(t,".grok","config.toml")}],s=[];for(let a of o){let p=await v(a.path,e.version);p&&s.push({...a,...p})}return s}async function v(e,t){let n;try{n=await g(e,"utf8")}catch(a){if(f(a))return;throw a}let r=n.match(m)??[];if(r.length===0)return;let o=`@candleswarm/mcp@${t}`,s=r.filter(a=>a!==o).length;return s>0&&await x(e,n.replace(m,o)),{registrations:r.length,changed:s}}async function x(e,t){let n=await h(e),r=`${e}.${process.pid}.${Date.now()}.tmp`;try{await k(r,t,{mode:n.mode}),process.platform!=="win32"&&await l(r,n.mode),await w(r,e),process.platform!=="win32"&&await l(e,n.mode)}finally{await C(r).catch(o=>{if(!f(o))throw o})}}function P(e){return typeof e=="string"&&e.trim()?e.trim():void 0}function f(e){return!!(e&&typeof e=="object"&&e.code==="ENOENT")}import{readFileSync as $}from"fs";import{dirname as A,resolve as R}from"path";import{fileURLToPath as S}from"url";function U(){try{let e=A(S(import.meta.url)),t=JSON.parse($(R(e,"..","package.json"),"utf-8"));return typeof t.version=="string"&&t.version.trim()?t.version.trim():"0.0.0"}catch{return"0.0.0"}}var d=U();async function N(){let e=process.argv.slice(2);if(e.some(n=>n==="--help"||n==="-h")){O();return}if(e.length>0)throw new Error(`Unknown option: ${e[0]}`);i.write(`
|
|
2
|
+
CandleSwarm MCP update
|
|
3
|
+
`),i.write(`----------------------
|
|
4
|
+
`),i.write(`Target package: @candleswarm/mcp@${d}
|
|
5
|
+
|
|
6
|
+
`);let t=await u({version:d});if(t.length===0){i.write(`No CandleSwarm definitions were found in the supported Codex, Claude Code, or Grok user configs.
|
|
7
|
+
`),i.write(`For another MCP client, replace its package command with:
|
|
8
|
+
`),i.write(` npx -y @candleswarm/mcp@${d}
|
|
9
|
+
`),process.exitCode=1;return}for(let n of t){let r=n.changed>0?`updated ${n.changed}/${n.registrations}`:`already current (${n.registrations})`;i.write(`\u2713 ${n.client}: ${r} \u2014 ${n.path}
|
|
10
|
+
`)}i.write(`
|
|
11
|
+
Secure profiles and API keys were not read or changed.
|
|
12
|
+
`),i.write(`Restart each updated MCP client to load the new package version.
|
|
13
|
+
`)}function O(){i.write(["Usage: npx -y @candleswarm/mcp@latest update","","Updates every CandleSwarm package pin found in the supported Codex,","Claude Code, and Grok user configs. Existing profiles and API keys remain unchanged.",""].join(`
|
|
14
|
+
`))}N().catch(e=>{i.write(`update failed: ${e instanceof Error?e.message:String(e)}
|
|
15
|
+
`),process.exit(1)});export{N as main};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@candleswarm/mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Secure CandleSwarm MCP server for AI agents to develop, backtest, and optimize crypto strategies with App-visible drafts.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/server.js",
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"mcp": "bin/mcp.js",
|
|
9
9
|
"candleswarm-mcp": "bin/candleswarm-mcp.js",
|
|
10
10
|
"candleswarm-mcp-init": "bin/init.js",
|
|
11
|
+
"candleswarm-mcp-update": "bin/update.js",
|
|
11
12
|
"candleswarm-mcp-doctor": "bin/doctor.js"
|
|
12
13
|
},
|
|
13
14
|
"files": [
|