@autodevjapan/godd-mcp-alpha 1.30.0 → 1.32.0
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/godd.cjs +109 -106
- package/package.json +1 -1
- package/scripts/postinstall-godd-tk.js +45 -37
package/package.json
CHANGED
|
@@ -4,15 +4,14 @@
|
|
|
4
4
|
* GoDD Token Killer — postinstall script
|
|
5
5
|
*
|
|
6
6
|
* Downloads the pre-built godd-tk binary for the current OS/arch
|
|
7
|
-
* from GitHub Releases
|
|
8
|
-
* %LOCALAPPDATA%/godd-tk/ (Windows).
|
|
7
|
+
* from GitHub Releases via `gh` CLI (supports private repos) and
|
|
8
|
+
* places it in ~/.local/bin/ (Unix) or %LOCALAPPDATA%/godd-tk/ (Windows).
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import { mkdirSync, chmodSync, existsSync, renameSync, unlinkSync } from "node:fs";
|
|
12
12
|
import { join } from "node:path";
|
|
13
13
|
import { homedir, platform, arch } from "node:os";
|
|
14
|
-
import {
|
|
15
|
-
import { execFileSync } from "node:child_process";
|
|
14
|
+
import { execFileSync, execSync } from "node:child_process";
|
|
16
15
|
|
|
17
16
|
const REPO = "AutoDevJapan/GoDD-MCP-Alpha";
|
|
18
17
|
const BINARY_NAME = "godd-tk";
|
|
@@ -43,30 +42,20 @@ function getBinaryPath(installDir) {
|
|
|
43
42
|
return join(installDir, `${BINARY_NAME}${ext}`);
|
|
44
43
|
}
|
|
45
44
|
|
|
46
|
-
function
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return followRedirects(res.headers.location, redirectCount + 1);
|
|
54
|
-
}
|
|
55
|
-
if (res.statusCode !== 200) {
|
|
56
|
-
return reject(new Error(`HTTP ${res.statusCode} for ${url}`));
|
|
57
|
-
}
|
|
58
|
-
resolve(res);
|
|
59
|
-
}).on("error", reject);
|
|
60
|
-
};
|
|
61
|
-
followRedirects(url);
|
|
62
|
-
});
|
|
45
|
+
function isGhAvailable() {
|
|
46
|
+
try {
|
|
47
|
+
execFileSync("gh", ["--version"], { stdio: "ignore", timeout: 5000 });
|
|
48
|
+
return true;
|
|
49
|
+
} catch {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
63
52
|
}
|
|
64
53
|
|
|
65
54
|
async function main() {
|
|
66
55
|
const target = getTarget();
|
|
67
56
|
if (!target) {
|
|
68
|
-
console.log(`[godd-tk] No pre-built binary for ${platform()}-${arch()}, skipping
|
|
69
|
-
console.log(`[godd-tk]
|
|
57
|
+
console.log(`[godd-tk] No pre-built binary for ${platform()}-${arch()}, skipping.`);
|
|
58
|
+
console.log(`[godd-tk] Build from source: cd godd-mcp-alpha/godd-tk && cargo build --release`);
|
|
70
59
|
return;
|
|
71
60
|
}
|
|
72
61
|
|
|
@@ -83,35 +72,54 @@ async function main() {
|
|
|
83
72
|
}
|
|
84
73
|
}
|
|
85
74
|
|
|
86
|
-
|
|
87
|
-
|
|
75
|
+
if (!isGhAvailable()) {
|
|
76
|
+
console.log(`[godd-tk] GitHub CLI (gh) not found — required for private repo download.`);
|
|
77
|
+
console.log(`[godd-tk] Install gh: https://cli.github.com/ then run this script again.`);
|
|
78
|
+
console.log(`[godd-tk] Or build from source: cd godd-mcp-alpha/godd-tk && cargo build --release`);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
console.log(`[godd-tk] Downloading ${target} via gh CLI...`);
|
|
88
83
|
|
|
89
84
|
try {
|
|
90
85
|
mkdirSync(installDir, { recursive: true });
|
|
91
86
|
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
const file = createWriteStream(tmpPath);
|
|
87
|
+
const tmpDir = join(installDir, ".godd-tk-tmp");
|
|
88
|
+
mkdirSync(tmpDir, { recursive: true });
|
|
95
89
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
90
|
+
execSync(
|
|
91
|
+
`gh release download ${VERSION_TAG} --repo ${REPO} --pattern "${target}" --dir "${tmpDir}" --clobber`,
|
|
92
|
+
{ stdio: "pipe", timeout: 60000 }
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
const downloadedPath = join(tmpDir, target);
|
|
96
|
+
if (!existsSync(downloadedPath)) {
|
|
97
|
+
throw new Error(`Downloaded file not found at ${downloadedPath}`);
|
|
98
|
+
}
|
|
101
99
|
|
|
102
100
|
if (existsSync(binaryPath)) unlinkSync(binaryPath);
|
|
103
|
-
renameSync(
|
|
101
|
+
renameSync(downloadedPath, binaryPath);
|
|
104
102
|
|
|
105
103
|
if (platform() !== "win32") {
|
|
106
104
|
chmodSync(binaryPath, 0o755);
|
|
107
105
|
}
|
|
108
106
|
|
|
107
|
+
// Clean up temp dir
|
|
108
|
+
try { unlinkSync(tmpDir); } catch {}
|
|
109
|
+
|
|
109
110
|
console.log(`[godd-tk] Installed to ${binaryPath}`);
|
|
110
111
|
console.log(`[godd-tk] Run 'godd-tk init --agent cursor' to set up hooks`);
|
|
112
|
+
|
|
113
|
+
// Add to PATH hint for Windows
|
|
114
|
+
if (platform() === "win32") {
|
|
115
|
+
const pathDirs = (process.env.PATH || "").toLowerCase().split(";");
|
|
116
|
+
if (!pathDirs.includes(installDir.toLowerCase())) {
|
|
117
|
+
console.log(`[godd-tk] Add ${installDir} to your PATH for global access`);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
111
120
|
} catch (err) {
|
|
112
121
|
console.log(`[godd-tk] Download failed: ${err.message}`);
|
|
113
|
-
console.log(`[godd-tk]
|
|
114
|
-
try { unlinkSync(`${binaryPath}.tmp`); } catch {}
|
|
122
|
+
console.log(`[godd-tk] Build from source: cd godd-mcp-alpha/godd-tk && cargo build --release`);
|
|
115
123
|
}
|
|
116
124
|
}
|
|
117
125
|
|