@favcrm/cli 0.1.4

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/favcrm.js ADDED
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ // Launcher for the `favcrm` CLI. The real binary ships in a per-platform
5
+ // optional dependency (@favcrm/cli-<platform>-<arch>); npm installs only the
6
+ // one matching the host. This shim resolves it and execs it.
7
+
8
+ const { execFileSync } = require("node:child_process");
9
+
10
+ const PLATFORM_PACKAGES = {
11
+ "darwin arm64": "@favcrm/cli-darwin-arm64",
12
+ "linux arm64": "@favcrm/cli-linux-arm64",
13
+ "linux x64": "@favcrm/cli-linux-x64",
14
+ "win32 x64": "@favcrm/cli-win32-x64",
15
+ };
16
+
17
+ function resolveBinary() {
18
+ const key = `${process.platform} ${process.arch}`;
19
+ const pkg = PLATFORM_PACKAGES[key];
20
+ if (!pkg) {
21
+ throw new Error(
22
+ `favcrm: no prebuilt binary for ${key}. ` +
23
+ `See https://github.com/favcrm/cli/releases`,
24
+ );
25
+ }
26
+ const exe = process.platform === "win32" ? "favcrm.exe" : "favcrm";
27
+ try {
28
+ return require.resolve(`${pkg}/bin/${exe}`);
29
+ } catch {
30
+ throw new Error(
31
+ `favcrm: the ${pkg} package is missing. ` +
32
+ `Reinstall with optional dependencies enabled ` +
33
+ `(npm install favcrm).`,
34
+ );
35
+ }
36
+ }
37
+
38
+ try {
39
+ execFileSync(resolveBinary(), process.argv.slice(2), { stdio: "inherit" });
40
+ } catch (err) {
41
+ if (typeof err.status === "number") {
42
+ process.exit(err.status);
43
+ }
44
+ console.error(err.message || String(err));
45
+ process.exit(1);
46
+ }
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ // postinstall: warn (do not fail) if no per-platform binary package was
4
+ // installed for this host. npm skips optionalDependencies that fail or do
5
+ // not match os/cpu, so a missing one is a soft problem we surface early.
6
+
7
+ const PLATFORM_PACKAGES = {
8
+ "darwin arm64": "@favcrm/cli-darwin-arm64",
9
+ "linux arm64": "@favcrm/cli-linux-arm64",
10
+ "linux x64": "@favcrm/cli-linux-x64",
11
+ "win32 x64": "@favcrm/cli-win32-x64",
12
+ };
13
+
14
+ const key = `${process.platform} ${process.arch}`;
15
+ const pkg = PLATFORM_PACKAGES[key];
16
+
17
+ if (!pkg) {
18
+ console.warn(
19
+ `favcrm: no prebuilt binary for ${key}. ` +
20
+ `See https://github.com/favcrm/cli/releases`,
21
+ );
22
+ } else {
23
+ const exe = process.platform === "win32" ? "favcrm.exe" : "favcrm";
24
+ try {
25
+ require.resolve(`${pkg}/bin/${exe}`);
26
+ } catch {
27
+ console.warn(
28
+ `favcrm: ${pkg} was not installed. If the CLI fails to run, ` +
29
+ `reinstall with optional dependencies enabled.`,
30
+ );
31
+ }
32
+ }
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@favcrm/cli",
3
+ "version": "0.1.4",
4
+ "description": "FavCRM CLI — talk to FavCRM from your terminal via the MCP API.",
5
+ "homepage": "https://favcrm.io",
6
+ "repository": "github:favcrm/cli",
7
+ "license": "MIT",
8
+ "keywords": [
9
+ "favcrm",
10
+ "crm",
11
+ "cli",
12
+ "mcp"
13
+ ],
14
+ "bin": {
15
+ "favcrm": "bin/favcrm.js"
16
+ },
17
+ "files": [
18
+ "bin/favcrm.js",
19
+ "install-check.js"
20
+ ],
21
+ "scripts": {
22
+ "postinstall": "node install-check.js"
23
+ },
24
+ "optionalDependencies": {
25
+ "@favcrm/cli-darwin-arm64": "0.1.4",
26
+ "@favcrm/cli-linux-arm64": "0.1.4",
27
+ "@favcrm/cli-linux-x64": "0.1.4",
28
+ "@favcrm/cli-win32-x64": "0.1.4"
29
+ },
30
+ "engines": {
31
+ "node": ">=18"
32
+ }
33
+ }