flowleap 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.
- package/bin/flowleap +20 -0
- package/install.mjs +72 -0
- package/package.json +31 -0
package/bin/flowleap
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { execFileSync } from "child_process";
|
|
3
|
+
import { join, dirname } from "path";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
5
|
+
import { existsSync } from "fs";
|
|
6
|
+
|
|
7
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
const isWindows = process.platform === "win32";
|
|
9
|
+
const bin = join(__dirname, isWindows ? "flowleap-native.exe" : "flowleap-native");
|
|
10
|
+
|
|
11
|
+
if (!existsSync(bin)) {
|
|
12
|
+
console.error("flowleap binary not found. Try reinstalling: npm i -g flowleap");
|
|
13
|
+
process.exit(1);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
try {
|
|
17
|
+
execFileSync(bin, process.argv.slice(2), { stdio: "inherit" });
|
|
18
|
+
} catch (err) {
|
|
19
|
+
process.exit(err.status ?? 1);
|
|
20
|
+
}
|
package/install.mjs
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { createWriteStream, chmodSync, mkdirSync, existsSync } from "fs";
|
|
2
|
+
import { join, dirname } from "path";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
import { get } from "https";
|
|
5
|
+
|
|
6
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
const REPO = "abdullahatrash/flowleap-cli";
|
|
8
|
+
const VERSION = "v0.1.0";
|
|
9
|
+
|
|
10
|
+
const PLATFORM_MAP = {
|
|
11
|
+
"darwin-arm64": "flowleap-darwin-aarch64",
|
|
12
|
+
"darwin-x64": "flowleap-darwin-x86_64",
|
|
13
|
+
"linux-arm64": "flowleap-linux-aarch64",
|
|
14
|
+
"linux-x64": "flowleap-linux-x86_64",
|
|
15
|
+
"win32-x64": "flowleap-windows-x86_64.exe",
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const key = `${process.platform}-${process.arch}`;
|
|
19
|
+
const asset = PLATFORM_MAP[key];
|
|
20
|
+
|
|
21
|
+
if (!asset) {
|
|
22
|
+
console.error(`Unsupported platform: ${key}`);
|
|
23
|
+
console.error(`Supported: ${Object.keys(PLATFORM_MAP).join(", ")}`);
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const binDir = join(__dirname, "bin");
|
|
28
|
+
const isWindows = process.platform === "win32";
|
|
29
|
+
const binaryName = isWindows ? "flowleap-native.exe" : "flowleap-native";
|
|
30
|
+
const binPath = join(binDir, binaryName);
|
|
31
|
+
|
|
32
|
+
if (existsSync(binPath)) {
|
|
33
|
+
process.exit(0);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
mkdirSync(binDir, { recursive: true });
|
|
37
|
+
|
|
38
|
+
const url = `https://github.com/${REPO}/releases/download/${VERSION}/${asset}`;
|
|
39
|
+
|
|
40
|
+
console.log(`Downloading flowleap ${VERSION} for ${key}...`);
|
|
41
|
+
|
|
42
|
+
function download(url) {
|
|
43
|
+
return new Promise((resolve, reject) => {
|
|
44
|
+
get(url, (res) => {
|
|
45
|
+
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
46
|
+
download(res.headers.location).then(resolve).catch(reject);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (res.statusCode !== 200) {
|
|
50
|
+
reject(new Error(`Download failed: HTTP ${res.statusCode}`));
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const file = createWriteStream(binPath);
|
|
54
|
+
res.pipe(file);
|
|
55
|
+
file.on("finish", () => {
|
|
56
|
+
file.close();
|
|
57
|
+
if (!isWindows) {
|
|
58
|
+
chmodSync(binPath, 0o755);
|
|
59
|
+
}
|
|
60
|
+
resolve();
|
|
61
|
+
});
|
|
62
|
+
file.on("error", reject);
|
|
63
|
+
}).on("error", reject);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
download(url)
|
|
68
|
+
.then(() => console.log("flowleap installed successfully!"))
|
|
69
|
+
.catch((err) => {
|
|
70
|
+
console.error(`Failed to install flowleap: ${err.message}`);
|
|
71
|
+
process.exit(1);
|
|
72
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "flowleap",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "One CLI for FlowLeap Patent AI — built for humans and AI agents",
|
|
5
|
+
"bin": {
|
|
6
|
+
"flowleap": "bin/flowleap"
|
|
7
|
+
},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"postinstall": "node install.mjs"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"patent",
|
|
13
|
+
"ai",
|
|
14
|
+
"cli",
|
|
15
|
+
"flowleap",
|
|
16
|
+
"epo",
|
|
17
|
+
"ops",
|
|
18
|
+
"ocr"
|
|
19
|
+
],
|
|
20
|
+
"author": "FlowLeap",
|
|
21
|
+
"type": "module",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "https://github.com/abdullahatrash/flowleap-cli"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "https://flowleap.co",
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=16"
|
|
30
|
+
}
|
|
31
|
+
}
|