@kwonye/mcpx 0.1.74 → 0.1.77

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.
Files changed (47) hide show
  1. package/dist/adapters/claude-desktop.d.ts.map +1 -1
  2. package/dist/adapters/cline.d.ts.map +1 -1
  3. package/dist/adapters/cursor.d.ts.map +1 -1
  4. package/dist/adapters/kiro.d.ts +2 -1
  5. package/dist/adapters/kiro.d.ts.map +1 -1
  6. package/dist/adapters/qwen.d.ts +2 -1
  7. package/dist/adapters/qwen.d.ts.map +1 -1
  8. package/dist/adapters/utils/index.d.ts.map +1 -1
  9. package/dist/adapters/vscode.d.ts.map +1 -1
  10. package/dist/cli-7bsf6akp.js +202 -0
  11. package/dist/{cli-33pamqwn.js → cli-f16kphtq.js} +591 -456
  12. package/dist/cli-fsf33sgp.js +105 -0
  13. package/dist/{cli-ezvj44tr.js → cli-htm5cf82.js} +590 -455
  14. package/dist/{cli-q8de7zb0.js → cli-s4gspqdf.js} +4 -1
  15. package/dist/cli-s4py8ckf.js +187 -0
  16. package/dist/cli.d.ts.map +1 -1
  17. package/dist/cli.js +506 -85
  18. package/dist/config-kayej21q.js +20 -0
  19. package/dist/core/auth-probe.d.ts.map +1 -1
  20. package/dist/core/config.d.ts +19 -1
  21. package/dist/core/config.d.ts.map +1 -1
  22. package/dist/core/daemon.d.ts.map +1 -1
  23. package/dist/core/index.d.ts +5 -2
  24. package/dist/core/index.d.ts.map +1 -1
  25. package/dist/core/index.js +44 -12
  26. package/dist/core/paths.d.ts +3 -0
  27. package/dist/core/paths.d.ts.map +1 -1
  28. package/dist/core/proxy.d.ts +2 -0
  29. package/dist/core/proxy.d.ts.map +1 -0
  30. package/dist/core/registry-client.d.ts +76 -0
  31. package/dist/core/registry-client.d.ts.map +1 -0
  32. package/dist/core/registry.d.ts +2 -0
  33. package/dist/core/registry.d.ts.map +1 -1
  34. package/dist/core/secrets.d.ts.map +1 -1
  35. package/dist/core/skills.d.ts +6 -0
  36. package/dist/core/skills.d.ts.map +1 -0
  37. package/dist/core/status.d.ts +6 -2
  38. package/dist/core/status.d.ts.map +1 -1
  39. package/dist/core/sync.d.ts.map +1 -1
  40. package/dist/gateway/server.d.ts +17 -0
  41. package/dist/gateway/server.d.ts.map +1 -1
  42. package/dist/registry-1s14wd58.js +24 -0
  43. package/dist/types.d.ts +17 -0
  44. package/dist/types.d.ts.map +1 -1
  45. package/dist/types.js +1 -1
  46. package/dist/version.d.ts +1 -1
  47. package/package.json +2 -1
@@ -0,0 +1,105 @@
1
+ // src/core/paths.ts
2
+ import os from "node:os";
3
+ import path from "node:path";
4
+ import fs from "node:fs";
5
+ function envOrDefault(value, fallback) {
6
+ if (value && value.trim().length > 0) {
7
+ return value;
8
+ }
9
+ return fallback;
10
+ }
11
+ function homeDir() {
12
+ return process.env.HOME ?? os.homedir();
13
+ }
14
+ function getConfigRoot() {
15
+ return envOrDefault(process.env.MCPX_CONFIG_HOME ?? process.env.XDG_CONFIG_HOME, path.join(homeDir(), ".config"));
16
+ }
17
+ function getDataRoot() {
18
+ return envOrDefault(process.env.MCPX_DATA_HOME ?? process.env.XDG_DATA_HOME, path.join(homeDir(), ".local", "share"));
19
+ }
20
+ function getStateRoot() {
21
+ return envOrDefault(process.env.MCPX_STATE_HOME ?? process.env.XDG_STATE_HOME, path.join(homeDir(), ".local", "state"));
22
+ }
23
+ function getConfigPath() {
24
+ return path.join(getConfigRoot(), "mcpx", "config.json");
25
+ }
26
+ function getSkillsDir() {
27
+ return path.join(getConfigRoot(), "mcpx", "skills");
28
+ }
29
+ function getManagedIndexPath() {
30
+ return path.join(getDataRoot(), "mcpx", "managed-index.json");
31
+ }
32
+ function getSecretNamesPath() {
33
+ return path.join(getDataRoot(), "mcpx", "secret-names.json");
34
+ }
35
+ function getRuntimeDir() {
36
+ return path.join(getStateRoot(), "mcpx", "runtime");
37
+ }
38
+ function getLogDir() {
39
+ return path.join(getStateRoot(), "mcpx", "logs");
40
+ }
41
+ function getPidPath() {
42
+ return path.join(getRuntimeDir(), "daemon.pid");
43
+ }
44
+ function getLogPath() {
45
+ return path.join(getLogDir(), "daemon.log");
46
+ }
47
+ function getUpdatesDir() {
48
+ return path.join(getDataRoot(), "mcpx", "updates");
49
+ }
50
+ function getStagedVersionPath() {
51
+ return path.join(getUpdatesDir(), "staged-version.json");
52
+ }
53
+ function getUpdateLockPath() {
54
+ return path.join(getUpdatesDir(), ".update.lock");
55
+ }
56
+ function ensureDir(dirPath) {
57
+ fs.mkdirSync(dirPath, { recursive: true });
58
+ }
59
+ function ensureParentDir(filePath) {
60
+ fs.mkdirSync(path.dirname(filePath), { recursive: true });
61
+ }
62
+ function findProjectConfigPath(startDir = process.cwd()) {
63
+ let dir = startDir;
64
+ while (true) {
65
+ const candidate = path.join(dir, ".mcpx.json");
66
+ if (fs.existsSync(candidate)) {
67
+ return candidate;
68
+ }
69
+ const parent = path.dirname(dir);
70
+ if (parent === dir) {
71
+ break;
72
+ }
73
+ dir = parent;
74
+ }
75
+ return null;
76
+ }
77
+
78
+ // src/util/fs.ts
79
+ import fs2 from "node:fs";
80
+ import path2 from "node:path";
81
+ import crypto from "node:crypto";
82
+ function readJsonFile(filePath, fallback) {
83
+ if (!fs2.existsSync(filePath)) {
84
+ return fallback;
85
+ }
86
+ try {
87
+ const raw = fs2.readFileSync(filePath, "utf8");
88
+ return JSON.parse(raw);
89
+ } catch {
90
+ return fallback;
91
+ }
92
+ }
93
+ function writeJsonAtomic(filePath, data) {
94
+ fs2.mkdirSync(path2.dirname(filePath), { recursive: true });
95
+ const tempPath = `${filePath}.tmp-${process.pid}-${Date.now()}`;
96
+ const content = `${JSON.stringify(data, null, 2)}
97
+ `;
98
+ fs2.writeFileSync(tempPath, content, { mode: 384 });
99
+ fs2.renameSync(tempPath, filePath);
100
+ }
101
+ function sha256(value) {
102
+ return crypto.createHash("sha256").update(value).digest("hex");
103
+ }
104
+
105
+ export { homeDir, getConfigPath, getSkillsDir, getManagedIndexPath, getSecretNamesPath, getPidPath, getLogPath, getUpdatesDir, getStagedVersionPath, getUpdateLockPath, ensureDir, ensureParentDir, findProjectConfigPath, readJsonFile, writeJsonAtomic, sha256 };