mafit 1.0.3 → 1.0.5

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
@@ -2,34 +2,23 @@
2
2
 
3
3
  Mafit local agent CLI.
4
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:
5
+ ## Install
15
6
 
16
7
  ```bash
17
- cd npm
18
- npm run build:binaries
8
+ npm install -g mafit
19
9
  ```
20
10
 
21
- To build only one target:
11
+ ## Update
22
12
 
23
13
  ```bash
24
- npm run build:binaries -- aarch64-apple-darwin
14
+ npm install -g mafit@latest
25
15
  ```
26
16
 
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:
17
+ ## Usage
31
18
 
32
19
  ```bash
33
- npm pack --dry-run
34
- npm publish
20
+ mafit --help
21
+ mafit login
22
+ mafit status
23
+ mafit web
35
24
  ```
package/bin/mafit.js CHANGED
@@ -2,34 +2,46 @@
2
2
 
3
3
  import { spawn } from "node:child_process";
4
4
  import { existsSync } from "node:fs";
5
+ import { createRequire } from "node:module";
5
6
  import path from "node:path";
6
7
  import { fileURLToPath } from "node:url";
7
8
 
8
9
  const __filename = fileURLToPath(import.meta.url);
9
10
  const __dirname = path.dirname(__filename);
11
+ const require = createRequire(import.meta.url);
10
12
 
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
- ]);
13
+ const PLATFORM_PACKAGE_BY_PLATFORM_ARCH = {
14
+ "darwin-x64": "mafit-darwin-x64",
15
+ "darwin-arm64": "mafit-darwin-arm64",
16
+ "linux-x64": "mafit-linux-x64",
17
+ "linux-arm64": "mafit-linux-arm64",
18
+ "win32-x64": "mafit-windows-x64",
19
+ "win32-arm64": "mafit-windows-arm64",
20
+ };
19
21
 
20
22
  const platformKey = `${process.platform}-${process.arch}`;
23
+ const packageName = PLATFORM_PACKAGE_BY_PLATFORM_ARCH[platformKey];
21
24
 
22
- if (!SUPPORTED_PLATFORM_KEYS.has(platformKey)) {
25
+ if (!packageName) {
23
26
  console.error(`Unsupported platform: ${process.platform} (${process.arch})`);
24
27
  process.exit(1);
25
28
  }
26
29
 
27
30
  const binaryName = process.platform === "win32" ? "mafit.exe" : "mafit";
28
- const binaryPath = path.join(__dirname, platformKey, binaryName);
31
+
32
+ let binaryPath;
33
+ try {
34
+ const packageJsonPath = require.resolve(`${packageName}/package.json`);
35
+ binaryPath = path.join(path.dirname(packageJsonPath), binaryName);
36
+ } catch {
37
+ console.error(`Missing optional platform package: ${packageName}`);
38
+ console.error("Reinstall mafit or install the matching platform package.");
39
+ process.exit(1);
40
+ }
29
41
 
30
42
  if (!existsSync(binaryPath)) {
31
43
  console.error(`Missing mafit binary for ${platformKey}: ${binaryPath}`);
32
- console.error("Reinstall mafit or rebuild the npm package with npm run build:binaries.");
44
+ console.error(`Expected optional platform package: ${packageName}`);
33
45
  process.exit(1);
34
46
  }
35
47
 
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "mafit",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Mafit local agent CLI",
5
- "license": "UNLICENSED",
5
+ "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "bin": {
8
8
  "mafit": "bin/mafit.js"
@@ -14,6 +14,14 @@
14
14
  "bin",
15
15
  "README.md"
16
16
  ],
17
+ "optionalDependencies": {
18
+ "mafit-linux-x64": "1.0.5",
19
+ "mafit-linux-arm64": "1.0.5",
20
+ "mafit-darwin-x64": "1.0.5",
21
+ "mafit-darwin-arm64": "1.0.5",
22
+ "mafit-windows-x64": "1.0.5",
23
+ "mafit-windows-arm64": "1.0.5"
24
+ },
17
25
  "scripts": {
18
26
  "build:binaries": "../scripts/build-npm-binaries.sh",
19
27
  "pack:check": "npm pack --dry-run"
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file