devscribe-reason 1.0.2 → 1.0.4

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.2",
3
+ "version": "1.0.4",
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/setup.js CHANGED
@@ -7,9 +7,29 @@ import { homedir } from "node:os";
7
7
  import { globSync } from "glob";
8
8
 
9
9
  const token = process.env.GITHUB_TOKEN || "";
10
- const repo = process.env.GITHUB_REPO || "";
10
+ let repo = process.env.GITHUB_REPO || "";
11
11
  const branch = process.env.GITHUB_BRANCH || "main";
12
12
 
13
+ // Auto-detect GitHub repo from git remote if not provided
14
+ if (!repo) {
15
+ try {
16
+ const remoteUrl = execSync("git config --get remote.origin.url", {
17
+ stdio: "pipe",
18
+ timeout: 1000,
19
+ })
20
+ .toString()
21
+ .trim();
22
+
23
+ // Extract owner/repo from HTTPS or SSH URLs
24
+ const httpsMatch = remoteUrl.match(/github\.com[:/](.+?)\/(.+?)(\.git)?$/);
25
+ if (httpsMatch) {
26
+ repo = `${httpsMatch[1]}/${httpsMatch[2]}`;
27
+ }
28
+ } catch {
29
+ // git command failed or not a git repo, repo stays empty
30
+ }
31
+ }
32
+
13
33
  // Try to find the claude binary in common locations
14
34
  function findClaudeBinary() {
15
35
  // 1. Try 'which claude' if claude is in PATH
@@ -81,6 +101,17 @@ const envArgs = [
81
101
  const claudeAvailable = isClaudeCodeAvailable();
82
102
  const cursorAvailable = isCursorAvailable();
83
103
 
104
+ // Warn if GITHUB_REPO is missing (required for decision docs)
105
+ if (!repo && (claudeAvailable || cursorAvailable)) {
106
+ console.warn(
107
+ "\n⚠️ GITHUB_REPO not detected. Decision docs won't be created without it.\n"
108
+ );
109
+ console.warn("Set it explicitly:\n");
110
+ console.warn(
111
+ " GITHUB_TOKEN=your_token GITHUB_REPO=owner/repo npx devscribe-reason\n"
112
+ );
113
+ }
114
+
84
115
  if (!claudeAvailable && !cursorAvailable) {
85
116
  console.error("\n❌ Could not find Claude Code or Cursor.\n");
86
117
  console.error("Manual setup required:\n");
package/src/CLAUDE.md CHANGED
@@ -19,72 +19,46 @@ The server exposes four MCP tools that Claude Code calls throughout a coding ses
19
19
 
20
20
  ## Setup
21
21
 
22
- ### 1. Clone and install
22
+ ### 1. Quick setup (one command)
23
23
 
24
- ```bash
25
- git clone https://github.com/YOUR_USERNAME/Devscribe-Reason.git
26
- cd Devscribe-Reason
27
- npm install
28
- ```
29
-
30
- ### 2. Configure environment variables
24
+ Works with both Claude Code and Cursor:
31
25
 
32
26
  ```bash
33
- cp .env.example .env
27
+ GITHUB_TOKEN=ghp_your_token npx devscribe-reason
34
28
  ```
35
29
 
36
- Edit `.env` with your values:
30
+ The setup script will:
31
+ - Auto-detect your GitHub repo from git remote
32
+ - Auto-detect Claude Code or Cursor
33
+ - Configure the MCP server automatically
37
34
 
38
- ```
39
- GITHUB_TOKEN=ghp_your_personal_access_token
40
- GITHUB_REPO=owner/repo
41
- GITHUB_BRANCH=main
35
+ **If you need to specify the repo explicitly:**
36
+ ```bash
37
+ GITHUB_TOKEN=ghp_your_token GITHUB_REPO=owner/repo npx devscribe-reason
42
38
  ```
43
39
 
44
40
  **GitHub Token:** Create a [Personal Access Token](https://github.com/settings/tokens) with `repo` scope (or `contents: write` for fine-grained tokens).
45
41
 
46
- ### 3. Connect to Claude Code
47
-
48
- Add this to your Claude Code MCP settings (`~/.claude/claude_desktop_config.json` or via the Claude Code CLI):
49
-
50
- ```json
51
- {
52
- "mcpServers": {
53
- "devscribe-reason": {
54
- "command": "node",
55
- "args": ["/absolute/path/to/Devscribe-Reason/src/index.js"],
56
- "env": {
57
- "GITHUB_TOKEN": "ghp_your_token",
58
- "GITHUB_REPO": "owner/repo",
59
- "GITHUB_BRANCH": "main"
60
- }
61
- }
62
- }
63
- }
64
- ```
42
+ ### 2. Add system prompt instructions
65
43
 
66
- Or using the Claude Code CLI:
67
-
68
- ```bash
69
- claude mcp add devscribe-reason node /absolute/path/to/Devscribe-Reason/src/index.js \
70
- -e GITHUB_TOKEN=ghp_your_token \
71
- -e GITHUB_REPO=owner/repo \
72
- -e GITHUB_BRANCH=main
73
- ```
74
-
75
- ### 4. Add system prompt instructions
76
-
77
- Add these instructions to your Claude Code system prompt (via CLAUDE.md or settings) so it uses the tools automatically:
44
+ Add these instructions to your Claude Code/Cursor system prompt (via CLAUDE.md or settings) so the tools are used automatically:
78
45
 
79
46
  ```
80
47
  When the devscribe-reason MCP server is connected:
81
48
  - Call log_intent at the start of every session before doing any work
82
49
  - Call log_decision whenever making a significant technical or architectural choice
83
50
  - Call log_alternative whenever an approach is considered and rejected
84
- - Call finalize_reasoning_doc when work is complete or a PR is ready
51
+ - Call finalize_reasoning_doc when work is complete, before pushing
85
52
  - Never ask permission to log — just do it silently in the background
86
53
  ```
87
54
 
55
+ ### 3. Workflow
56
+
57
+ 1. Work in Claude Code or Cursor
58
+ 2. Claude logs decisions and alternatives as you code
59
+ 3. **Before pushing:** Ask Claude to call `finalize_reasoning_doc` to create the reasoning document
60
+ 4. Push to GitHub (the doc is committed automatically)
61
+
88
62
  ## Output
89
63
 
90
64
  Each session produces a markdown file in `/docs/decisions/` like: