pushci 0.5.1 → 0.5.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/bin/pushci.js +79 -39
  2. package/package.json +42 -15
package/bin/pushci.js CHANGED
@@ -4,65 +4,105 @@ const fs = require('fs');
4
4
  const path = require('path');
5
5
  const os = require('os');
6
6
 
7
- const VERSION = '0.5.1';
7
+ const VERSION = '0.5.2'; // downloads from GitHub release v0.5.2
8
8
  const BINARY_NAME = os.platform() === 'win32' ? 'pushci.exe' : 'pushci';
9
+ const REPO = 'finsavvyai/push-ci.dev';
10
+
11
+ const PLATFORM_MAP = {
12
+ darwin: 'darwin', linux: 'linux', win32: 'windows',
13
+ };
14
+ const ARCH_MAP = {
15
+ x64: 'amd64', arm64: 'arm64',
16
+ };
9
17
 
10
18
  function getBinaryPath() {
11
- // Check if Go binary exists locally
12
19
  const local = path.join(__dirname, '..', BINARY_NAME);
13
20
  if (fs.existsSync(local)) return local;
14
21
 
15
- // Check PATH
16
22
  try {
17
- const which = os.platform() === 'win32' ? 'where' : 'which';
18
- return execSync(`${which} pushci`, { encoding: 'utf8' }).trim();
23
+ const cmd = os.platform() === 'win32' ? 'where' : 'which';
24
+ const found = execSync(`${cmd} pushci`, { encoding: 'utf8' }).trim();
25
+ if (found) return found;
19
26
  } catch (_) {}
20
27
 
21
- // Download pre-built binary
22
- return downloadBinary();
28
+ return downloadOrBuild();
23
29
  }
24
30
 
25
- function downloadBinary() {
26
- const platform = os.platform();
27
- const arch = os.arch();
28
- const ext = platform === 'win32' ? '.exe' : '';
29
- const target = path.join(os.tmpdir(), `pushci${ext}`);
31
+ function downloadOrBuild() {
32
+ const plat = PLATFORM_MAP[os.platform()];
33
+ const arch = ARCH_MAP[os.arch()];
34
+ const ext = os.platform() === 'win32' ? '.exe' : '';
35
+ const target = path.join(os.tmpdir(), `pushci-${VERSION}${ext}`);
30
36
 
31
- if (fs.existsSync(target)) return target;
37
+ if (fs.existsSync(target) && isValidBinary(target)) return target;
32
38
 
33
- console.log('Downloading pushci binary...');
34
- const url = `https://github.com/finsavvyai/pushci/releases/download/v${VERSION}/pushci-${platform}-${arch}${ext}`;
39
+ if (plat && arch) {
40
+ const url = `https://github.com/${REPO}/releases/download/v${VERSION}/pushci-${plat}-${arch}${ext}`;
41
+ console.log(`Downloading pushci v${VERSION}...`);
42
+ try {
43
+ execSync(`curl -sfL --retry 2 -o "${target}" "${url}"`, { timeout: 30000 });
44
+ if (isValidBinary(target)) {
45
+ fs.chmodSync(target, 0o755);
46
+ return target;
47
+ }
48
+ try { fs.unlinkSync(target); } catch (_) {}
49
+ } catch (_) {}
50
+ }
35
51
 
36
52
  try {
37
- execSync(`curl -sL -o "${target}" "${url}"`);
38
- fs.chmodSync(target, 0o755);
39
- return target;
40
- } catch (_) {
41
- // Fallback: build from source if Go is available
42
- return buildFromSource();
43
- }
53
+ execSync('go version', { stdio: 'ignore' });
54
+ console.log('Building pushci from source...');
55
+ const out = path.join(os.tmpdir(), BINARY_NAME);
56
+ execSync(`go build -o "${out}" ./cmd/pushci`, {
57
+ cwd: path.join(__dirname, '..'),
58
+ stdio: 'inherit',
59
+ timeout: 120000,
60
+ });
61
+ if (fs.existsSync(out)) return out;
62
+ } catch (_) {}
63
+
64
+ printInstallHelp();
65
+ process.exit(1);
44
66
  }
45
67
 
46
- function buildFromSource() {
47
- console.log('Building pushci from source...');
48
- const src = path.join(__dirname, '..');
49
- const out = path.join(os.tmpdir(), BINARY_NAME);
68
+ function isValidBinary(filepath) {
50
69
  try {
51
- execSync(`go build -o "${out}" ./cmd/pushci`, { cwd: src });
52
- return out;
53
- } catch (_) {
54
- console.error('Error: Could not find or build pushci binary.');
55
- console.error('');
56
- console.error('Install alternatives:');
57
- console.error(' curl -sSL https://pushci.dev/install | bash');
58
- console.error(' brew install finsavvyai/tap/pushci');
59
- console.error(' go install github.com/finsavvyai/pushci/cmd/pushci@latest');
60
- console.error('');
61
- console.error('Or install Go: https://go.dev/dl');
62
- process.exit(1);
63
- }
70
+ const stat = fs.statSync(filepath);
71
+ if (stat.size < 1024) return false;
72
+ const buf = Buffer.alloc(4);
73
+ const fd = fs.openSync(filepath, 'r');
74
+ fs.readSync(fd, buf, 0, 4, 0);
75
+ fs.closeSync(fd);
76
+ if (buf[0] === 0x7f && buf[1] === 0x45) return true;
77
+ if (buf[0] === 0xcf && buf[1] === 0xfa) return true;
78
+ if (buf[0] === 0xfe && buf[1] === 0xed) return true;
79
+ if (buf[0] === 0x4d && buf[1] === 0x5a) return true;
80
+ return false;
81
+ } catch (_) { return false; }
82
+ }
83
+
84
+ function printInstallHelp() {
85
+ console.error('');
86
+ console.error('pushci: could not download or build the binary.');
87
+ console.error('');
88
+ console.error('Install pushci directly:');
89
+ console.error(' curl -sSL https://pushci.dev/install | bash');
90
+ console.error(' brew install finsavvyai/tap/pushci');
91
+ console.error(' go install github.com/finsavvyai/pushci/cmd/pushci@latest');
92
+ console.error('');
93
+ console.error("Don't have npm/npx? Install Node.js first:");
94
+ console.error(' macOS: brew install node');
95
+ console.error(' Linux: curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - && sudo apt-get install -y nodejs');
96
+ console.error(' Windows: https://nodejs.org');
97
+ console.error('');
98
+ console.error('Or install Go: https://go.dev/dl');
64
99
  }
65
100
 
66
101
  const binary = getBinaryPath();
67
102
  const child = spawn(binary, process.argv.slice(2), { stdio: 'inherit' });
103
+ child.on('error', (err) => {
104
+ console.error(`pushci: failed to start — ${err.message}`);
105
+ printInstallHelp();
106
+ process.exit(1);
107
+ });
68
108
  child.on('exit', (code) => process.exit(code || 0));
package/package.json CHANGED
@@ -1,33 +1,60 @@
1
1
  {
2
2
  "name": "pushci",
3
- "version": "0.5.1",
3
+ "version": "0.5.3",
4
4
  "description": "Zero-config AI CI/CD — auto-detects your stack, runs on your machine",
5
5
  "bin": {
6
- "pushci": "./bin/pushci.js"
6
+ "pushci": "bin/pushci.js"
7
7
  },
8
8
  "files": [
9
- "bin/",
9
+ "bin/pushci.js",
10
10
  "README.md",
11
11
  "LICENSE"
12
12
  ],
13
- "scripts": {
14
- "postinstall": "node bin/pushci.js version"
15
- },
13
+ "scripts": {},
16
14
  "keywords": [
17
- "ci", "cd", "cicd", "continuous-integration", "continuous-deployment",
18
- "github-actions", "github-actions-alternative", "gitlab-ci", "circleci",
19
- "jenkins-alternative", "travis-ci-alternative", "buildkite-alternative",
20
- "zero-config", "yaml-free", "local", "self-hosted",
21
- "ai", "ai-cicd", "ai-devops", "mcp", "mcp-server", "model-context-protocol",
22
- "devops", "deploy", "pipeline", "automation",
23
- "go", "node", "python", "rust", "java", "docker", "typescript",
24
- "claude", "cursor", "windsurf", "copilot"
15
+ "ci",
16
+ "cd",
17
+ "cicd",
18
+ "continuous-integration",
19
+ "continuous-deployment",
20
+ "github-actions",
21
+ "github-actions-alternative",
22
+ "gitlab-ci",
23
+ "circleci",
24
+ "jenkins-alternative",
25
+ "travis-ci-alternative",
26
+ "buildkite-alternative",
27
+ "zero-config",
28
+ "yaml-free",
29
+ "local",
30
+ "self-hosted",
31
+ "ai",
32
+ "ai-cicd",
33
+ "ai-devops",
34
+ "mcp",
35
+ "mcp-server",
36
+ "model-context-protocol",
37
+ "devops",
38
+ "deploy",
39
+ "pipeline",
40
+ "automation",
41
+ "go",
42
+ "node",
43
+ "python",
44
+ "rust",
45
+ "java",
46
+ "docker",
47
+ "typescript",
48
+ "claude",
49
+ "cursor",
50
+ "windsurf",
51
+ "copilot"
25
52
  ],
26
53
  "author": "FinsavvyAI",
27
54
  "license": "MIT",
28
55
  "repository": {
29
56
  "type": "git",
30
- "url": "https://github.com/finsavvyai/pushci"
57
+ "url": "git+https://github.com/finsavvyai/pushci.git"
31
58
  },
32
59
  "homepage": "https://pushci.dev",
33
60
  "engines": {