pipely-ai 1.3.0 → 1.3.2

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/index.js +12 -30
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -2,12 +2,13 @@
2
2
 
3
3
  import { createInterface } from "node:readline/promises";
4
4
  import { createServer as createNetServer } from "node:net";
5
- import { randomBytes } from "node:crypto";
6
- import { execSync } from "node:child_process";
7
- import { writeFileSync, readFileSync, existsSync } from "node:fs";
5
+ import { randomBytes, randomUUID } from "node:crypto";
6
+ import { execSync, fork } from "node:child_process";
7
+ import { writeFileSync, readFileSync, existsSync, mkdirSync, unlinkSync, rmSync, createWriteStream } from "node:fs";
8
8
  import { join } from "node:path";
9
9
  import { platform, release, arch } from "node:os";
10
10
  import http from "node:http";
11
+ import https from "node:https";
11
12
 
12
13
  // ── ANSI Colors ──────────────────────────────────────
13
14
 
@@ -455,7 +456,6 @@ const BUNDLE_NAME = "pipely-local.tar.gz";
455
456
  async function getLatestReleaseUrl() {
456
457
  return new Promise((resolve) => {
457
458
  const url = `https://api.github.com/repos/${BUNDLE_REPO}/releases/latest`;
458
- const https = require("node:https");
459
459
  https.get(url, { headers: { "User-Agent": "pipely-cli" } }, (res) => {
460
460
  let body = "";
461
461
  res.on("data", (chunk) => (body += chunk));
@@ -474,9 +474,6 @@ async function getLatestReleaseUrl() {
474
474
 
475
475
  async function downloadFile(url, dest) {
476
476
  return new Promise((resolve, reject) => {
477
- const https = require("node:https");
478
- const fs = require("node:fs");
479
-
480
477
  function follow(url) {
481
478
  https.get(url, { headers: { "User-Agent": "pipely-cli" } }, (res) => {
482
479
  if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
@@ -487,7 +484,7 @@ async function downloadFile(url, dest) {
487
484
  reject(new Error(`HTTP ${res.statusCode}`));
488
485
  return;
489
486
  }
490
- const file = fs.createWriteStream(dest);
487
+ const file = createWriteStream(dest);
491
488
  res.pipe(file);
492
489
  file.on("finish", () => { file.close(); resolve(); });
493
490
  }).on("error", reject);
@@ -498,16 +495,8 @@ async function downloadFile(url, dest) {
498
495
  }
499
496
 
500
497
  function extractTarGz(file, dest) {
501
- const { mkdirSync } = require("node:fs");
502
498
  mkdirSync(dest, { recursive: true });
503
-
504
- const os = detectOS();
505
- if (os.platform === "win32") {
506
- // Windows: use tar (available since Windows 10)
507
- execSync(`tar -xzf "${file}" -C "${dest}"`, { stdio: "pipe" });
508
- } else {
509
- execSync(`tar -xzf "${file}" -C "${dest}"`, { stdio: "pipe" });
510
- }
499
+ execSync(`tar -xzf "${file}" -C "${dest}"`, { stdio: "pipe" });
511
500
  }
512
501
 
513
502
  function getLocalEnvPath() {
@@ -520,7 +509,7 @@ function isLocalInstalled() {
520
509
 
521
510
  function generateLocalEnv() {
522
511
  const jwtSecret = generateKey(64);
523
- const setupKey = require("node:crypto").randomUUID();
512
+ const setupKey = randomUUID();
524
513
 
525
514
  const env = `# Pipely AI — Local Mode
526
515
  DATABASE_URL=file:./data/pipely.db
@@ -536,11 +525,7 @@ VITE_API_URL=http://localhost:3333
536
525
  }
537
526
 
538
527
  async function installLocal() {
539
- printBanner();
540
-
541
528
  const os = detectOS();
542
- console.log(` Sistema: ${c.bold}${os.label}${c.reset} (${os.arch})`);
543
- console.log(` Modo: ${c.cyan}Local (sem Docker)${c.reset}\n`);
544
529
 
545
530
  // Check if already installed
546
531
  if (isLocalInstalled()) {
@@ -564,8 +549,7 @@ async function installLocal() {
564
549
  console.log(`${c.green}✓${c.reset}`);
565
550
 
566
551
  const tmpFile = join(PIPELY_DIR, BUNDLE_NAME);
567
- const { mkdirSync: mk } = require("node:fs");
568
- mk(PIPELY_DIR, { recursive: true });
552
+ mkdirSync(PIPELY_DIR, { recursive: true });
569
553
 
570
554
  process.stdout.write(` Baixando bundle... `);
571
555
  try {
@@ -589,7 +573,7 @@ async function installLocal() {
589
573
  }
590
574
 
591
575
  // Clean up tar
592
- try { require("node:fs").unlinkSync(tmpFile); } catch {}
576
+ try { unlinkSync(tmpFile); } catch {}
593
577
 
594
578
  // Install deps
595
579
  console.log(`\n ${c.magenta}── Instalando dependencias ────────────────${c.reset}\n`);
@@ -611,12 +595,12 @@ async function installLocal() {
611
595
  console.log(` ${c.green}✓${c.reset} .env gerado`);
612
596
 
613
597
  // Create data directory
614
- mk(join(PIPELY_DIR, "data"), { recursive: true });
598
+ mkdirSync(join(PIPELY_DIR, "data"), { recursive: true });
615
599
 
616
600
  // Setup database
617
601
  process.stdout.write(` Criando banco de dados... `);
618
602
  try {
619
- execSync("npx prisma db push --skip-generate", {
603
+ execSync("npx prisma db push", {
620
604
  cwd: join(PIPELY_DIR, "server"),
621
605
  stdio: "pipe",
622
606
  env: { ...process.env, DATABASE_URL: `file:${join(PIPELY_DIR, "data/pipely.db")}` },
@@ -652,7 +636,6 @@ async function runLocal() {
652
636
 
653
637
  console.log(` ${c.magenta}── Iniciando Pipely AI ────────────────────${c.reset}\n`);
654
638
 
655
- const { fork } = require("node:child_process");
656
639
  const envPath = getLocalEnvPath();
657
640
  const envContent = existsSync(envPath) ? readFileSync(envPath, "utf-8") : "";
658
641
  const envVars = {};
@@ -1220,8 +1203,7 @@ switch (command) {
1220
1203
  case "update":
1221
1204
  if (local) {
1222
1205
  // Delete and re-download bundle
1223
- const { rmSync: rm } = require("node:fs");
1224
- try { rm(PIPELY_DIR, { recursive: true }); } catch {}
1206
+ try { rmSync(PIPELY_DIR, { recursive: true }); } catch {}
1225
1207
  console.log(`\n ${c.dim}Reinstalando...${c.reset}\n`);
1226
1208
  installLocal().catch((err) => {
1227
1209
  console.error(`\n ${c.red}Erro: ${err.message}${c.reset}\n`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pipely-ai",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "Pipely AI — Instale, gerencie e atualize com um unico comando",
5
5
  "type": "module",
6
6
  "bin": {