@mantra-ai/cli 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.
Files changed (2) hide show
  1. package/bin/mantra +53 -0
  2. package/package.json +18 -0
package/bin/mantra ADDED
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env node
2
+
3
+ "use strict";
4
+
5
+ const { execFileSync } = require("child_process");
6
+ const path = require("path");
7
+
8
+ const PLATFORM_PACKAGES = {
9
+ "darwin-arm64": "@mantra/cli-darwin-arm64",
10
+ "darwin-x64": "@mantra/cli-darwin-x64",
11
+ "linux-x64": "@mantra/cli-linux-x64",
12
+ "linux-arm64": "@mantra/cli-linux-arm64",
13
+ };
14
+
15
+ function getBinaryPath() {
16
+ // Allow override for local development/testing
17
+ if (process.env.MANTRA_BINARY_PATH) {
18
+ return path.resolve(process.env.MANTRA_BINARY_PATH);
19
+ }
20
+
21
+ const key = `${process.platform}-${process.arch}`;
22
+ const pkg = PLATFORM_PACKAGES[key];
23
+
24
+ if (!pkg) {
25
+ console.error(
26
+ `Unsupported platform: ${process.platform}-${process.arch}\n` +
27
+ `mantra currently supports: ${Object.keys(PLATFORM_PACKAGES).join(", ")}`
28
+ );
29
+ process.exit(1);
30
+ }
31
+
32
+ try {
33
+ return require.resolve(`${pkg}/bin/drylab`);
34
+ } catch {
35
+ console.error(
36
+ `Could not find the mantra binary for your platform (${key}).\n` +
37
+ `The package ${pkg} may not have been installed correctly.\n\n` +
38
+ `Try reinstalling: npm install -g mantra`
39
+ );
40
+ process.exit(1);
41
+ }
42
+ }
43
+
44
+ const binaryPath = getBinaryPath();
45
+
46
+ try {
47
+ execFileSync(binaryPath, process.argv.slice(2), { stdio: "inherit" });
48
+ } catch (err) {
49
+ if (err.status !== null) {
50
+ process.exit(err.status);
51
+ }
52
+ throw err;
53
+ }
package/package.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "@mantra-ai/cli",
3
+ "version": "0.1.0",
4
+ "description": "CLI for mantra — reverse-engineer research papers into structured data",
5
+ "license": "MIT",
6
+ "bin": {
7
+ "mantra": "bin/mantra"
8
+ },
9
+ "files": [
10
+ "bin/mantra"
11
+ ],
12
+ "optionalDependencies": {
13
+ "@mantra-ai/cli-darwin-arm64": "0.1.0",
14
+ "@mantra-ai/cli-darwin-x64": "0.1.0",
15
+ "@mantra-ai/cli-linux-x64": "0.1.0",
16
+ "@mantra-ai/cli-linux-arm64": "0.1.0"
17
+ }
18
+ }