devscribe-reason 1.0.9 → 1.0.10

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 +1 -1
  2. package/scripts/cli.js +27 -15
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "devscribe-reason",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "MCP server that captures engineering decision reasoning and commits structured markdown to GitHub",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
package/scripts/cli.js CHANGED
@@ -1,12 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { execSync } from "node:child_process";
4
- import { existsSync, mkdirSync, writeFileSync } from "node:fs";
5
- import { join } from "node:path";
6
- import { homedir } from "node:os";
7
- import { globSync } from "glob";
8
3
  import { fileURLToPath } from "node:url";
9
4
  import { dirname } from "node:path";
5
+ import { spawn } from "node:child_process";
10
6
 
11
7
  const args = process.argv.slice(2);
12
8
  const command = args[0];
@@ -14,26 +10,42 @@ const command = args[0];
14
10
  // If no command or "server" command, run the MCP server
15
11
  if (!command || command === "server") {
16
12
  const __filename = fileURLToPath(import.meta.url);
17
- const __dirname = dirname(__filename);
18
- const serverPath = join(__dirname, "../src/index.js");
19
13
 
20
- // Run the server
21
- execSync(`node ${serverPath}`, { stdio: "inherit" });
22
- process.exit(0);
14
+ // Spawn the server directly without shelling out
15
+ const serverProcess = spawn("node", [dirname(__filename) + "/../src/index.js"], {
16
+ stdio: "inherit",
17
+ env: process.env,
18
+ });
19
+
20
+ serverProcess.on("error", (err) => {
21
+ console.error("Failed to start server:", err);
22
+ process.exit(1);
23
+ });
24
+
25
+ // Keep the process alive
26
+ serverProcess.on("exit", (code) => {
27
+ process.exit(code || 0);
28
+ });
23
29
  }
24
30
 
25
31
  // If "setup" command, run setup
26
32
  if (command === "setup") {
27
33
  const __filename = fileURLToPath(import.meta.url);
28
- const __dirname = dirname(__filename);
29
- const setupPath = join(__dirname, "setup.js");
30
34
 
31
- // Run setup
32
- execSync(`node ${setupPath}`, {
35
+ // Spawn setup directly without shelling out
36
+ const setupProcess = spawn("node", [dirname(__filename) + "/setup.js"], {
33
37
  stdio: "inherit",
34
38
  env: process.env,
35
39
  });
36
- process.exit(0);
40
+
41
+ setupProcess.on("error", (err) => {
42
+ console.error("Failed to run setup:", err);
43
+ process.exit(1);
44
+ });
45
+
46
+ setupProcess.on("exit", (code) => {
47
+ process.exit(code || 0);
48
+ });
37
49
  }
38
50
 
39
51
  // Unknown command