@the-agenticflow/openflows 0.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.
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ const { spawn } = require('child_process');
3
+ const path = require('path');
4
+ const binaryPath = path.join(__dirname, '..', 'bin', 'openflows-dashboard-bin');
5
+ const proc = spawn(binaryPath, process.argv.slice(2), { stdio: 'inherit' });
6
+ proc.on('exit', (code) => process.exit(code));
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ const { spawn } = require('child_process');
3
+ const path = require('path');
4
+ const binaryPath = path.join(__dirname, '..', 'bin', 'openflows-doctor-bin');
5
+ const proc = spawn(binaryPath, process.argv.slice(2), { stdio: 'inherit' });
6
+ proc.on('exit', (code) => process.exit(code));
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ const { spawn } = require('child_process');
3
+ const path = require('path');
4
+ const binaryPath = path.join(__dirname, '..', 'bin', 'openflows-setup-bin');
5
+ const proc = spawn(binaryPath, process.argv.slice(2), { stdio: 'inherit' });
6
+ proc.on('exit', (code) => process.exit(code));
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ const { spawn } = require('child_process');
3
+ const path = require('path');
4
+ const binaryPath = path.join(__dirname, '..', 'bin', 'openflows-bin');
5
+ const proc = spawn(binaryPath, process.argv.slice(2), { stdio: 'inherit' });
6
+ proc.on('exit', (code) => process.exit(code));
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@the-agenticflow/openflows",
3
+ "version": "0.1.0",
4
+ "description": "Autonomous AI development team — turns GitHub issues into working PRs",
5
+ "main": "index.js",
6
+ "bin": {
7
+ "openflows": "./bin/openflows.js",
8
+ "openflows-setup": "./bin/openflows-setup.js",
9
+ "openflows-dashboard": "./bin/openflows-dashboard.js",
10
+ "openflows-doctor": "./bin/openflows-doctor.js"
11
+ },
12
+ "scripts": {
13
+ "postinstall": "node scripts/install.js"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/The-AgenticFlow/AgentFlow.git"
18
+ },
19
+ "keywords": ["ai", "autonomous", "development", "agents", "github"],
20
+ "author": "The AgenticFlow Team",
21
+ "license": "MIT",
22
+ "bugs": {
23
+ "url": "https://github.com/The-AgenticFlow/AgentFlow/issues"
24
+ },
25
+ "homepage": "https://openflows.dev",
26
+ "engines": {
27
+ "node": ">=18.0.0"
28
+ },
29
+ "os": ["darwin", "linux"],
30
+ "cpu": ["x64", "arm64"],
31
+ "optionalDependencies": {
32
+ "@openflows/linux-x64-gnu": "0.1.0",
33
+ "@openflows/linux-x64-musl": "0.1.0",
34
+ "@openflows/linux-arm64-gnu": "0.1.0",
35
+ "@openflows/darwin-x64": "0.1.0",
36
+ "@openflows/darwin-arm64": "0.1.0"
37
+ }
38
+ }
@@ -0,0 +1,169 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Post-install script: downloads the correct pre-built binary for the current platform.
4
+ */
5
+ const https = require('https');
6
+ const http = require('http');
7
+ const fs = require('fs');
8
+ const path = require('path');
9
+ const os = require('os');
10
+ const { execSync } = require('child_process');
11
+
12
+ const REPO = 'The-AgenticFlow/AgentFlow';
13
+ const BIN_DIR = path.join(__dirname, '..', 'bin');
14
+
15
+ function detectPlatform() {
16
+ const platform = os.platform();
17
+ const arch = os.arch();
18
+
19
+ let osPart, archPart;
20
+
21
+ switch (platform) {
22
+ case 'darwin':
23
+ osPart = 'apple-darwin';
24
+ break;
25
+ case 'linux':
26
+ // Check for musl
27
+ try {
28
+ const ldd = execSync('ldd --version 2>&1', { encoding: 'utf8' });
29
+ if (ldd.includes('musl')) {
30
+ osPart = 'unknown-linux-musl';
31
+ } else {
32
+ osPart = 'unknown-linux-gnu';
33
+ }
34
+ } catch {
35
+ osPart = 'unknown-linux-gnu';
36
+ }
37
+ break;
38
+ default:
39
+ console.error(`Unsupported platform: ${platform}`);
40
+ process.exit(1);
41
+ }
42
+
43
+ switch (arch) {
44
+ case 'x64':
45
+ archPart = 'x86_64';
46
+ break;
47
+ case 'arm64':
48
+ archPart = 'aarch64';
49
+ break;
50
+ default:
51
+ console.error(`Unsupported architecture: ${arch}`);
52
+ process.exit(1);
53
+ }
54
+
55
+ return `${archPart}-${osPart}`;
56
+ }
57
+
58
+ function download(url, dest) {
59
+ return new Promise((resolve, reject) => {
60
+ const parsed = new URL(url);
61
+ const client = parsed.protocol === 'https:' ? https : http;
62
+ const file = fs.createWriteStream(dest);
63
+
64
+ client.get(url, (response) => {
65
+ if (response.statusCode === 302 || response.statusCode === 301) {
66
+ download(response.headers.location, dest).then(resolve).catch(reject);
67
+ return;
68
+ }
69
+ if (response.statusCode !== 200) {
70
+ reject(new Error(`HTTP ${response.statusCode}: ${response.statusMessage}`));
71
+ return;
72
+ }
73
+ response.pipe(file);
74
+ file.on('finish', () => {
75
+ file.close();
76
+ resolve();
77
+ });
78
+ }).on('error', (err) => {
79
+ fs.unlink(dest, () => {});
80
+ reject(err);
81
+ });
82
+ });
83
+ }
84
+
85
+ function extractTarGz(tarPath, destDir) {
86
+ return new Promise((resolve, reject) => {
87
+ const tar = require('child_process').spawn('tar', ['-xzf', tarPath, '-C', destDir, '--strip-components=1']);
88
+ tar.on('close', (code) => {
89
+ if (code === 0) resolve();
90
+ else reject(new Error(`tar exited with code ${code}`));
91
+ });
92
+ });
93
+ }
94
+
95
+ async function main() {
96
+ const platform = detectPlatform();
97
+ console.log(`[@the-agenticflow/openflows] Downloading binary for ${platform}...`);
98
+
99
+ // Ensure bin directory exists
100
+ if (!fs.existsSync(BIN_DIR)) {
101
+ fs.mkdirSync(BIN_DIR, { recursive: true });
102
+ }
103
+
104
+ // Get latest release tag
105
+ const tag = await new Promise((resolve, reject) => {
106
+ https.get(`https://api.github.com/repos/${REPO}/releases/latest`, {
107
+ headers: { 'User-Agent': 'openflows-npm-installer' }
108
+ }, (res) => {
109
+ let data = '';
110
+ res.on('data', (chunk) => data += chunk);
111
+ res.on('end', () => {
112
+ try {
113
+ const json = JSON.parse(data);
114
+ resolve(json.tag_name);
115
+ } catch {
116
+ reject(new Error('Failed to parse release info'));
117
+ }
118
+ });
119
+ }).on('error', reject);
120
+ });
121
+
122
+ const archiveName = `openflows-${tag}-${platform}.tar.gz`;
123
+ const downloadUrl = `https://github.com/${REPO}/releases/download/${tag}/${archiveName}`;
124
+ const tmpFile = path.join(os.tmpdir(), archiveName);
125
+
126
+ try {
127
+ await download(downloadUrl, tmpFile);
128
+ await extractTarGz(tmpFile, BIN_DIR);
129
+
130
+ // Rename binaries to match expected names
131
+ const binaries = ['openflows', 'openflows-setup', 'openflows-dashboard', 'openflows-doctor'];
132
+ for (const bin of binaries) {
133
+ const src = path.join(BIN_DIR, bin);
134
+ const dst = path.join(BIN_DIR, `${bin}-bin`);
135
+ if (fs.existsSync(src)) {
136
+ fs.renameSync(src, dst);
137
+ fs.chmodSync(dst, 0o755);
138
+ }
139
+ }
140
+
141
+ fs.unlinkSync(tmpFile);
142
+ console.log(`[openflows] Installation complete!`);
143
+ } catch (err) {
144
+ console.error(`[openflows] Failed to download binary: ${err.message}`);
145
+ console.error('[openflows] Falling back to building from source...');
146
+
147
+ // Fallback: build from source
148
+ try {
149
+ execSync('cargo build --release -p openflows', { stdio: 'inherit', cwd: path.join(__dirname, '..') });
150
+ const releaseDir = path.join(__dirname, '..', 'target', 'release');
151
+ const binaries = ['openflows', 'openflows-setup', 'openflows-dashboard', 'openflows-doctor'];
152
+ for (const bin of binaries) {
153
+ const src = path.join(releaseDir, bin);
154
+ const dst = path.join(BIN_DIR, `${bin}-bin`);
155
+ if (fs.existsSync(src)) {
156
+ fs.copyFileSync(src, dst);
157
+ fs.chmodSync(dst, 0o755);
158
+ }
159
+ }
160
+ console.log('[openflows] Built from source successfully!');
161
+ } catch (buildErr) {
162
+ console.error(`[openflows] Build failed: ${buildErr.message}`);
163
+ console.error('[openflows] Please ensure Rust is installed: https://rustup.rs/');
164
+ process.exit(1);
165
+ }
166
+ }
167
+ }
168
+
169
+ main();