burnrate 0.1.5 → 0.1.7
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/cli/index.js +9 -2
- package/dist/cli/setup.js +17 -12
- package/dist/mcp/server.js +7 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -4,13 +4,20 @@
|
|
|
4
4
|
* A logistics war MMO for Claude Code
|
|
5
5
|
* The front doesn't feed itself.
|
|
6
6
|
*/
|
|
7
|
-
// Route
|
|
7
|
+
// Route lightweight commands BEFORE any heavy imports.
|
|
8
8
|
// ESM resolves all static imports before executing code, so we must
|
|
9
|
-
// dynamic-import
|
|
9
|
+
// dynamic-import and exit before static imports would load better-sqlite3.
|
|
10
10
|
if (process.argv[2] === 'setup') {
|
|
11
11
|
await import('./setup.js');
|
|
12
12
|
process.exit(0);
|
|
13
13
|
}
|
|
14
|
+
if (process.argv[2] === 'mcp') {
|
|
15
|
+
await import('../mcp/server.js');
|
|
16
|
+
// server.connect() resolves immediately after setting up the transport,
|
|
17
|
+
// so we block here to prevent fallthrough to heavy imports.
|
|
18
|
+
// Node exits naturally when the MCP client closes stdin.
|
|
19
|
+
await new Promise(() => { });
|
|
20
|
+
}
|
|
14
21
|
// Heavy imports — only reached when NOT running setup
|
|
15
22
|
const { Command } = await import('commander');
|
|
16
23
|
const { GameDatabase } = await import('../db/database.js');
|
package/dist/cli/setup.js
CHANGED
|
@@ -72,20 +72,25 @@ async function main() {
|
|
|
72
72
|
console.log(' ⚠ Could not validate key (server unreachable).');
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
// 5.
|
|
76
|
-
//
|
|
77
|
-
// When running from source, it's relative to this file
|
|
78
|
-
let mcpServerPath;
|
|
79
|
-
// Check if we're running from an npm install (dist/cli/setup.js)
|
|
75
|
+
// 5. Determine MCP server config
|
|
76
|
+
// Detect whether we're running from source (git clone) or npx
|
|
80
77
|
const distPath = path.resolve(path.dirname(new URL(import.meta.url).pathname), '..', 'mcp', 'server.js');
|
|
81
|
-
|
|
82
|
-
|
|
78
|
+
const isFromSource = !distPath.includes('node_modules');
|
|
79
|
+
let mcpCommand;
|
|
80
|
+
let mcpArgs;
|
|
81
|
+
if (isFromSource && fs.existsSync(distPath)) {
|
|
82
|
+
// Running from cloned source — use direct path
|
|
83
|
+
mcpCommand = 'node';
|
|
84
|
+
mcpArgs = [distPath];
|
|
85
|
+
console.log(`\nMCP server: ${distPath} (source)`);
|
|
83
86
|
}
|
|
84
87
|
else {
|
|
85
|
-
//
|
|
86
|
-
|
|
88
|
+
// Installed via npx/npm — use npx to resolve package at runtime
|
|
89
|
+
// This is stable and doesn't depend on ephemeral npx cache paths
|
|
90
|
+
mcpCommand = 'npx';
|
|
91
|
+
mcpArgs = ['-y', 'burnrate', 'mcp'];
|
|
92
|
+
console.log(`\nMCP server: npx burnrate mcp (npm package)`);
|
|
87
93
|
}
|
|
88
|
-
console.log(`\nMCP server path: ${mcpServerPath}`);
|
|
89
94
|
// 6. Write Claude Code settings
|
|
90
95
|
const claudeSettingsDir = path.join(os.homedir(), '.claude');
|
|
91
96
|
const claudeSettingsPath = path.join(claudeSettingsDir, 'settings.json');
|
|
@@ -108,8 +113,8 @@ async function main() {
|
|
|
108
113
|
env.BURNRATE_API_KEY = apiKey;
|
|
109
114
|
}
|
|
110
115
|
settings.mcpServers.burnrate = {
|
|
111
|
-
command:
|
|
112
|
-
args:
|
|
116
|
+
command: mcpCommand,
|
|
117
|
+
args: mcpArgs,
|
|
113
118
|
env
|
|
114
119
|
};
|
|
115
120
|
// Ensure directory exists
|
package/dist/mcp/server.js
CHANGED
|
@@ -1874,4 +1874,10 @@ async function main() {
|
|
|
1874
1874
|
await server.connect(transport);
|
|
1875
1875
|
console.error('BURNRATE MCP Server running');
|
|
1876
1876
|
}
|
|
1877
|
-
|
|
1877
|
+
try {
|
|
1878
|
+
await main();
|
|
1879
|
+
}
|
|
1880
|
+
catch (err) {
|
|
1881
|
+
console.error(err);
|
|
1882
|
+
process.exit(1);
|
|
1883
|
+
}
|