@faramesh/cli 1.2.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 ADDED
@@ -0,0 +1,34 @@
1
+ # faramesh
2
+
3
+ AI agent execution control. Policy-driven governance for every tool call.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npx faramesh@latest init
9
+ ```
10
+
11
+ Or install globally:
12
+
13
+ ```bash
14
+ npm install -g faramesh
15
+ ```
16
+
17
+ ## What it does
18
+
19
+ Faramesh sits between your AI agent and the tools it calls. Every tool call is checked against your policy before it runs.
20
+
21
+ - **Permit** — the rule said yes, the action runs
22
+ - **Deny** — blocked, nothing runs, the agent is told why
23
+ - **Defer** — held for a human to approve or deny
24
+
25
+ ## Quick start
26
+
27
+ ```bash
28
+ faramesh run python agent.py
29
+ ```
30
+
31
+ ## Learn more
32
+
33
+ - [Documentation](https://faramesh.dev/docs)
34
+ - [GitHub](https://github.com/faramesh/faramesh-core)
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const { execFileSync } = require("child_process");
5
+ const path = require("path");
6
+ const os = require("os");
7
+ const fs = require("fs");
8
+
9
+ const ext = os.platform() === "win32" ? ".exe" : "";
10
+ const binPath = path.join(__dirname, `faramesh${ext}`);
11
+
12
+ if (!fs.existsSync(binPath)) {
13
+ console.error("faramesh binary not found. Run: npx faramesh@latest init");
14
+ console.error("Or install directly: curl -fsSL https://raw.githubusercontent.com/faramesh/faramesh-core/main/install.sh | bash");
15
+ process.exit(1);
16
+ }
17
+
18
+ try {
19
+ execFileSync(binPath, process.argv.slice(2), { stdio: "inherit" });
20
+ } catch (err) {
21
+ process.exit(err.status || 1);
22
+ }
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@faramesh/cli",
3
+ "version": "1.2.3",
4
+ "description": "AI agent execution control. Policy-driven governance for every tool call.",
5
+ "license": "MIT",
6
+ "homepage": "https://faramesh.dev",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/faramesh/faramesh-core.git"
10
+ },
11
+ "keywords": [
12
+ "ai",
13
+ "agent",
14
+ "governance",
15
+ "policy",
16
+ "security",
17
+ "llm",
18
+ "tool-calling",
19
+ "faramesh"
20
+ ],
21
+ "bin": "bin/faramesh-wrapper.js",
22
+ "scripts": {
23
+ "postinstall": "node ./scripts/install.js"
24
+ },
25
+ "files": [
26
+ "bin/",
27
+ "scripts/",
28
+ "README.md"
29
+ ],
30
+ "engines": {
31
+ "node": ">=16"
32
+ }
33
+ }
@@ -0,0 +1,80 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const { execSync } = require("child_process");
5
+ const fs = require("fs");
6
+ const path = require("path");
7
+ const https = require("https");
8
+ const os = require("os");
9
+
10
+ const VERSION = require("../package.json").version;
11
+ const BIN_DIR = path.join(__dirname, "..", "bin");
12
+
13
+ const PLATFORM_MAP = {
14
+ darwin: "darwin",
15
+ linux: "linux",
16
+ win32: "windows",
17
+ };
18
+
19
+ const ARCH_MAP = {
20
+ x64: "amd64",
21
+ arm64: "arm64",
22
+ };
23
+
24
+ function getDownloadUrl() {
25
+ const platform = PLATFORM_MAP[os.platform()];
26
+ const arch = ARCH_MAP[os.arch()];
27
+
28
+ if (!platform || !arch) {
29
+ console.error(`Unsupported platform: ${os.platform()} ${os.arch()}`);
30
+ process.exit(1);
31
+ }
32
+
33
+ const ext = platform === "windows" ? ".exe" : "";
34
+ return `https://github.com/faramesh/faramesh-core/releases/download/v${VERSION}/faramesh-${platform}-${arch}${ext}`;
35
+ }
36
+
37
+ function download(url, dest) {
38
+ return new Promise((resolve, reject) => {
39
+ const file = fs.createWriteStream(dest);
40
+ https
41
+ .get(url, (response) => {
42
+ if (response.statusCode === 302 || response.statusCode === 301) {
43
+ download(response.headers.location, dest).then(resolve).catch(reject);
44
+ return;
45
+ }
46
+ if (response.statusCode !== 200) {
47
+ reject(new Error(`Download failed: HTTP ${response.statusCode}`));
48
+ return;
49
+ }
50
+ response.pipe(file);
51
+ file.on("finish", () => {
52
+ file.close(resolve);
53
+ });
54
+ })
55
+ .on("error", reject);
56
+ });
57
+ }
58
+
59
+ async function main() {
60
+ const url = getDownloadUrl();
61
+ const ext = os.platform() === "win32" ? ".exe" : "";
62
+ const binPath = path.join(BIN_DIR, `faramesh${ext}`);
63
+
64
+ fs.mkdirSync(BIN_DIR, { recursive: true });
65
+
66
+ console.log(`Downloading faramesh v${VERSION}...`);
67
+ console.log(` ${url}`);
68
+
69
+ try {
70
+ await download(url, binPath);
71
+ fs.chmodSync(binPath, 0o755);
72
+ console.log(`Installed faramesh to ${binPath}`);
73
+ } catch (err) {
74
+ console.error(`Failed to download faramesh binary: ${err.message}`);
75
+ console.error("You can install manually: curl -fsSL https://raw.githubusercontent.com/faramesh/faramesh-core/main/install.sh | bash");
76
+ process.exit(1);
77
+ }
78
+ }
79
+
80
+ main();