project-context-map-mcp 0.1.0 → 0.1.2

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 (2) hide show
  1. package/package.json +11 -2
  2. package/src/cli.js +61 -54
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "project-context-map-mcp",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "MCP server and Claude Code skill for project-aware code changes with low token usage.",
5
5
  "type": "module",
6
6
  "main": "src/cli.js",
@@ -13,7 +13,10 @@
13
13
  "install-hooks": "node src/cli.js install-hooks",
14
14
  "configure-claude": "node src/cli.js configure-claude",
15
15
  "print-mcp-config": "node src/cli.js print-mcp-config",
16
- "check": "node --check src/cli.js && node --check src/server.js && node --check scripts/refresh-map.js && node --check scripts/install-git-hooks.js"
16
+ "lint": "node --check src/cli.js && node --check src/claude.js && node --check src/git.js && node --check src/indexer.js && node --check src/ranker.js && node --check src/server.js && node --check src/utils.js && node --check scripts/install-git-hooks.js && node --check scripts/refresh-map.js && node --check test/claude.test.js && node --check test/helpers.js && node --check test/indexer.test.js && node --check test/ranker.test.js && node --check test/utils.test.js",
17
+ "check": "npm run lint && npm test",
18
+ "test": "NODE_OPTIONS=--experimental-vm-modules jest --runInBand",
19
+ "prepublishOnly": "npm run check"
17
20
  },
18
21
  "keywords": [
19
22
  "mcp",
@@ -35,5 +38,11 @@
35
38
  },
36
39
  "engines": {
37
40
  "node": ">=20"
41
+ },
42
+ "jest": {
43
+ "testEnvironment": "node"
44
+ },
45
+ "devDependencies": {
46
+ "jest": "^30.3.0"
38
47
  }
39
48
  }
package/src/cli.js CHANGED
@@ -46,65 +46,72 @@ Commands:
46
46
  const { command, options } = parseArgs(process.argv.slice(2));
47
47
  const projectRoot = options["project-root"] || process.cwd();
48
48
 
49
- if (command === "help" || command === "--help" || command === "-h") {
50
- printHelp();
51
- process.exit(0);
52
- }
49
+ async function main() {
50
+ if (command === "help" || command === "--help" || command === "-h") {
51
+ printHelp();
52
+ process.exit(0);
53
+ }
53
54
 
54
- if (command === "serve") {
55
- if (options["project-root"]) {
56
- process.env.PROJECT_ROOT = projectRoot;
55
+ if (command === "serve") {
56
+ if (options["project-root"]) {
57
+ process.env.PROJECT_ROOT = projectRoot;
58
+ }
59
+ await startServer();
60
+ return;
57
61
  }
58
- await startServer();
59
- process.exit(0);
60
- }
61
62
 
62
- if (command === "refresh") {
63
- refreshMapCli(projectRoot);
64
- process.exit(0);
65
- }
63
+ if (command === "refresh") {
64
+ refreshMapCli(projectRoot);
65
+ process.exit(0);
66
+ }
66
67
 
67
- if (command === "install-hooks") {
68
- installGitHooks(projectRoot);
69
- process.exit(0);
70
- }
68
+ if (command === "install-hooks") {
69
+ installGitHooks(projectRoot);
70
+ process.exit(0);
71
+ }
71
72
 
72
- if (command === "configure-claude") {
73
- const skillPath = writeClaudeSkill(projectRoot);
74
- const configPath = writeMcpConfig(projectRoot, {
75
- projectRoot: ".",
76
- serverName: options["server-name"] || "project-context-map",
77
- command: options.command || "project-context-map-mcp"
78
- });
79
-
80
- process.stdout.write(
81
- `${JSON.stringify(
82
- {
83
- message: "Claude Code skill and .mcp.json created.",
84
- skillPath,
85
- configPath
86
- },
87
- null,
88
- 2
89
- )}\n`
90
- );
91
- process.exit(0);
92
- }
73
+ if (command === "configure-claude") {
74
+ const skillPath = writeClaudeSkill(projectRoot);
75
+ const configPath = writeMcpConfig(projectRoot, {
76
+ projectRoot: ".",
77
+ serverName: options["server-name"] || "project-context-map",
78
+ command: options.command || "project-context-map-mcp"
79
+ });
80
+
81
+ process.stdout.write(
82
+ `${JSON.stringify(
83
+ {
84
+ message: "Claude Code skill and .mcp.json created.",
85
+ skillPath,
86
+ configPath
87
+ },
88
+ null,
89
+ 2
90
+ )}\n`
91
+ );
92
+ process.exit(0);
93
+ }
93
94
 
94
- if (command === "print-mcp-config") {
95
- process.stdout.write(
96
- `${JSON.stringify(
97
- buildMcpConfig({
98
- projectRoot: options["project-root"] || ".",
99
- serverName: options["server-name"] || "project-context-map",
100
- command: options.command || "project-context-map-mcp"
101
- }),
102
- null,
103
- 2
104
- )}\n`
105
- );
106
- process.exit(0);
95
+ if (command === "print-mcp-config") {
96
+ process.stdout.write(
97
+ `${JSON.stringify(
98
+ buildMcpConfig({
99
+ projectRoot: options["project-root"] || ".",
100
+ serverName: options["server-name"] || "project-context-map",
101
+ command: options.command || "project-context-map-mcp"
102
+ }),
103
+ null,
104
+ 2
105
+ )}\n`
106
+ );
107
+ process.exit(0);
108
+ }
109
+
110
+ printHelp();
111
+ process.exit(1);
107
112
  }
108
113
 
109
- printHelp();
110
- process.exit(1);
114
+ await main().catch((error) => {
115
+ process.stderr.write(`${error?.stack || String(error)}\n`);
116
+ process.exit(1);
117
+ });