mafit 1.0.2-bin.0 → 1.0.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.
package/README.md CHANGED
@@ -1,3 +1,35 @@
1
- # mafit binaries
1
+ # mafit
2
2
 
3
- Prebuilt binaries for `mafit`.
3
+ Mafit local agent CLI.
4
+
5
+ ```bash
6
+ npm install -g mafit
7
+ mafit --help
8
+ ```
9
+
10
+ This package ships prebuilt native binaries. Users do not need Rust or Cargo.
11
+
12
+ ## Publisher workflow
13
+
14
+ Build the requested native targets and stage them into this package:
15
+
16
+ ```bash
17
+ cd npm
18
+ npm run build:binaries
19
+ ```
20
+
21
+ To build only one target:
22
+
23
+ ```bash
24
+ npm run build:binaries -- aarch64-apple-darwin
25
+ ```
26
+
27
+ The script builds `web/dist` first so the dashboard assets are embedded into the
28
+ Rust binary, then compiles the CLI and stages each output under `vendor/`.
29
+
30
+ After staging:
31
+
32
+ ```bash
33
+ npm pack --dry-run
34
+ npm publish
35
+ ```
Binary file
Binary file
Binary file
Binary file
package/bin/mafit.js ADDED
@@ -0,0 +1,65 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { spawn } from "node:child_process";
4
+ import { existsSync } from "node:fs";
5
+ import path from "node:path";
6
+ import { fileURLToPath } from "node:url";
7
+
8
+ const __filename = fileURLToPath(import.meta.url);
9
+ const __dirname = path.dirname(__filename);
10
+
11
+ const SUPPORTED_PLATFORM_KEYS = new Set([
12
+ "darwin-x64",
13
+ "darwin-arm64",
14
+ "linux-x64",
15
+ "linux-arm64",
16
+ "win32-x64",
17
+ "win32-arm64",
18
+ ]);
19
+
20
+ const platformKey = `${process.platform}-${process.arch}`;
21
+
22
+ if (!SUPPORTED_PLATFORM_KEYS.has(platformKey)) {
23
+ console.error(`Unsupported platform: ${process.platform} (${process.arch})`);
24
+ process.exit(1);
25
+ }
26
+
27
+ const binaryName = process.platform === "win32" ? "mafit.exe" : "mafit";
28
+ const binaryPath = path.join(__dirname, platformKey, binaryName);
29
+
30
+ if (!existsSync(binaryPath)) {
31
+ console.error(`Missing mafit binary for ${platformKey}: ${binaryPath}`);
32
+ console.error("Reinstall mafit or rebuild the npm package with npm run build:binaries.");
33
+ process.exit(1);
34
+ }
35
+
36
+ const child = spawn(binaryPath, process.argv.slice(2), {
37
+ stdio: "inherit",
38
+ env: {
39
+ ...process.env,
40
+ MAFIT_MANAGED_BY_NPM: "1",
41
+ },
42
+ });
43
+
44
+ child.on("error", (error) => {
45
+ console.error(error);
46
+ process.exit(1);
47
+ });
48
+
49
+ const forwardSignal = (signal) => {
50
+ if (!child.killed) {
51
+ child.kill(signal);
52
+ }
53
+ };
54
+
55
+ for (const signal of ["SIGINT", "SIGTERM", "SIGHUP"]) {
56
+ process.on(signal, () => forwardSignal(signal));
57
+ }
58
+
59
+ child.on("exit", (code, signal) => {
60
+ if (signal) {
61
+ process.kill(process.pid, signal);
62
+ return;
63
+ }
64
+ process.exit(code ?? 1);
65
+ });
Binary file
Binary file
package/package.json CHANGED
@@ -1,12 +1,21 @@
1
1
  {
2
2
  "name": "mafit",
3
- "version": "1.0.2-bin.0",
4
- "description": "Prebuilt binaries for mafit CLI",
5
- "license": "MIT",
3
+ "version": "1.0.3",
4
+ "description": "Mafit local agent CLI",
5
+ "license": "UNLICENSED",
6
+ "type": "module",
7
+ "bin": {
8
+ "mafit": "bin/mafit.js"
9
+ },
10
+ "engines": {
11
+ "node": ">=16"
12
+ },
6
13
  "files": [
7
- "dist/bin/**"
14
+ "bin",
15
+ "README.md"
8
16
  ],
9
- "publishConfig": {
10
- "access": "public"
17
+ "scripts": {
18
+ "build:binaries": "../scripts/build-npm-binaries.sh",
19
+ "pack:check": "npm pack --dry-run"
11
20
  }
12
21
  }
Binary file
Binary file