finny 1.0.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/finny ADDED
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { execFileSync } = require("child_process");
4
+ const path = require("path");
5
+ const fs = require("fs");
6
+
7
+ const PLATFORMS = {
8
+ "darwin-arm64": "finny-darwin-arm64",
9
+ "darwin-x64": "finny-darwin-x64",
10
+ "linux-arm64": "finny-linux-arm64",
11
+ "linux-x64": "finny-linux-x64",
12
+ "win32-x64": "finny-windows-x64",
13
+ };
14
+
15
+ function getBinaryPath() {
16
+ const platform = `${process.platform}-${process.arch}`;
17
+ const packageName = PLATFORMS[platform];
18
+
19
+ if (!packageName) {
20
+ console.error(`Unsupported platform: ${platform}`);
21
+ console.error(`Supported platforms: ${Object.keys(PLATFORMS).join(", ")}`);
22
+ process.exit(1);
23
+ }
24
+
25
+ // Try to find the binary in node_modules
26
+ const possiblePaths = [
27
+ // Installed as dependency
28
+ path.join(__dirname, "..", "node_modules", packageName, "bin", "finny"),
29
+ // Installed globally or via npx
30
+ path.join(__dirname, "..", "..", packageName, "bin", "finny"),
31
+ // Direct sibling (monorepo)
32
+ path.join(__dirname, "..", "..", "..", packageName, "bin", "finny"),
33
+ ];
34
+
35
+ // Add .exe for Windows
36
+ if (process.platform === "win32") {
37
+ possiblePaths.push(...possiblePaths.map(p => p + ".exe"));
38
+ }
39
+
40
+ for (const binaryPath of possiblePaths) {
41
+ if (fs.existsSync(binaryPath)) {
42
+ return binaryPath;
43
+ }
44
+ }
45
+
46
+ console.error(`Could not find finny binary for platform: ${platform}`);
47
+ console.error(`Expected package: ${packageName}`);
48
+ console.error(`Searched paths:`);
49
+ possiblePaths.forEach(p => console.error(` - ${p}`));
50
+ console.error(`\nTry reinstalling: npm install -g finny`);
51
+ process.exit(1);
52
+ }
53
+
54
+ try {
55
+ const binaryPath = getBinaryPath();
56
+ const args = process.argv.slice(2);
57
+
58
+ execFileSync(binaryPath, args, {
59
+ stdio: "inherit",
60
+ env: process.env,
61
+ });
62
+ } catch (error) {
63
+ if (error.status !== undefined) {
64
+ process.exit(error.status);
65
+ }
66
+ console.error(error.message);
67
+ process.exit(1);
68
+ }
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "finny",
3
+ "version": "1.0.0",
4
+ "description": "AI-powered quantitative trading CLI with TUI interface",
5
+ "keywords": ["trading", "quant", "cli", "tui", "ai", "algorithmic-trading"],
6
+ "author": "Finny",
7
+ "license": "MIT",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/Jaiminp007/finny.git"
11
+ },
12
+ "homepage": "https://github.com/Jaiminp007/finny",
13
+ "bugs": {
14
+ "url": "https://github.com/Jaiminp007/finny/issues"
15
+ },
16
+ "bin": {
17
+ "finny": "bin/finny"
18
+ },
19
+ "scripts": {
20
+ "postinstall": "node scripts/postinstall.js"
21
+ },
22
+ "optionalDependencies": {
23
+ "finny-darwin-arm64": "1.0.0",
24
+ "finny-darwin-x64": "1.0.0",
25
+ "finny-linux-arm64": "1.0.0",
26
+ "finny-linux-x64": "1.0.0",
27
+ "finny-windows-x64": "1.0.0"
28
+ },
29
+ "engines": {
30
+ "node": ">=18"
31
+ }
32
+ }
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require("fs");
4
+ const path = require("path");
5
+
6
+ const PLATFORMS = {
7
+ "darwin-arm64": "finny-darwin-arm64",
8
+ "darwin-x64": "finny-darwin-x64",
9
+ "linux-arm64": "finny-linux-arm64",
10
+ "linux-x64": "finny-linux-x64",
11
+ "win32-x64": "finny-windows-x64",
12
+ };
13
+
14
+ const platform = `${process.platform}-${process.arch}`;
15
+ const packageName = PLATFORMS[platform];
16
+
17
+ if (!packageName) {
18
+ console.warn(`\n[finny] Warning: Unsupported platform ${platform}`);
19
+ console.warn(`[finny] Supported: ${Object.keys(PLATFORMS).join(", ")}`);
20
+ console.warn(`[finny] The CLI may not work on this platform.\n`);
21
+ process.exit(0);
22
+ }
23
+
24
+ // Check if the platform package was installed
25
+ const possiblePaths = [
26
+ path.join(__dirname, "..", "node_modules", packageName),
27
+ path.join(__dirname, "..", "..", packageName),
28
+ path.join(__dirname, "..", "..", "..", packageName),
29
+ ];
30
+
31
+ const installed = possiblePaths.some(p => fs.existsSync(p));
32
+
33
+ if (!installed) {
34
+ console.warn(`\n[finny] Warning: Platform package ${packageName} not found`);
35
+ console.warn(`[finny] This might happen if optional dependencies are disabled`);
36
+ console.warn(`[finny] Try: npm install ${packageName}\n`);
37
+ }