gf-uwu 0.1.1
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/install.js +80 -0
- package/package.json +33 -0
package/install.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const https = require("https");
|
|
5
|
+
const fs = require("fs");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
const os = require("os");
|
|
8
|
+
const { execFileSync } = require("child_process");
|
|
9
|
+
|
|
10
|
+
const REPO = "DarkPhoenix2704/girlfriend";
|
|
11
|
+
const BIN_DIR = path.join(__dirname, "bin");
|
|
12
|
+
const BIN_PATH = path.join(BIN_DIR, "girlfriend");
|
|
13
|
+
|
|
14
|
+
const PLATFORM_MAP = {
|
|
15
|
+
"linux-x64": "girlfriend-linux-x64",
|
|
16
|
+
"darwin-arm64": "girlfriend-darwin-arm64",
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
function getArtifact() {
|
|
20
|
+
const platform = os.platform();
|
|
21
|
+
const arch = os.arch();
|
|
22
|
+
|
|
23
|
+
const key =
|
|
24
|
+
platform === "linux" && arch === "x64" ? "linux-x64" :
|
|
25
|
+
platform === "darwin" && arch === "arm64" ? "darwin-arm64" :
|
|
26
|
+
null;
|
|
27
|
+
|
|
28
|
+
if (!key) {
|
|
29
|
+
throw new Error(`Unsupported platform: ${platform}-${arch}.\nPre-built binaries are available for linux-x64 and darwin-arm64.`);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return PLATFORM_MAP[key];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function fetch(url) {
|
|
36
|
+
return new Promise((resolve, reject) => {
|
|
37
|
+
https.get(url, { headers: { "User-Agent": "gf-uwu-installer" } }, (res) => {
|
|
38
|
+
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
39
|
+
return fetch(res.headers.location).then(resolve).catch(reject);
|
|
40
|
+
}
|
|
41
|
+
if (res.statusCode !== 200) {
|
|
42
|
+
return reject(new Error(`HTTP ${res.statusCode} for ${url}`));
|
|
43
|
+
}
|
|
44
|
+
const chunks = [];
|
|
45
|
+
res.on("data", (c) => chunks.push(c));
|
|
46
|
+
res.on("end", () => resolve(Buffer.concat(chunks)));
|
|
47
|
+
res.on("error", reject);
|
|
48
|
+
}).on("error", reject);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async function getLatestVersion() {
|
|
53
|
+
const buf = await fetch(`https://api.github.com/repos/${REPO}/releases/latest`);
|
|
54
|
+
const data = JSON.parse(buf.toString());
|
|
55
|
+
return data.tag_name;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async function main() {
|
|
59
|
+
// Skip in CI environments that just need the package metadata
|
|
60
|
+
if (process.env.SKIP_GF_INSTALL) return;
|
|
61
|
+
|
|
62
|
+
const artifact = getArtifact();
|
|
63
|
+
const version = process.env.GIRLFRIEND_VERSION || await getLatestVersion();
|
|
64
|
+
const baseUrl = `https://github.com/${REPO}/releases/download/${version}`;
|
|
65
|
+
|
|
66
|
+
console.log(`gf-uwu: downloading girlfriend ${version} (${artifact})...`);
|
|
67
|
+
|
|
68
|
+
const binary = await fetch(`${baseUrl}/${artifact}`);
|
|
69
|
+
|
|
70
|
+
fs.mkdirSync(BIN_DIR, { recursive: true });
|
|
71
|
+
fs.writeFileSync(BIN_PATH, binary, { mode: 0o755 });
|
|
72
|
+
|
|
73
|
+
console.log(`gf-uwu: installed to ${BIN_PATH}`);
|
|
74
|
+
console.log(`gf-uwu: run with \`girlfriend\` or \`bunx gf-uwu\``);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
main().catch((err) => {
|
|
78
|
+
console.error(`gf-uwu install failed: ${err.message}`);
|
|
79
|
+
process.exit(1);
|
|
80
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "gf-uwu",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "girlfriend — a sharp, capable AI assistant for your terminal",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ai",
|
|
7
|
+
"cli",
|
|
8
|
+
"assistant",
|
|
9
|
+
"claude",
|
|
10
|
+
"terminal",
|
|
11
|
+
"llm"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://github.com/DarkPhoenix2704/girlfriend",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/DarkPhoenix2704/girlfriend.git"
|
|
17
|
+
},
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"author": "DarkPhoenix2704",
|
|
20
|
+
"bin": {
|
|
21
|
+
"girlfriend": "bin/girlfriend"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"postinstall": "node install.js"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"install.js",
|
|
28
|
+
"bin/"
|
|
29
|
+
],
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=18"
|
|
32
|
+
}
|
|
33
|
+
}
|