@rikipurpur/puru-ai 1.3.0 → 2.1.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/README.md CHANGED
@@ -1,31 +1,36 @@
1
- # @rikipurpur/puru-ai (npm)
1
+ # @rikipurpur/puru-ai
2
2
 
3
- CLI resmi PURU-AI — **tanpa web server** secara default.
4
- Binary Go di-download otomatis dari GitHub Releases saat install.
3
+ PURU-AI on npm — a lightweight, self-hosted Telegram AI assistant. No web
4
+ server by default. The Go binary is downloaded automatically from GitHub
5
+ Releases during install.
6
+
7
+ ## Quick start
5
8
 
6
9
  ```bash
7
10
  npm i -g @rikipurpur/puru-ai
8
- puru setup # wizard → tulis ~/.puru/config.json
9
- puru gateway # jalankan bot Telegram (long-polling, tanpa /health)
10
- puru gateway --health --port 8080 # opt-in health check (Docker/VPS)
11
- puru chat "halo" # debug lokal tanpa Telegram
11
+ puru setup # interactive wizard → writes ~/.puru/config.json
12
+ puru gateway # run the Telegram bot (long-polling, no /health endpoint)
13
+ puru gateway --health --port 8080 # opt-in health check for Docker/VPS
14
+ puru chat "hello" # local debugging without Telegram
12
15
  ```
13
16
 
14
- Non-interaktif (CI):
17
+ ## Non-interactive setup (CI)
15
18
 
16
19
  ```bash
17
- TELEGRAM_BOT_TOKEN=x PURU_BASE_URL=... PURU_API_KEY=... PURU_MODEL=puru \
20
+ TELEGRAM_BOT_TOKEN=x PURU_BASE_URL=https://api.openai.com/v1 \
21
+ PURU_API_KEY=sk-... PURU_MODEL=gpt-4o-mini \
18
22
  puru setup --force
19
23
  ```
20
24
 
21
- Env installer: `PURU_AI_VERSION` (default = versi package), `PURU_AI_REPO`
22
- (default `purujawa06-bot/PURU-AI`), `PURU_AI_BINARY` (pakai binary lokal),
23
- `PURU_AI_SKIP_DOWNLOAD=1` (skip download).
25
+ Installer environment variables: `PURU_AI_VERSION` (defaults to the package
26
+ version), `PURU_AI_REPO` (defaults to `purujawa06-bot/PURU-AI`),
27
+ `PURU_AI_BINARY` (use a local binary instead of downloading),
28
+ `PURU_AI_SKIP_DOWNLOAD=1` (skip the download step).
24
29
 
25
30
  ## Termux (Android)
26
31
 
27
- HP 64-bit (umum) pakai binary `puru-linux-arm64`, HP 32-bit pakai
28
- `puru-linux-arm` (armv7) — installer otomatis pilih yang benar.
32
+ Most 64-bit phones use the `puru-linux-arm64` binary; 32-bit phones use
33
+ `puru-linux-arm` (armv7) — the installer picks the right one automatically.
29
34
 
30
35
  ```bash
31
36
  pkg install nodejs
@@ -34,8 +39,14 @@ puru setup
34
39
  puru gateway
35
40
  ```
36
41
 
37
- Tips: jalankan di bawah `termux-wake-lock` agar bot tidak mati saat layar
38
- mati. Tanpa Node pun bisa — download binary langsung dari
42
+ Tip: run under `termux-wake-lock` so the bot stays alive when the screen is
43
+ off. Node.js is optional — you can download the binary straight from
39
44
  [Releases](https://github.com/purujawa06-bot/PURU-AI/releases)
40
- (`puru-linux-arm64` atau `puru-linux-arm`), `chmod +x`, lalu
45
+ (`puru-linux-arm64` or `puru-linux-arm`), `chmod +x` it, then run
41
46
  `./puru-linux-arm64 setup`.
47
+
48
+ ## Links
49
+
50
+ - Repository: <https://github.com/purujawa06-bot/PURU-AI>
51
+ - Issues: <https://github.com/purujawa06-bot/PURU-AI/issues>
52
+ - License: MIT
package/bin/puru.js CHANGED
@@ -7,9 +7,9 @@ const { binaryPath } = require('../scripts/binary');
7
7
 
8
8
  const bin = binaryPath();
9
9
  if (!fs.existsSync(bin)) {
10
- console.error(`[puru-ai] binary tidak ditemukan: ${bin}`);
11
- console.error('[puru-ai] Jalankan `npm rebuild -g @rikipurpur/puru-ai` atau reinstall.');
12
- console.error('[puru-ai] Alternatif: set PURU_AI_BINARY=/path/ke/puru');
10
+ console.error(`[puru-ai] binary not found: ${bin}`);
11
+ console.error('[puru-ai] Run `npm rebuild -g @rikipurpur/puru-ai` or reinstall.');
12
+ console.error('[puru-ai] Alternative: set PURU_AI_BINARY=/path/to/puru');
13
13
  process.exit(1);
14
14
  }
15
15
  const res = spawnSync(bin, process.argv.slice(2), { stdio: 'inherit' });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rikipurpur/puru-ai",
3
- "version": "1.3.0",
4
- "description": "PURU-AI CLI — setup & gateway Telegram bot tanpa web server. Binary Go dibungkus npm.",
3
+ "version": "2.1.0",
4
+ "description": "PURU-AI CLI — setup wizard and Telegram bot gateway (no web server). Self-contained Go binary distributed via npm.",
5
5
  "license": "MIT",
6
6
  "author": "Ricky",
7
7
  "homepage": "https://github.com/purujawa06-bot/PURU-AI",
package/scripts/binary.js CHANGED
@@ -8,7 +8,7 @@ function mapOS(platform = process.platform) {
8
8
  if (platform === 'darwin') return 'darwin';
9
9
  // Termux di Android lapor 'linux' — binary linux statik (CGO_ENABLED=0) jalan langsung.
10
10
  if (platform === 'linux' || platform === 'android') return 'linux';
11
- throw new Error(`OS tidak didukung: ${platform} (didukung: linux, darwin, windows)`);
11
+ throw new Error(`Unsupported OS: ${platform} (supported: linux, darwin, windows)`);
12
12
  }
13
13
 
14
14
  function mapArch(arch = process.arch) {
@@ -16,7 +16,7 @@ function mapArch(arch = process.arch) {
16
16
  if (arch === 'arm64') return 'arm64';
17
17
  // HP Android 32-bit (armv7) — Termux lapor 'arm'.
18
18
  if (arch === 'arm') return 'arm';
19
- throw new Error(`Arch tidak didukung: ${arch} (didukung: x64, arm64, arm)`);
19
+ throw new Error(`Unsupported arch: ${arch} (supported: x64, arm64, arm)`);
20
20
  }
21
21
 
22
22
  function assetName(goos, goarch) {
@@ -23,7 +23,7 @@ function fetch(url, dest, redirects = 5) {
23
23
  return new Promise((resolve, reject) => {
24
24
  https.get(url, { headers: { 'User-Agent': 'puru-ai-npm-install' } }, (res) => {
25
25
  if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
26
- if (redirects === 0) return reject(new Error('Terlalu banyak redirect'));
26
+ if (redirects === 0) return reject(new Error('Too many redirects'));
27
27
  res.resume();
28
28
  const next = res.headers.location.startsWith('http')
29
29
  ? res.headers.location
@@ -32,7 +32,7 @@ function fetch(url, dest, redirects = 5) {
32
32
  }
33
33
  if (res.statusCode !== 200) {
34
34
  res.resume();
35
- return reject(new Error(`Download gagal HTTP ${res.statusCode}: ${url}`));
35
+ return reject(new Error(`Download failed HTTP ${res.statusCode}: ${url}`));
36
36
  }
37
37
  const out = fs.createWriteStream(dest, { mode: 0o755 });
38
38
  res.pipe(out);
@@ -54,21 +54,21 @@ async function main() {
54
54
  const url = downloadURL({ repo, tag, goos, goarch });
55
55
  const dest = binaryPath();
56
56
  fs.mkdirSync(path.dirname(dest), { recursive: true });
57
- console.log(`[puru-ai] download ${assetName(goos, goarch)} ${tag} dari ${repo}...`);
57
+ console.log(`[puru-ai] downloading ${assetName(goos, goarch)} ${tag} from ${repo}...`);
58
58
  try {
59
59
  await fetch(url, dest);
60
60
  } catch (err) {
61
61
  try { fs.unlinkSync(dest); } catch (_) {}
62
- console.error(`[puru-ai] GAGAL: ${err.message}`);
63
- console.error(`[puru-ai] Cek release ada di https://github.com/${repo}/releases/tag/${tag}`);
64
- console.error(`[puru-ai] Atau set PURU_AI_BINARY=/path/ke/puru lalu install ulang.`);
62
+ console.error(`[puru-ai] FAILED: ${err.message}`);
63
+ console.error(`[puru-ai] Check the release at https://github.com/${repo}/releases/tag/${tag}`);
64
+ console.error(`[puru-ai] Or set PURU_AI_BINARY=/path/to/puru and reinstall.`);
65
65
  throw err;
66
66
  }
67
67
  if (goos !== 'windows') {
68
68
  try { fs.chmodSync(dest, 0o755); } catch (_) {}
69
69
  }
70
70
  console.log(`[puru-ai] OK: ${dest}`);
71
- console.log('[puru-ai] Lanjut: puru setup → puru gateway');
71
+ console.log('[puru-ai] Next: puru setup → puru gateway');
72
72
  }
73
73
 
74
74
  if (require.main === module) {