devscribe-reason 1.0.2 → 1.0.3

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/setup.js +32 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "devscribe-reason",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
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");