mcpman 0.7.0 → 0.8.0

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.
@@ -10,7 +10,8 @@ import {
10
10
  removeEntry,
11
11
  resolveLockfilePath,
12
12
  writeLockfile
13
- } from "./chunk-YZNTMR6O.js";
13
+ } from "./chunk-DZ3D5RZQ.js";
14
+ import "./chunk-AOCGFOA6.js";
14
15
  export {
15
16
  LOCKFILE_NAME,
16
17
  addEntry,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcpman",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "The package manager for MCP servers",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,88 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // src/core/lockfile.ts
4
- import fs from "fs";
5
- import os from "os";
6
- import path from "path";
7
- var LOCKFILE_NAME = "mcpman.lock";
8
- function findLockfile() {
9
- let dir = process.cwd();
10
- while (true) {
11
- const candidate = path.join(dir, LOCKFILE_NAME);
12
- if (fs.existsSync(candidate)) return candidate;
13
- const parent = path.dirname(dir);
14
- if (parent === dir) break;
15
- dir = parent;
16
- }
17
- return null;
18
- }
19
- function getGlobalLockfilePath() {
20
- return path.join(os.homedir(), ".mcpman", LOCKFILE_NAME);
21
- }
22
- function resolveLockfilePath() {
23
- return findLockfile() ?? getGlobalLockfilePath();
24
- }
25
- function readLockfile(filePath) {
26
- const target = filePath ?? resolveLockfilePath();
27
- if (!fs.existsSync(target)) {
28
- return { lockfileVersion: 1, servers: {} };
29
- }
30
- try {
31
- const raw = fs.readFileSync(target, "utf-8");
32
- return JSON.parse(raw);
33
- } catch {
34
- return { lockfileVersion: 1, servers: {} };
35
- }
36
- }
37
- function serialize(data) {
38
- const sorted = {
39
- lockfileVersion: data.lockfileVersion,
40
- servers: Object.fromEntries(
41
- Object.entries(data.servers).sort(([a], [b]) => a.localeCompare(b))
42
- )
43
- };
44
- return `${JSON.stringify(sorted, null, 2)}
45
- `;
46
- }
47
- function writeLockfile(data, filePath) {
48
- const target = filePath ?? resolveLockfilePath();
49
- const dir = path.dirname(target);
50
- if (!fs.existsSync(dir)) {
51
- fs.mkdirSync(dir, { recursive: true });
52
- }
53
- const tmp = `${target}.tmp`;
54
- fs.writeFileSync(tmp, serialize(data), "utf-8");
55
- fs.renameSync(tmp, target);
56
- }
57
- function addEntry(name, entry, filePath) {
58
- const data = readLockfile(filePath);
59
- data.servers[name] = entry;
60
- writeLockfile(data, filePath);
61
- }
62
- function removeEntry(name, filePath) {
63
- const data = readLockfile(filePath);
64
- if (name in data.servers) {
65
- delete data.servers[name];
66
- writeLockfile(data, filePath);
67
- }
68
- }
69
- function getLockedVersion(name, filePath) {
70
- const data = readLockfile(filePath);
71
- return data.servers[name]?.version;
72
- }
73
- function createEmptyLockfile(filePath) {
74
- writeLockfile({ lockfileVersion: 1, servers: {} }, filePath);
75
- }
76
-
77
- export {
78
- LOCKFILE_NAME,
79
- findLockfile,
80
- getGlobalLockfilePath,
81
- resolveLockfilePath,
82
- readLockfile,
83
- writeLockfile,
84
- addEntry,
85
- removeEntry,
86
- getLockedVersion,
87
- createEmptyLockfile
88
- };