maxsimcli 4.7.0 → 4.7.1
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/assets/CHANGELOG.md +23 -0
- package/dist/cli.cjs +470 -961
- package/dist/cli.cjs.map +1 -1
- package/dist/{core-RRjCSt0G.cjs → core-D5zUr9cb.cjs} +4 -3
- package/dist/core-D5zUr9cb.cjs.map +1 -0
- package/dist/install.cjs +3 -195
- package/dist/install.cjs.map +1 -1
- package/dist/mcp-server.cjs +138 -201
- package/dist/mcp-server.cjs.map +1 -1
- package/dist/{skills-MYlMkYNt.cjs → skills-CjFWZIGM.cjs} +6 -6
- package/dist/{skills-MYlMkYNt.cjs.map → skills-CjFWZIGM.cjs.map} +1 -1
- package/package.json +1 -7
- package/dist/assets/dashboard/client/assets/index-C199D4Eb.css +0 -32
- package/dist/assets/dashboard/client/assets/index-nAXJLp0_.js +0 -233
- package/dist/assets/dashboard/client/index.html +0 -19
- package/dist/assets/dashboard/server.js +0 -78813
- package/dist/backend-server.cjs +0 -83370
- package/dist/backend-server.cjs.map +0 -1
- package/dist/core-RRjCSt0G.cjs.map +0 -1
- package/dist/esm-iIOBzmdz.cjs +0 -1561
- package/dist/esm-iIOBzmdz.cjs.map +0 -1
- package/dist/lifecycle-D8mcsEjy.cjs +0 -136
- package/dist/lifecycle-D8mcsEjy.cjs.map +0 -1
- package/dist/server-BAHfh_vw.cjs +0 -5694
- package/dist/server-BAHfh_vw.cjs.map +0 -1
package/dist/install.cjs
CHANGED
|
@@ -46,7 +46,6 @@ let node_readline = require("node:readline");
|
|
|
46
46
|
node_readline = __toESM(node_readline);
|
|
47
47
|
let node_crypto = require("node:crypto");
|
|
48
48
|
node_crypto = __toESM(node_crypto);
|
|
49
|
-
let node_child_process = require("node:child_process");
|
|
50
49
|
|
|
51
50
|
//#region ../../node_modules/universalify/index.js
|
|
52
51
|
var require_universalify = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
@@ -1974,7 +1973,6 @@ var require_lib$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1974
1973
|
|
|
1975
1974
|
//#endregion
|
|
1976
1975
|
//#region ../../node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
1977
|
-
var import_lib = /* @__PURE__ */ __toESM(require_lib$1());
|
|
1978
1976
|
const ANSI_BACKGROUND_OFFSET = 10;
|
|
1979
1977
|
const wrapAnsi16 = (offset = 0) => (code) => `\u001B[${code + offset}m`;
|
|
1980
1978
|
const wrapAnsi256 = (offset = 0) => (code) => `\u001B[${38 + offset};5;${code}m`;
|
|
@@ -7595,19 +7593,6 @@ function getDirName() {
|
|
|
7595
7593
|
return ".claude";
|
|
7596
7594
|
}
|
|
7597
7595
|
/**
|
|
7598
|
-
* Recursively remove a directory, handling Windows read-only file attributes.
|
|
7599
|
-
* fs-extra handles cross-platform edge cases (EPERM on Windows, symlinks, etc.)
|
|
7600
|
-
*/
|
|
7601
|
-
function safeRmDir(dirPath) {
|
|
7602
|
-
import_lib.default.removeSync(dirPath);
|
|
7603
|
-
}
|
|
7604
|
-
/**
|
|
7605
|
-
* Recursively copy a directory (dereferences symlinks)
|
|
7606
|
-
*/
|
|
7607
|
-
function copyDirRecursive(src, dest) {
|
|
7608
|
-
import_lib.default.copySync(src, dest, { dereference: true });
|
|
7609
|
-
}
|
|
7610
|
-
/**
|
|
7611
7596
|
* Verify a directory exists and contains files.
|
|
7612
7597
|
* If expectedFiles is provided, also checks that those specific files exist inside the directory.
|
|
7613
7598
|
*/
|
|
@@ -7709,154 +7694,6 @@ function getCommitAttribution(explicitConfigDir) {
|
|
|
7709
7694
|
return attributionValue;
|
|
7710
7695
|
}
|
|
7711
7696
|
|
|
7712
|
-
//#endregion
|
|
7713
|
-
//#region src/install/dashboard.ts
|
|
7714
|
-
/** Check whether the current process is running with admin/root privileges. */
|
|
7715
|
-
function isElevated() {
|
|
7716
|
-
if (process.platform === "win32") try {
|
|
7717
|
-
(0, node_child_process.execSync)("net session", { stdio: "pipe" });
|
|
7718
|
-
return true;
|
|
7719
|
-
} catch {
|
|
7720
|
-
return false;
|
|
7721
|
-
}
|
|
7722
|
-
return process.getuid?.() === 0;
|
|
7723
|
-
}
|
|
7724
|
-
/**
|
|
7725
|
-
* Add a firewall rule to allow inbound traffic on the given port.
|
|
7726
|
-
* Handles Windows (netsh), Linux (ufw / iptables), and macOS (no rule needed).
|
|
7727
|
-
*/
|
|
7728
|
-
function applyFirewallRule(port) {
|
|
7729
|
-
const platform = process.platform;
|
|
7730
|
-
try {
|
|
7731
|
-
if (platform === "win32") {
|
|
7732
|
-
const cmd = `netsh advfirewall firewall add rule name="MAXSIM Dashboard" dir=in action=allow protocol=TCP localport=${port}`;
|
|
7733
|
-
if (isElevated()) {
|
|
7734
|
-
(0, node_child_process.execSync)(cmd, { stdio: "pipe" });
|
|
7735
|
-
console.log(chalk.green(" ✓ Windows Firewall rule added for port " + port));
|
|
7736
|
-
} else {
|
|
7737
|
-
console.log(chalk.gray(" Requesting administrator privileges for firewall rule..."));
|
|
7738
|
-
(0, node_child_process.execSync)(`powershell -NoProfile -Command "${`Start-Process cmd -ArgumentList '/c ${cmd}' -Verb RunAs -Wait`}"`, { stdio: "pipe" });
|
|
7739
|
-
console.log(chalk.green(" ✓ Windows Firewall rule added for port " + port));
|
|
7740
|
-
}
|
|
7741
|
-
} else if (platform === "linux") {
|
|
7742
|
-
const sudoPrefix = isElevated() ? "" : "sudo ";
|
|
7743
|
-
try {
|
|
7744
|
-
(0, node_child_process.execSync)(`${sudoPrefix}ufw allow ${port}/tcp`, { stdio: "pipe" });
|
|
7745
|
-
console.log(chalk.green(" ✓ UFW rule added for port " + port));
|
|
7746
|
-
} catch {
|
|
7747
|
-
try {
|
|
7748
|
-
(0, node_child_process.execSync)(`${sudoPrefix}iptables -A INPUT -p tcp --dport ${port} -j ACCEPT`, { stdio: "pipe" });
|
|
7749
|
-
console.log(chalk.green(" ✓ iptables rule added for port " + port));
|
|
7750
|
-
} catch {
|
|
7751
|
-
console.log(chalk.yellow(` \u26a0 Could not add firewall rule automatically. Run: sudo ufw allow ${port}/tcp`));
|
|
7752
|
-
}
|
|
7753
|
-
}
|
|
7754
|
-
} else if (platform === "darwin") console.log(chalk.gray(" macOS: No firewall rule needed (inbound connections are allowed by default)"));
|
|
7755
|
-
} catch (err) {
|
|
7756
|
-
console.warn(chalk.yellow(` \u26a0 Firewall rule failed: ${err.message}`));
|
|
7757
|
-
console.warn(chalk.gray(` You may need to manually allow port ${port} through your firewall.`));
|
|
7758
|
-
}
|
|
7759
|
-
}
|
|
7760
|
-
/**
|
|
7761
|
-
* Handle the `dashboard` subcommand — refresh assets, install node-pty, launch server
|
|
7762
|
-
*/
|
|
7763
|
-
async function runDashboardSubcommand(argv) {
|
|
7764
|
-
const { spawn: spawnDash, execSync: execSyncDash } = await import("node:child_process");
|
|
7765
|
-
const dashboardAssetSrc = node_path.resolve(__dirname, "assets", "dashboard");
|
|
7766
|
-
const installDir = node_path.join(process.cwd(), ".claude");
|
|
7767
|
-
const installDashDir = node_path.join(installDir, "dashboard");
|
|
7768
|
-
if (node_fs.existsSync(dashboardAssetSrc)) {
|
|
7769
|
-
const nodeModulesDir = node_path.join(installDashDir, "node_modules");
|
|
7770
|
-
const nodeModulesTmp = node_path.join(installDir, "_dashboard_node_modules_tmp");
|
|
7771
|
-
const hadNodeModules = node_fs.existsSync(nodeModulesDir);
|
|
7772
|
-
if (hadNodeModules) node_fs.renameSync(nodeModulesDir, nodeModulesTmp);
|
|
7773
|
-
safeRmDir(installDashDir);
|
|
7774
|
-
node_fs.mkdirSync(installDashDir, { recursive: true });
|
|
7775
|
-
copyDirRecursive(dashboardAssetSrc, installDashDir);
|
|
7776
|
-
if (hadNodeModules && node_fs.existsSync(nodeModulesTmp)) node_fs.renameSync(nodeModulesTmp, nodeModulesDir);
|
|
7777
|
-
const dashConfigPath = node_path.join(installDir, "dashboard.json");
|
|
7778
|
-
if (!node_fs.existsSync(dashConfigPath)) node_fs.writeFileSync(dashConfigPath, JSON.stringify({ projectCwd: process.cwd() }, null, 2) + "\n");
|
|
7779
|
-
}
|
|
7780
|
-
const localDashboard = node_path.join(process.cwd(), ".claude", "dashboard", "server.js");
|
|
7781
|
-
const globalDashboard = node_path.join(node_os.homedir(), ".claude", "dashboard", "server.js");
|
|
7782
|
-
let serverPath = null;
|
|
7783
|
-
if (node_fs.existsSync(localDashboard)) serverPath = localDashboard;
|
|
7784
|
-
else if (node_fs.existsSync(globalDashboard)) serverPath = globalDashboard;
|
|
7785
|
-
if (!serverPath) {
|
|
7786
|
-
console.log(chalk.yellow("\n Dashboard not available.\n"));
|
|
7787
|
-
console.log(" Install MAXSIM first: " + chalk.cyan("npx maxsimcli@latest") + "\n");
|
|
7788
|
-
process.exit(0);
|
|
7789
|
-
}
|
|
7790
|
-
const forceNetwork = !!argv["network"];
|
|
7791
|
-
const dashboardDir = node_path.dirname(serverPath);
|
|
7792
|
-
const dashboardConfigPath = node_path.join(node_path.dirname(dashboardDir), "dashboard.json");
|
|
7793
|
-
let projectCwd = process.cwd();
|
|
7794
|
-
let networkMode = forceNetwork;
|
|
7795
|
-
if (node_fs.existsSync(dashboardConfigPath)) try {
|
|
7796
|
-
const config = JSON.parse(node_fs.readFileSync(dashboardConfigPath, "utf8"));
|
|
7797
|
-
if (config.projectCwd) projectCwd = config.projectCwd;
|
|
7798
|
-
if (!forceNetwork) networkMode = config.networkMode ?? false;
|
|
7799
|
-
} catch {}
|
|
7800
|
-
const dashDirForPty = node_path.dirname(serverPath);
|
|
7801
|
-
const ptyModulePath = node_path.join(dashDirForPty, "node_modules", "node-pty");
|
|
7802
|
-
if (!node_fs.existsSync(ptyModulePath)) {
|
|
7803
|
-
console.log(chalk.gray(" Installing node-pty for terminal support..."));
|
|
7804
|
-
try {
|
|
7805
|
-
const dashPkgPath = node_path.join(dashDirForPty, "package.json");
|
|
7806
|
-
if (!node_fs.existsSync(dashPkgPath)) node_fs.writeFileSync(dashPkgPath, "{\"private\":true}\n");
|
|
7807
|
-
execSyncDash("npm install node-pty --save-optional --no-audit --no-fund --loglevel=error", {
|
|
7808
|
-
cwd: dashDirForPty,
|
|
7809
|
-
stdio: "inherit",
|
|
7810
|
-
timeout: 12e4
|
|
7811
|
-
});
|
|
7812
|
-
} catch {
|
|
7813
|
-
console.warn(chalk.yellow(" node-pty installation failed — terminal will be unavailable."));
|
|
7814
|
-
}
|
|
7815
|
-
}
|
|
7816
|
-
console.log(chalk.blue("Starting dashboard..."));
|
|
7817
|
-
console.log(chalk.gray(` Project: ${projectCwd}`));
|
|
7818
|
-
console.log(chalk.gray(` Server: ${serverPath}`));
|
|
7819
|
-
if (networkMode) console.log(chalk.gray(" Network: enabled (local network access + QR code)"));
|
|
7820
|
-
console.log("");
|
|
7821
|
-
spawnDash(process.execPath, [serverPath], {
|
|
7822
|
-
cwd: dashboardDir,
|
|
7823
|
-
detached: true,
|
|
7824
|
-
stdio: "ignore",
|
|
7825
|
-
env: {
|
|
7826
|
-
...process.env,
|
|
7827
|
-
MAXSIM_PROJECT_CWD: projectCwd,
|
|
7828
|
-
MAXSIM_NETWORK_MODE: networkMode ? "1" : "0",
|
|
7829
|
-
NODE_ENV: "production"
|
|
7830
|
-
}
|
|
7831
|
-
}).unref();
|
|
7832
|
-
const POLL_INTERVAL_MS = 500;
|
|
7833
|
-
const POLL_TIMEOUT_MS = 2e4;
|
|
7834
|
-
const HEALTH_TIMEOUT_MS = 1e3;
|
|
7835
|
-
const DEFAULT_PORT = 3333;
|
|
7836
|
-
const PORT_RANGE_END = 3343;
|
|
7837
|
-
let foundUrl = null;
|
|
7838
|
-
const deadline = Date.now() + POLL_TIMEOUT_MS;
|
|
7839
|
-
while (Date.now() < deadline) {
|
|
7840
|
-
await new Promise((r) => setTimeout(r, POLL_INTERVAL_MS));
|
|
7841
|
-
for (let p = DEFAULT_PORT; p <= PORT_RANGE_END; p++) try {
|
|
7842
|
-
const controller = new AbortController();
|
|
7843
|
-
const timer = setTimeout(() => controller.abort(), HEALTH_TIMEOUT_MS);
|
|
7844
|
-
const res = await fetch(`http://localhost:${p}/api/health`, { signal: controller.signal });
|
|
7845
|
-
clearTimeout(timer);
|
|
7846
|
-
if (res.ok) {
|
|
7847
|
-
if ((await res.json()).status === "ok") {
|
|
7848
|
-
foundUrl = `http://localhost:${p}`;
|
|
7849
|
-
break;
|
|
7850
|
-
}
|
|
7851
|
-
}
|
|
7852
|
-
} catch {}
|
|
7853
|
-
if (foundUrl) break;
|
|
7854
|
-
}
|
|
7855
|
-
if (foundUrl) console.log(chalk.green(` Dashboard ready at ${foundUrl}`));
|
|
7856
|
-
else console.log(chalk.yellow("\n Dashboard did not respond after 20s. The server may still be starting — check http://localhost:3333"));
|
|
7857
|
-
process.exit(0);
|
|
7858
|
-
}
|
|
7859
|
-
|
|
7860
7697
|
//#endregion
|
|
7861
7698
|
//#region src/install/hooks.ts
|
|
7862
7699
|
/**
|
|
@@ -8318,6 +8155,7 @@ function uninstall(isGlobal, explicitConfigDir = null) {
|
|
|
8318
8155
|
|
|
8319
8156
|
//#endregion
|
|
8320
8157
|
//#region src/install/index.ts
|
|
8158
|
+
var import_lib = /* @__PURE__ */ __toESM(require_lib$1());
|
|
8321
8159
|
const argv = (0, import_minimist.default)(process.argv.slice(2), {
|
|
8322
8160
|
boolean: [
|
|
8323
8161
|
"global",
|
|
@@ -8529,32 +8367,6 @@ async function install(isGlobal) {
|
|
|
8529
8367
|
console.log(` ${chalk.green("✓")} Installed mcp-server.cjs`);
|
|
8530
8368
|
} else console.warn(` ${chalk.yellow("!")} mcp-server.cjs not found — MCP server not installed`);
|
|
8531
8369
|
installHookFiles(targetDir, isGlobal, failures);
|
|
8532
|
-
const dashboardSrc = node_path.resolve(__dirname, "assets", "dashboard");
|
|
8533
|
-
if (node_fs.existsSync(dashboardSrc)) {
|
|
8534
|
-
let networkMode = false;
|
|
8535
|
-
try {
|
|
8536
|
-
networkMode = await dist_default$1({
|
|
8537
|
-
message: "Allow dashboard to be accessible on your local network? (adds firewall rule, enables QR code)",
|
|
8538
|
-
default: false
|
|
8539
|
-
});
|
|
8540
|
-
} catch {}
|
|
8541
|
-
spinner = ora({
|
|
8542
|
-
text: "Installing dashboard...",
|
|
8543
|
-
color: "cyan"
|
|
8544
|
-
}).start();
|
|
8545
|
-
const dashboardDest = node_path.join(targetDir, "dashboard");
|
|
8546
|
-
safeRmDir(dashboardDest);
|
|
8547
|
-
copyDirRecursive(dashboardSrc, dashboardDest);
|
|
8548
|
-
const dashboardConfigDest = node_path.join(targetDir, "dashboard.json");
|
|
8549
|
-
const projectCwd = isGlobal ? targetDir : process.cwd();
|
|
8550
|
-
node_fs.writeFileSync(dashboardConfigDest, JSON.stringify({
|
|
8551
|
-
projectCwd,
|
|
8552
|
-
networkMode
|
|
8553
|
-
}, null, 2) + "\n");
|
|
8554
|
-
if (node_fs.existsSync(node_path.join(dashboardDest, "server.js"))) spinner.succeed(chalk.green("✓") + " Installed dashboard");
|
|
8555
|
-
else spinner.succeed(chalk.green("✓") + " Installed dashboard (server.js not found in bundle)");
|
|
8556
|
-
if (networkMode) applyFirewallRule(3333);
|
|
8557
|
-
}
|
|
8558
8370
|
const mcpJsonPath = isGlobal ? node_path.join(targetDir, "..", ".mcp.json") : node_path.join(process.cwd(), ".mcp.json");
|
|
8559
8371
|
let mcpConfig = {};
|
|
8560
8372
|
let skipMcpConfig = false;
|
|
@@ -8654,13 +8466,9 @@ async function installForClaude(isGlobal, isInteractive) {
|
|
|
8654
8466
|
}
|
|
8655
8467
|
const subcommand = argv._[0];
|
|
8656
8468
|
(async () => {
|
|
8657
|
-
if (subcommand === "dashboard") {
|
|
8658
|
-
await runDashboardSubcommand(argv);
|
|
8659
|
-
return;
|
|
8660
|
-
}
|
|
8661
8469
|
if (subcommand === "skill-list" || subcommand === "skill-install" || subcommand === "skill-update") {
|
|
8662
|
-
const { cmdSkillList, cmdSkillInstall, cmdSkillUpdate } = await Promise.resolve().then(() => require("./skills-
|
|
8663
|
-
const { CliOutput, writeOutput, CliError } = await Promise.resolve().then(() => require("./core-
|
|
8470
|
+
const { cmdSkillList, cmdSkillInstall, cmdSkillUpdate } = await Promise.resolve().then(() => require("./skills-CjFWZIGM.cjs"));
|
|
8471
|
+
const { CliOutput, writeOutput, CliError } = await Promise.resolve().then(() => require("./core-D5zUr9cb.cjs"));
|
|
8664
8472
|
const cwd = process.cwd();
|
|
8665
8473
|
try {
|
|
8666
8474
|
if (subcommand === "skill-list") cmdSkillList(cwd, false);
|