claudemesh-cli 1.2.0 → 1.2.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/entrypoints/cli.js
CHANGED
|
@@ -88,7 +88,7 @@ __export(exports_urls, {
|
|
|
88
88
|
VERSION: () => VERSION,
|
|
89
89
|
URLS: () => URLS
|
|
90
90
|
});
|
|
91
|
-
var URLS, VERSION = "1.2.
|
|
91
|
+
var URLS, VERSION = "1.2.1", env;
|
|
92
92
|
var init_urls = __esm(() => {
|
|
93
93
|
URLS = {
|
|
94
94
|
BROKER: process.env.CLAUDEMESH_BROKER_URL ?? "wss://ic.claudemesh.com/ws",
|
|
@@ -7570,16 +7570,65 @@ function bunAvailable() {
|
|
|
7570
7570
|
const res = platform5() === "win32" ? spawnSync3("where", ["bun"]) : spawnSync3("sh", ["-c", "command -v bun"]);
|
|
7571
7571
|
return res.status === 0;
|
|
7572
7572
|
}
|
|
7573
|
+
function isBundledFile(p) {
|
|
7574
|
+
return /[/\\]dist[/\\]/.test(p);
|
|
7575
|
+
}
|
|
7573
7576
|
function resolveEntry() {
|
|
7574
7577
|
const here = fileURLToPath(import.meta.url);
|
|
7575
|
-
if (
|
|
7578
|
+
if (isBundledFile(here))
|
|
7576
7579
|
return here;
|
|
7577
|
-
}
|
|
7578
7580
|
return resolve(dirname2(here), "..", "index.ts");
|
|
7579
7581
|
}
|
|
7582
|
+
function resolveBundledSkillsDir() {
|
|
7583
|
+
const here = fileURLToPath(import.meta.url);
|
|
7584
|
+
const pkgRoot = resolve(dirname2(here), "..", "..");
|
|
7585
|
+
const skillsDir = join5(pkgRoot, "skills");
|
|
7586
|
+
if (existsSync6(skillsDir))
|
|
7587
|
+
return skillsDir;
|
|
7588
|
+
return null;
|
|
7589
|
+
}
|
|
7590
|
+
function installSkills() {
|
|
7591
|
+
const src = resolveBundledSkillsDir();
|
|
7592
|
+
if (!src)
|
|
7593
|
+
return [];
|
|
7594
|
+
const fs = __require("node:fs");
|
|
7595
|
+
const installed = [];
|
|
7596
|
+
for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
|
|
7597
|
+
if (!entry.isDirectory())
|
|
7598
|
+
continue;
|
|
7599
|
+
const srcDir = join5(src, entry.name);
|
|
7600
|
+
const dstDir = join5(CLAUDE_SKILLS_ROOT, entry.name);
|
|
7601
|
+
mkdirSync3(dstDir, { recursive: true });
|
|
7602
|
+
for (const file of fs.readdirSync(srcDir, { withFileTypes: true })) {
|
|
7603
|
+
if (!file.isFile())
|
|
7604
|
+
continue;
|
|
7605
|
+
copyFileSync(join5(srcDir, file.name), join5(dstDir, file.name));
|
|
7606
|
+
}
|
|
7607
|
+
installed.push(entry.name);
|
|
7608
|
+
}
|
|
7609
|
+
return installed;
|
|
7610
|
+
}
|
|
7611
|
+
function uninstallSkills() {
|
|
7612
|
+
const src = resolveBundledSkillsDir();
|
|
7613
|
+
if (!src)
|
|
7614
|
+
return [];
|
|
7615
|
+
const fs = __require("node:fs");
|
|
7616
|
+
const removed = [];
|
|
7617
|
+
for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
|
|
7618
|
+
if (!entry.isDirectory())
|
|
7619
|
+
continue;
|
|
7620
|
+
const dstDir = join5(CLAUDE_SKILLS_ROOT, entry.name);
|
|
7621
|
+
if (existsSync6(dstDir)) {
|
|
7622
|
+
try {
|
|
7623
|
+
fs.rmSync(dstDir, { recursive: true, force: true });
|
|
7624
|
+
removed.push(entry.name);
|
|
7625
|
+
} catch {}
|
|
7626
|
+
}
|
|
7627
|
+
}
|
|
7628
|
+
return removed;
|
|
7629
|
+
}
|
|
7580
7630
|
function buildMcpEntry(entryPath) {
|
|
7581
|
-
|
|
7582
|
-
if (isBundled) {
|
|
7631
|
+
if (isBundledFile(entryPath)) {
|
|
7583
7632
|
return {
|
|
7584
7633
|
command: "claudemesh",
|
|
7585
7634
|
args: ["mcp"]
|
|
@@ -7696,11 +7745,12 @@ function installStatusLine() {
|
|
|
7696
7745
|
}
|
|
7697
7746
|
function runInstall(args = []) {
|
|
7698
7747
|
const skipHooks = args.includes("--no-hooks");
|
|
7748
|
+
const skipSkill = args.includes("--no-skill");
|
|
7699
7749
|
const wantStatusLine = args.includes("--status-line");
|
|
7700
7750
|
render.section("claudemesh install");
|
|
7701
7751
|
const entry = resolveEntry();
|
|
7702
|
-
const
|
|
7703
|
-
if (!
|
|
7752
|
+
const bundled = isBundledFile(entry);
|
|
7753
|
+
if (!bundled && !bunAvailable()) {
|
|
7704
7754
|
render.err("`bun` is not on PATH.", "Install Bun first: https://bun.com");
|
|
7705
7755
|
process.exit(1);
|
|
7706
7756
|
}
|
|
@@ -7750,6 +7800,19 @@ function runInstall(args = []) {
|
|
|
7750
7800
|
} else {
|
|
7751
7801
|
render.info(dim("· Hooks skipped (--no-hooks)"));
|
|
7752
7802
|
}
|
|
7803
|
+
if (!skipSkill) {
|
|
7804
|
+
try {
|
|
7805
|
+
const installed = installSkills();
|
|
7806
|
+
if (installed.length > 0) {
|
|
7807
|
+
render.ok(`Claude skill${installed.length === 1 ? "" : "s"} installed`, installed.join(", "));
|
|
7808
|
+
render.info(dim(` ${join5(CLAUDE_SKILLS_ROOT, installed[0])}/SKILL.md`));
|
|
7809
|
+
}
|
|
7810
|
+
} catch (e) {
|
|
7811
|
+
render.warn(`skill install failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
7812
|
+
}
|
|
7813
|
+
} else {
|
|
7814
|
+
render.info(dim("· Skill install skipped (--no-skill)"));
|
|
7815
|
+
}
|
|
7753
7816
|
if (wantStatusLine) {
|
|
7754
7817
|
try {
|
|
7755
7818
|
const { installed } = installStatusLine();
|
|
@@ -7812,16 +7875,27 @@ function runUninstall() {
|
|
|
7812
7875
|
} catch (e) {
|
|
7813
7876
|
render.warn(`hook removal failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
7814
7877
|
}
|
|
7878
|
+
try {
|
|
7879
|
+
const removed = uninstallSkills();
|
|
7880
|
+
if (removed.length > 0) {
|
|
7881
|
+
render.ok(`Skill${removed.length === 1 ? "" : "s"} removed`, removed.join(", "));
|
|
7882
|
+
} else {
|
|
7883
|
+
render.info(dim("· No claudemesh skills to remove"));
|
|
7884
|
+
}
|
|
7885
|
+
} catch (e) {
|
|
7886
|
+
render.warn(`skill removal failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
7887
|
+
}
|
|
7815
7888
|
render.blank();
|
|
7816
7889
|
render.info("Restart Claude Code to drop the MCP connection + hooks.");
|
|
7817
7890
|
}
|
|
7818
|
-
var MCP_NAME = "claudemesh", CLAUDE_CONFIG, CLAUDE_SETTINGS, HOOK_COMMAND_STOP = "claudemesh hook idle", HOOK_COMMAND_USER_PROMPT = "claudemesh hook working", HOOK_MARKER = "claudemesh hook ", CLAUDEMESH_TOOLS;
|
|
7891
|
+
var MCP_NAME = "claudemesh", CLAUDE_CONFIG, CLAUDE_SETTINGS, HOOK_COMMAND_STOP = "claudemesh hook idle", HOOK_COMMAND_USER_PROMPT = "claudemesh hook working", HOOK_MARKER = "claudemesh hook ", CLAUDE_SKILLS_ROOT, CLAUDEMESH_TOOLS;
|
|
7819
7892
|
var init_install = __esm(() => {
|
|
7820
7893
|
init_facade();
|
|
7821
7894
|
init_render();
|
|
7822
7895
|
init_styles();
|
|
7823
7896
|
CLAUDE_CONFIG = join5(homedir5(), ".claude.json");
|
|
7824
7897
|
CLAUDE_SETTINGS = join5(homedir5(), ".claude", "settings.json");
|
|
7898
|
+
CLAUDE_SKILLS_ROOT = join5(homedir5(), ".claude", "skills");
|
|
7825
7899
|
CLAUDEMESH_TOOLS = [
|
|
7826
7900
|
"mcp__claudemesh__cancel_scheduled",
|
|
7827
7901
|
"mcp__claudemesh__check_messages",
|
|
@@ -7876,7 +7950,16 @@ var exports_uninstall = {};
|
|
|
7876
7950
|
__export(exports_uninstall, {
|
|
7877
7951
|
uninstall: () => uninstall
|
|
7878
7952
|
});
|
|
7879
|
-
import { readFileSync as readFileSync5, writeFileSync as writeFileSync6, existsSync as existsSync7 } from "node:fs";
|
|
7953
|
+
import { readFileSync as readFileSync5, writeFileSync as writeFileSync6, existsSync as existsSync7, rmSync as rmSync2, readdirSync as readdirSync2 } from "node:fs";
|
|
7954
|
+
import { join as join6, dirname as dirname3 } from "node:path";
|
|
7955
|
+
import { homedir as homedir6 } from "node:os";
|
|
7956
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
7957
|
+
function bundledSkillsDir() {
|
|
7958
|
+
const here = fileURLToPath2(import.meta.url);
|
|
7959
|
+
const pkgRoot = join6(dirname3(here), "..", "..");
|
|
7960
|
+
const skillsDir = join6(pkgRoot, "skills");
|
|
7961
|
+
return existsSync7(skillsDir) ? skillsDir : null;
|
|
7962
|
+
}
|
|
7880
7963
|
async function uninstall() {
|
|
7881
7964
|
let removed = 0;
|
|
7882
7965
|
if (existsSync7(PATHS.CLAUDE_JSON)) {
|
|
@@ -7924,16 +8007,39 @@ async function uninstall() {
|
|
|
7924
8007
|
}
|
|
7925
8008
|
} catch {}
|
|
7926
8009
|
}
|
|
8010
|
+
const src = bundledSkillsDir();
|
|
8011
|
+
if (src) {
|
|
8012
|
+
const removedSkills = [];
|
|
8013
|
+
try {
|
|
8014
|
+
for (const entry of readdirSync2(src, { withFileTypes: true })) {
|
|
8015
|
+
if (!entry.isDirectory())
|
|
8016
|
+
continue;
|
|
8017
|
+
const dst = join6(CLAUDE_SKILLS_ROOT2, entry.name);
|
|
8018
|
+
if (existsSync7(dst)) {
|
|
8019
|
+
try {
|
|
8020
|
+
rmSync2(dst, { recursive: true, force: true });
|
|
8021
|
+
removedSkills.push(entry.name);
|
|
8022
|
+
} catch {}
|
|
8023
|
+
}
|
|
8024
|
+
}
|
|
8025
|
+
if (removedSkills.length > 0) {
|
|
8026
|
+
render.ok(`removed Claude skill${removedSkills.length === 1 ? "" : "s"}`, removedSkills.join(", "));
|
|
8027
|
+
removed++;
|
|
8028
|
+
}
|
|
8029
|
+
} catch {}
|
|
8030
|
+
}
|
|
7927
8031
|
if (removed === 0) {
|
|
7928
8032
|
render.info(dim("Nothing to remove — claudemesh was not installed."));
|
|
7929
8033
|
}
|
|
7930
8034
|
return EXIT.SUCCESS;
|
|
7931
8035
|
}
|
|
8036
|
+
var CLAUDE_SKILLS_ROOT2;
|
|
7932
8037
|
var init_uninstall = __esm(() => {
|
|
7933
8038
|
init_paths();
|
|
7934
8039
|
init_render();
|
|
7935
8040
|
init_styles();
|
|
7936
8041
|
init_exit_codes();
|
|
8042
|
+
CLAUDE_SKILLS_ROOT2 = join6(homedir6(), ".claude", "skills");
|
|
7937
8043
|
});
|
|
7938
8044
|
|
|
7939
8045
|
// src/commands/doctor.ts
|
|
@@ -7942,8 +8048,8 @@ __export(exports_doctor, {
|
|
|
7942
8048
|
runDoctor: () => runDoctor
|
|
7943
8049
|
});
|
|
7944
8050
|
import { existsSync as existsSync8, readFileSync as readFileSync6, statSync as statSync2 } from "node:fs";
|
|
7945
|
-
import { homedir as
|
|
7946
|
-
import { join as
|
|
8051
|
+
import { homedir as homedir7, platform as platform6 } from "node:os";
|
|
8052
|
+
import { join as join7 } from "node:path";
|
|
7947
8053
|
import { spawnSync as spawnSync4 } from "node:child_process";
|
|
7948
8054
|
function checkNode() {
|
|
7949
8055
|
const major = Number(process.versions.node.split(".")[0]);
|
|
@@ -7967,7 +8073,7 @@ function checkClaudeOnPath() {
|
|
|
7967
8073
|
};
|
|
7968
8074
|
}
|
|
7969
8075
|
function checkMcpRegistered() {
|
|
7970
|
-
const claudeConfig =
|
|
8076
|
+
const claudeConfig = join7(homedir7(), ".claude.json");
|
|
7971
8077
|
if (!existsSync8(claudeConfig)) {
|
|
7972
8078
|
return {
|
|
7973
8079
|
name: "claudemesh MCP registered in ~/.claude.json",
|
|
@@ -7993,7 +8099,7 @@ function checkMcpRegistered() {
|
|
|
7993
8099
|
}
|
|
7994
8100
|
}
|
|
7995
8101
|
function checkHooksRegistered() {
|
|
7996
|
-
const settings =
|
|
8102
|
+
const settings = join7(homedir7(), ".claude", "settings.json");
|
|
7997
8103
|
if (!existsSync8(settings)) {
|
|
7998
8104
|
return {
|
|
7999
8105
|
name: "Status hooks registered in ~/.claude/settings.json",
|
|
@@ -8927,18 +9033,18 @@ var exports_url_handler = {};
|
|
|
8927
9033
|
__export(exports_url_handler, {
|
|
8928
9034
|
runUrlHandler: () => runUrlHandler
|
|
8929
9035
|
});
|
|
8930
|
-
import { platform as platform7, homedir as
|
|
8931
|
-
import { existsSync as existsSync14, mkdirSync as mkdirSync4, writeFileSync as writeFileSync7, rmSync as
|
|
8932
|
-
import { join as
|
|
9036
|
+
import { platform as platform7, homedir as homedir8 } from "node:os";
|
|
9037
|
+
import { existsSync as existsSync14, mkdirSync as mkdirSync4, writeFileSync as writeFileSync7, rmSync as rmSync3, chmodSync as chmodSync4 } from "node:fs";
|
|
9038
|
+
import { join as join8 } from "node:path";
|
|
8933
9039
|
import { spawnSync as spawnSync5 } from "node:child_process";
|
|
8934
9040
|
function resolveClaudemeshBin() {
|
|
8935
9041
|
return process.argv[1] ?? "claudemesh";
|
|
8936
9042
|
}
|
|
8937
9043
|
function installDarwin() {
|
|
8938
9044
|
const binPath = resolveClaudemeshBin();
|
|
8939
|
-
const appDir =
|
|
8940
|
-
const contents =
|
|
8941
|
-
const macOS =
|
|
9045
|
+
const appDir = join8(homedir8(), "Library", "Application Support", "claudemesh", "ClaudemeshHandler.app");
|
|
9046
|
+
const contents = join8(appDir, "Contents");
|
|
9047
|
+
const macOS = join8(contents, "MacOS");
|
|
8942
9048
|
mkdirSync4(macOS, { recursive: true });
|
|
8943
9049
|
const plist = `<?xml version="1.0" encoding="UTF-8"?>
|
|
8944
9050
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
@@ -8962,7 +9068,7 @@ function installDarwin() {
|
|
|
8962
9068
|
</array>
|
|
8963
9069
|
</dict>
|
|
8964
9070
|
</plist>`;
|
|
8965
|
-
writeFileSync7(
|
|
9071
|
+
writeFileSync7(join8(contents, "Info.plist"), plist);
|
|
8966
9072
|
const shim = `#!/bin/sh
|
|
8967
9073
|
URL="$1"
|
|
8968
9074
|
CODE=\${URL#claudemesh://}
|
|
@@ -8976,7 +9082,7 @@ tell application "Terminal"
|
|
|
8976
9082
|
end tell
|
|
8977
9083
|
EOF
|
|
8978
9084
|
`;
|
|
8979
|
-
const shimPath =
|
|
9085
|
+
const shimPath = join8(macOS, "open-url");
|
|
8980
9086
|
writeFileSync7(shimPath, shim);
|
|
8981
9087
|
chmodSync4(shimPath, 493);
|
|
8982
9088
|
const lsreg = spawnSync5("/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister", ["-f", appDir], { encoding: "utf-8" });
|
|
@@ -8988,7 +9094,7 @@ EOF
|
|
|
8988
9094
|
}
|
|
8989
9095
|
function installLinux() {
|
|
8990
9096
|
const binPath = resolveClaudemeshBin();
|
|
8991
|
-
const appsDir =
|
|
9097
|
+
const appsDir = join8(homedir8(), ".local", "share", "applications");
|
|
8992
9098
|
mkdirSync4(appsDir, { recursive: true });
|
|
8993
9099
|
const desktop = `[Desktop Entry]
|
|
8994
9100
|
Type=Application
|
|
@@ -9000,7 +9106,7 @@ Terminal=true
|
|
|
9000
9106
|
MimeType=x-scheme-handler/claudemesh;
|
|
9001
9107
|
NoDisplay=true
|
|
9002
9108
|
`;
|
|
9003
|
-
const desktopPath =
|
|
9109
|
+
const desktopPath = join8(appsDir, "claudemesh.desktop");
|
|
9004
9110
|
writeFileSync7(desktopPath, desktop);
|
|
9005
9111
|
const xdg1 = spawnSync5("xdg-mime", ["default", "claudemesh.desktop", "x-scheme-handler/claudemesh"], { encoding: "utf-8" });
|
|
9006
9112
|
if (xdg1.status !== 0) {
|
|
@@ -9023,7 +9129,7 @@ function installWindows() {
|
|
|
9023
9129
|
`[HKEY_CURRENT_USER\\Software\\Classes\\claudemesh\\shell\\open\\command]`,
|
|
9024
9130
|
`@="\\"${binPath.replace(/\\/g, "\\\\")}\\" \\"%1\\""`
|
|
9025
9131
|
];
|
|
9026
|
-
const regPath =
|
|
9132
|
+
const regPath = join8(homedir8(), "claudemesh-handler.reg");
|
|
9027
9133
|
writeFileSync7(regPath, lines.join(`\r
|
|
9028
9134
|
`));
|
|
9029
9135
|
const res = spawnSync5("reg.exe", ["import", regPath], { encoding: "utf-8" });
|
|
@@ -9035,16 +9141,16 @@ function installWindows() {
|
|
|
9035
9141
|
return EXIT.SUCCESS;
|
|
9036
9142
|
}
|
|
9037
9143
|
function uninstallDarwin() {
|
|
9038
|
-
const appDir =
|
|
9144
|
+
const appDir = join8(homedir8(), "Library", "Application Support", "claudemesh", "ClaudemeshHandler.app");
|
|
9039
9145
|
if (existsSync14(appDir))
|
|
9040
|
-
|
|
9146
|
+
rmSync3(appDir, { recursive: true, force: true });
|
|
9041
9147
|
render.ok("removed claudemesh:// handler on macOS");
|
|
9042
9148
|
return EXIT.SUCCESS;
|
|
9043
9149
|
}
|
|
9044
9150
|
function uninstallLinux() {
|
|
9045
|
-
const desktopPath =
|
|
9151
|
+
const desktopPath = join8(homedir8(), ".local", "share", "applications", "claudemesh.desktop");
|
|
9046
9152
|
if (existsSync14(desktopPath))
|
|
9047
|
-
|
|
9153
|
+
rmSync3(desktopPath, { force: true });
|
|
9048
9154
|
render.ok("removed claudemesh:// handler on Linux");
|
|
9049
9155
|
return EXIT.SUCCESS;
|
|
9050
9156
|
}
|
|
@@ -9089,8 +9195,8 @@ __export(exports_status_line, {
|
|
|
9089
9195
|
runStatusLine: () => runStatusLine
|
|
9090
9196
|
});
|
|
9091
9197
|
import { existsSync as existsSync15, readFileSync as readFileSync10 } from "node:fs";
|
|
9092
|
-
import { join as
|
|
9093
|
-
import { homedir as
|
|
9198
|
+
import { join as join9 } from "node:path";
|
|
9199
|
+
import { homedir as homedir9 } from "node:os";
|
|
9094
9200
|
async function runStatusLine() {
|
|
9095
9201
|
try {
|
|
9096
9202
|
const config = readConfig();
|
|
@@ -9098,7 +9204,7 @@ async function runStatusLine() {
|
|
|
9098
9204
|
process.stdout.write("◇ claudemesh (not joined)");
|
|
9099
9205
|
return EXIT.SUCCESS;
|
|
9100
9206
|
}
|
|
9101
|
-
const cachePath =
|
|
9207
|
+
const cachePath = join9(homedir9(), ".claudemesh", "peer-cache.json");
|
|
9102
9208
|
let cache = {};
|
|
9103
9209
|
if (existsSync15(cachePath)) {
|
|
9104
9210
|
try {
|
|
@@ -9258,7 +9364,7 @@ __export(exports_upgrade, {
|
|
|
9258
9364
|
});
|
|
9259
9365
|
import { spawnSync as spawnSync6 } from "node:child_process";
|
|
9260
9366
|
import { existsSync as existsSync17 } from "node:fs";
|
|
9261
|
-
import { dirname as
|
|
9367
|
+
import { dirname as dirname4, join as join10, resolve as resolve2 } from "node:path";
|
|
9262
9368
|
async function latestVersion() {
|
|
9263
9369
|
try {
|
|
9264
9370
|
const res = await fetch(URLS.NPM_REGISTRY, { signal: AbortSignal.timeout(8000) });
|
|
@@ -9271,14 +9377,14 @@ async function latestVersion() {
|
|
|
9271
9377
|
}
|
|
9272
9378
|
}
|
|
9273
9379
|
function findNpm() {
|
|
9274
|
-
const portable =
|
|
9380
|
+
const portable = join10(process.env.HOME ?? "", ".claudemesh", "node", "bin", "npm");
|
|
9275
9381
|
if (existsSync17(portable)) {
|
|
9276
|
-
return { npm: portable, prefix:
|
|
9382
|
+
return { npm: portable, prefix: join10(process.env.HOME ?? "", ".claudemesh") };
|
|
9277
9383
|
}
|
|
9278
9384
|
let cur = resolve2(process.argv[1] ?? ".");
|
|
9279
9385
|
for (let i = 0;i < 6; i++) {
|
|
9280
|
-
cur =
|
|
9281
|
-
const candidate =
|
|
9386
|
+
cur = dirname4(cur);
|
|
9387
|
+
const candidate = join10(cur, "bin", "npm");
|
|
9282
9388
|
if (existsSync17(candidate))
|
|
9283
9389
|
return { npm: candidate };
|
|
9284
9390
|
}
|
|
@@ -9342,8 +9448,8 @@ __export(exports_grants, {
|
|
|
9342
9448
|
isAllowed: () => isAllowed
|
|
9343
9449
|
});
|
|
9344
9450
|
import { existsSync as existsSync18, mkdirSync as mkdirSync5, readFileSync as readFileSync12, writeFileSync as writeFileSync9 } from "node:fs";
|
|
9345
|
-
import { homedir as
|
|
9346
|
-
import { join as
|
|
9451
|
+
import { homedir as homedir10 } from "node:os";
|
|
9452
|
+
import { join as join11 } from "node:path";
|
|
9347
9453
|
async function syncToBroker(meshSlug, grants) {
|
|
9348
9454
|
const auth = getStoredToken();
|
|
9349
9455
|
if (!auth)
|
|
@@ -9370,7 +9476,7 @@ function readGrants() {
|
|
|
9370
9476
|
}
|
|
9371
9477
|
}
|
|
9372
9478
|
function writeGrants(g) {
|
|
9373
|
-
const dir =
|
|
9479
|
+
const dir = join11(homedir10(), ".claudemesh");
|
|
9374
9480
|
if (!existsSync18(dir))
|
|
9375
9481
|
mkdirSync5(dir, { recursive: true });
|
|
9376
9482
|
writeFileSync9(GRANT_FILE, JSON.stringify(g, null, 2), { mode: 384 });
|
|
@@ -9529,7 +9635,7 @@ var init_grants = __esm(() => {
|
|
|
9529
9635
|
BROKER_HTTP7 = URLS.BROKER.replace("wss://", "https://").replace("ws://", "http://").replace("/ws", "");
|
|
9530
9636
|
ALL_CAPS = ["read", "dm", "broadcast", "state-read", "state-write", "file-read"];
|
|
9531
9637
|
DEFAULT_CAPS = ["read", "dm", "broadcast", "state-read"];
|
|
9532
|
-
GRANT_FILE =
|
|
9638
|
+
GRANT_FILE = join11(homedir10(), ".claudemesh", "grants.json");
|
|
9533
9639
|
});
|
|
9534
9640
|
|
|
9535
9641
|
// src/mcp/tools/definitions.ts
|
|
@@ -11181,8 +11287,8 @@ ${peerLines.join(`
|
|
|
11181
11287
|
try {
|
|
11182
11288
|
const { writeFileSync: writeFileSync10, mkdirSync: mkdirSync7, existsSync: existsSync20 } = await import("node:fs");
|
|
11183
11289
|
const { join: joinPath } = await import("node:path");
|
|
11184
|
-
const { homedir:
|
|
11185
|
-
const dir = joinPath(
|
|
11290
|
+
const { homedir: homedir11 } = await import("node:os");
|
|
11291
|
+
const dir = joinPath(homedir11(), ".claudemesh");
|
|
11186
11292
|
if (!existsSync20(dir))
|
|
11187
11293
|
mkdirSync7(dir, { recursive: true });
|
|
11188
11294
|
writeFileSync10(joinPath(dir, "peer-cache.json"), JSON.stringify(statusCache));
|
|
@@ -11437,7 +11543,7 @@ ${lines.join(`
|
|
|
11437
11543
|
const { encryptFile: encryptFile2, sealKeyForPeer: sealKeyForPeer2 } = await Promise.resolve().then(() => (init_file_crypto(), exports_file_crypto));
|
|
11438
11544
|
const { readFileSync: readFileSync13, writeFileSync: writeFileSync10, mkdtempSync: mkdtempSync2, unlinkSync: unlinkSync3, rmdirSync } = await import("node:fs");
|
|
11439
11545
|
const { tmpdir: tmpdir2 } = await import("node:os");
|
|
11440
|
-
const { join:
|
|
11546
|
+
const { join: join12, basename } = await import("node:path");
|
|
11441
11547
|
const peers = await client.listPeers();
|
|
11442
11548
|
const targetPeer = peers.find((p) => p.pubkey === fileTo || p.displayName === fileTo);
|
|
11443
11549
|
if (!targetPeer) {
|
|
@@ -11460,8 +11566,8 @@ ${lines.join(`
|
|
|
11460
11566
|
combined.set(ciphertext, nonceBytes.length);
|
|
11461
11567
|
const rawName = fileName ?? basename(filePath);
|
|
11462
11568
|
const baseName = basename(rawName).replace(/[^a-zA-Z0-9._-]/g, "_").slice(0, 255);
|
|
11463
|
-
const tmpDir = mkdtempSync2(
|
|
11464
|
-
const tmpPath =
|
|
11569
|
+
const tmpDir = mkdtempSync2(join12(tmpdir2(), "cm-"));
|
|
11570
|
+
const tmpPath = join12(tmpDir, baseName);
|
|
11465
11571
|
writeFileSync10(tmpPath, combined);
|
|
11466
11572
|
try {
|
|
11467
11573
|
const fileId = await client.uploadFile(tmpPath, client.meshId, client.meshSlug, {
|
|
@@ -11538,8 +11644,8 @@ ${lines.join(`
|
|
|
11538
11644
|
if (!plaintext)
|
|
11539
11645
|
return text(genericErr, true);
|
|
11540
11646
|
const { writeFileSync: writeFileSync11, mkdirSync: mkdirSync8 } = await import("node:fs");
|
|
11541
|
-
const { dirname:
|
|
11542
|
-
mkdirSync8(
|
|
11647
|
+
const { dirname: dirname6 } = await import("node:path");
|
|
11648
|
+
mkdirSync8(dirname6(save_to), { recursive: true });
|
|
11543
11649
|
writeFileSync11(save_to, plaintext);
|
|
11544
11650
|
return text(`Downloaded and decrypted: ${result.name} → ${save_to}`);
|
|
11545
11651
|
}
|
|
@@ -11551,8 +11657,8 @@ ${lines.join(`
|
|
|
11551
11657
|
if (!res.ok)
|
|
11552
11658
|
return text(`get_file: download failed (${res.status})`, true);
|
|
11553
11659
|
const { writeFileSync: writeFileSync10, mkdirSync: mkdirSync7 } = await import("node:fs");
|
|
11554
|
-
const { dirname:
|
|
11555
|
-
mkdirSync7(
|
|
11660
|
+
const { dirname: dirname5 } = await import("node:path");
|
|
11661
|
+
mkdirSync7(dirname5(save_to), { recursive: true });
|
|
11556
11662
|
writeFileSync10(save_to, Buffer.from(await res.arrayBuffer()));
|
|
11557
11663
|
return text(`Downloaded: ${result.name} → ${save_to}`);
|
|
11558
11664
|
}
|
|
@@ -13634,4 +13740,4 @@ main().catch((err) => {
|
|
|
13634
13740
|
process.exit(EXIT.INTERNAL_ERROR);
|
|
13635
13741
|
});
|
|
13636
13742
|
|
|
13637
|
-
//# debugId=
|
|
13743
|
+
//# debugId=E126BD4968D2FCDF64756E2164756E21
|