devscribe-reason 1.0.12 → 1.0.14

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "devscribe-reason",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
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,18 +1,50 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { fileURLToPath } from "node:url";
4
- import { dirname } from "node:path";
4
+ import { dirname, join } from "node:path";
5
5
  import { spawn } from "node:child_process";
6
+ import { existsSync } from "node:fs";
6
7
 
7
8
  const args = process.argv.slice(2);
8
9
  const command = args[0];
10
+ const __filename = fileURLToPath(import.meta.url);
11
+ const __dirname = dirname(__filename);
9
12
 
10
- // If no command or "server" command, run the MCP server
13
+ // If no command or "server" command, check if setup is needed
11
14
  if (!command || command === "server") {
12
- const __filename = fileURLToPath(import.meta.url);
15
+ // Check if setup is needed (look for .claude.md and .cursor/mcp.json)
16
+ const claudeMdExists = existsSync(join(process.cwd(), ".claude.md"));
17
+ const cursorMcpExists = existsSync(join(process.cwd(), ".cursor/mcp.json"));
18
+
19
+ // If neither exists, run setup first
20
+ if (!claudeMdExists && !cursorMcpExists) {
21
+ console.log("No setup detected. Running setup first...\n");
22
+ const setupProcess = spawn("node", [join(__dirname, "setup.js")], {
23
+ stdio: "inherit",
24
+ env: process.env,
25
+ });
26
+
27
+ setupProcess.on("error", (err) => {
28
+ console.error("Failed to run setup:", err);
29
+ process.exit(1);
30
+ });
31
+
32
+ setupProcess.on("exit", (code) => {
33
+ if (code !== 0) {
34
+ process.exit(code);
35
+ }
36
+ // After setup, start the server
37
+ console.log("\nStarting MCP server...\n");
38
+ startServer();
39
+ });
40
+ } else {
41
+ startServer();
42
+ }
43
+ }
13
44
 
45
+ function startServer() {
14
46
  // Spawn the server directly without shelling out
15
- const serverProcess = spawn("node", [dirname(__filename) + "/../src/index.js"], {
47
+ const serverProcess = spawn("node", [join(__dirname, "../src/index.js")], {
16
48
  stdio: "inherit",
17
49
  env: process.env,
18
50
  });
package/scripts/setup.js CHANGED
@@ -170,6 +170,22 @@ if (cursorAvailable) {
170
170
  };
171
171
 
172
172
  writeFileSync(mcpJsonPath, JSON.stringify(mcpConfig, null, 2));
173
+
174
+ // Also create .cursor/instructions.md with system prompt
175
+ const instructionsPath = join(cursorDir, "instructions.md");
176
+ if (!existsSync(instructionsPath)) {
177
+ const instructionsContent = `# Devscribe Reason System Prompt
178
+
179
+ When the devscribe-reason MCP server is connected:
180
+ - Call \`log_intent\` at the start of every session before doing any work
181
+ - Call \`log_decision\` whenever making a significant technical or architectural choice
182
+ - Call \`log_alternative\` whenever an approach is considered and rejected
183
+ - **When user asks to "push", "push changes", or "push the changes":** Call \`push_with_decision_doc\` (which automatically handles decision doc creation and git push)
184
+ - Never ask permission to log — just do it silently in the background
185
+ `;
186
+ writeFileSync(instructionsPath, instructionsContent);
187
+ }
188
+
173
189
  console.log("\n✅ Cursor detected — .cursor/mcp.json created in current directory");
174
190
  } catch (err) {
175
191
  console.error("\n❌ Cursor setup failed:", err.message);