create-vellaveto 4.0.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.
@@ -0,0 +1,6 @@
1
+ export declare const VERSION = "4.0.0";
2
+ export declare const IMAGE_TAG = "4.0.0";
3
+ export declare const IMAGE_REPO = "ghcr.io/paolovella/vellaveto";
4
+ export declare const DEFAULT_PORT = 3000;
5
+ export declare const DEFAULT_PROXY_PORT = 3001;
6
+ export declare const BANNER = "\n __ __ _ _ _\n \\ \\ / /__| | | __ ___ _____| |_ ___\n \\ \\ / / _ \\ | |/ _` \\ \\ / / _ \\ __/ _ \\\n \\ V / __/ | | (_| |\\ V / __/ || (_) |\n \\_/ \\___|_|_|\\__,_| \\_/ \\___|\\__\\___/\n\n MCP Tool Firewall \u2014 Setup Wizard v4.0.0\n";
@@ -0,0 +1,14 @@
1
+ export const VERSION = "4.0.0";
2
+ export const IMAGE_TAG = "4.0.0";
3
+ export const IMAGE_REPO = "ghcr.io/paolovella/vellaveto";
4
+ export const DEFAULT_PORT = 3000;
5
+ export const DEFAULT_PROXY_PORT = 3001;
6
+ export const BANNER = `
7
+ __ __ _ _ _
8
+ \\ \\ / /__| | | __ ___ _____| |_ ___
9
+ \\ \\ / / _ \\ | |/ _\` \\ \\ / / _ \\ __/ _ \\
10
+ \\ V / __/ | | (_| |\\ V / __/ || (_) |
11
+ \\_/ \\___|_|_|\\__,_| \\_/ \\___|\\__\\___/
12
+
13
+ MCP Tool Firewall — Setup Wizard v${VERSION}
14
+ `;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Binary download script generator.
3
+ *
4
+ * Produces a setup.sh that downloads the pre-built Vellaveto binary for
5
+ * the current platform and places it in ./bin/. Self-contained — just
6
+ * run `bash setup.sh` and the server starts.
7
+ */
8
+ import type { WizardState, GeneratedFile } from "../types.js";
9
+ export declare function generateBinaryFiles(state: WizardState): GeneratedFile[];
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Binary download script generator.
3
+ *
4
+ * Produces a setup.sh that downloads the pre-built Vellaveto binary for
5
+ * the current platform and places it in ./bin/. Self-contained — just
6
+ * run `bash setup.sh` and the server starts.
7
+ */
8
+ import { VERSION } from "../constants.js";
9
+ export function generateBinaryFiles(state) {
10
+ return [
11
+ {
12
+ path: "setup.sh",
13
+ content: generateSetupScript(state),
14
+ description: "Download + start script for Vellaveto binary",
15
+ },
16
+ ];
17
+ }
18
+ function generateSetupScript(state) {
19
+ return `#!/usr/bin/env bash
20
+ # Vellaveto ${VERSION} — setup script
21
+ # Generated by create-vellaveto
22
+ #
23
+ # This script downloads the Vellaveto binary for your platform,
24
+ # creates an .env file with your API key, and starts the server.
25
+ #
26
+ # Usage: bash setup.sh
27
+ set -euo pipefail
28
+
29
+ VERSION="${VERSION}"
30
+ REPO="paolovella/vellaveto"
31
+ INSTALL_DIR="./bin"
32
+ SCRIPT_DIR="$(cd "$(dirname "\${BASH_SOURCE[0]}")" && pwd)"
33
+
34
+ # Detect platform
35
+ OS="$(uname -s | tr '[:upper:]' '[:lower:]')"
36
+ ARCH="$(uname -m)"
37
+ case "\${ARCH}" in
38
+ x86_64|amd64) ARCH="x86_64" ;;
39
+ aarch64|arm64) ARCH="aarch64" ;;
40
+ *) echo "Error: Unsupported architecture: \${ARCH}" >&2; exit 1 ;;
41
+ esac
42
+
43
+ case "\${OS}" in
44
+ linux) TARGET="\${ARCH}-unknown-linux-gnu" ;;
45
+ darwin) TARGET="\${ARCH}-apple-darwin" ;;
46
+ *) echo "Error: Unsupported OS: \${OS}" >&2; exit 1 ;;
47
+ esac
48
+
49
+ TARBALL="vellaveto-\${VERSION}-\${TARGET}.tar.gz"
50
+ URL="https://github.com/\${REPO}/releases/download/v\${VERSION}/\${TARBALL}"
51
+
52
+ echo "==> Downloading Vellaveto \${VERSION} for \${TARGET}..."
53
+ mkdir -p "\${INSTALL_DIR}"
54
+ if ! curl -fsSL "\${URL}" -o "/tmp/\${TARBALL}"; then
55
+ echo ""
56
+ echo "Error: Download failed. Check that version \${VERSION} has a release for \${TARGET}."
57
+ echo " URL: \${URL}"
58
+ exit 1
59
+ fi
60
+
61
+ echo "==> Extracting to \${INSTALL_DIR}/..."
62
+ tar -xzf "/tmp/\${TARBALL}" -C "\${INSTALL_DIR}"
63
+ rm -f "/tmp/\${TARBALL}"
64
+ chmod +x "\${INSTALL_DIR}/vellaveto" "\${INSTALL_DIR}/vellaveto-http-proxy" 2>/dev/null || true
65
+
66
+ # Write .env if it doesn't exist
67
+ if [ ! -f "\${SCRIPT_DIR}/.env" ]; then
68
+ cat > "\${SCRIPT_DIR}/.env" << 'ENVEOF'
69
+ # Vellaveto environment variables — do not commit this file
70
+ VELLAVETO_API_KEY=${state.apiKey}
71
+ ENVEOF
72
+ echo "==> Wrote .env"
73
+ fi
74
+
75
+ echo ""
76
+ echo "Vellaveto is ready!"
77
+ echo ""
78
+ echo "Start the server:"
79
+ echo " cd \${SCRIPT_DIR}"
80
+ echo " source .env"
81
+ echo " \${INSTALL_DIR}/vellaveto serve --config vellaveto.toml"
82
+ echo ""
83
+ echo "Or start the HTTP proxy:"
84
+ echo " \${INSTALL_DIR}/vellaveto-http-proxy serve --config vellaveto.toml"
85
+ `;
86
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Docker Compose and .env file generator.
3
+ *
4
+ * Mirrors the production docker-compose.yml with security hardening:
5
+ * read_only, no-new-privileges, healthcheck, resource limits, tmpfs, logging.
6
+ */
7
+ import type { WizardState, GeneratedFile } from "../types.js";
8
+ export declare function generateDockerFiles(state: WizardState): GeneratedFile[];
@@ -0,0 +1,122 @@
1
+ /**
2
+ * Docker Compose and .env file generator.
3
+ *
4
+ * Mirrors the production docker-compose.yml with security hardening:
5
+ * read_only, no-new-privileges, healthcheck, resource limits, tmpfs, logging.
6
+ */
7
+ import { IMAGE_REPO, IMAGE_TAG, DEFAULT_PORT, DEFAULT_PROXY_PORT } from "../constants.js";
8
+ export function generateDockerFiles(state) {
9
+ return [
10
+ {
11
+ path: "docker-compose.yml",
12
+ content: generateDockerCompose(),
13
+ description: "Docker Compose with hardened Vellaveto services",
14
+ },
15
+ {
16
+ path: ".env",
17
+ content: generateDotEnv(state),
18
+ description: "Environment variables (contains API key — do not commit)",
19
+ },
20
+ ];
21
+ }
22
+ function generateDockerCompose() {
23
+ return `# Vellaveto — Docker Compose
24
+ #
25
+ # Usage:
26
+ # docker compose up -d # Start Vellaveto
27
+ # docker compose logs -f # Follow logs
28
+ # docker compose down # Stop
29
+ #
30
+ # Environment variables loaded from .env file automatically.
31
+
32
+ services:
33
+ vellaveto:
34
+ image: ${IMAGE_REPO}:${IMAGE_TAG}
35
+ ports:
36
+ - "${DEFAULT_PORT}:${DEFAULT_PORT}"
37
+ env_file:
38
+ - .env
39
+ environment:
40
+ - RUST_LOG=\${RUST_LOG:-info}
41
+ volumes:
42
+ - ./vellaveto.toml:/etc/vellaveto/config.toml:ro
43
+ - vellaveto-audit:/var/log/vellaveto
44
+ healthcheck:
45
+ test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:${DEFAULT_PORT}/health"]
46
+ interval: 30s
47
+ timeout: 5s
48
+ start_period: 10s
49
+ retries: 3
50
+ restart: unless-stopped
51
+ read_only: true
52
+ tmpfs:
53
+ - /tmp
54
+ security_opt:
55
+ - no-new-privileges:true
56
+ deploy:
57
+ resources:
58
+ limits:
59
+ cpus: "1.0"
60
+ memory: 256M
61
+ reservations:
62
+ cpus: "0.25"
63
+ memory: 64M
64
+ logging:
65
+ driver: "json-file"
66
+ options:
67
+ max-size: "10m"
68
+ max-file: "3"
69
+
70
+ vellaveto-proxy:
71
+ image: ${IMAGE_REPO}:${IMAGE_TAG}
72
+ entrypoint: ["vellaveto-http-proxy"]
73
+ command: ["--config", "/etc/vellaveto/config.toml", "--listen", "0.0.0.0:${DEFAULT_PROXY_PORT}"]
74
+ ports:
75
+ - "${DEFAULT_PROXY_PORT}:${DEFAULT_PROXY_PORT}"
76
+ env_file:
77
+ - .env
78
+ environment:
79
+ - RUST_LOG=\${RUST_LOG:-info}
80
+ volumes:
81
+ - ./vellaveto.toml:/etc/vellaveto/config.toml:ro
82
+ - vellaveto-audit:/var/log/vellaveto
83
+ healthcheck:
84
+ test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:${DEFAULT_PROXY_PORT}/health"]
85
+ interval: 30s
86
+ timeout: 5s
87
+ start_period: 10s
88
+ retries: 3
89
+ restart: unless-stopped
90
+ read_only: true
91
+ tmpfs:
92
+ - /tmp
93
+ security_opt:
94
+ - no-new-privileges:true
95
+ deploy:
96
+ resources:
97
+ limits:
98
+ cpus: "1.0"
99
+ memory: 256M
100
+ reservations:
101
+ cpus: "0.25"
102
+ memory: 64M
103
+ logging:
104
+ driver: "json-file"
105
+ options:
106
+ max-size: "10m"
107
+ max-file: "3"
108
+
109
+ volumes:
110
+ vellaveto-audit:
111
+ `;
112
+ }
113
+ function generateDotEnv(state) {
114
+ let env = "";
115
+ env += "# Vellaveto environment variables\n";
116
+ env += "# IMPORTANT: Do not commit this file to version control\n\n";
117
+ env += `VELLAVETO_API_KEY=${state.apiKey}\n`;
118
+ if (state.corsOrigins.length > 0) {
119
+ env += `VELLAVETO_CORS_ORIGINS=${state.corsOrigins.join(",")}\n`;
120
+ }
121
+ return env;
122
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Kubernetes / Helm values generator.
3
+ *
4
+ * Produces a vellaveto-values.yaml for `helm install -f` and a
5
+ * vellaveto-configmap.yaml for applying the TOML config via kubectl.
6
+ */
7
+ import type { WizardState, GeneratedFile } from "../types.js";
8
+ export declare function generateHelmFiles(state: WizardState): GeneratedFile[];
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Kubernetes / Helm values generator.
3
+ *
4
+ * Produces a vellaveto-values.yaml for `helm install -f` and a
5
+ * vellaveto-configmap.yaml for applying the TOML config via kubectl.
6
+ */
7
+ import { IMAGE_TAG } from "../constants.js";
8
+ import { generateToml } from "./toml.js";
9
+ export function generateHelmFiles(state) {
10
+ return [
11
+ {
12
+ path: "vellaveto-values.yaml",
13
+ content: generateValues(state),
14
+ description: "Helm values override for Vellaveto chart",
15
+ },
16
+ {
17
+ path: "vellaveto-configmap.yaml",
18
+ content: generateConfigMap(state),
19
+ description: "Kubernetes ConfigMap with Vellaveto TOML config",
20
+ },
21
+ ];
22
+ }
23
+ function generateValues(state) {
24
+ let yaml = "";
25
+ yaml += "# Vellaveto Helm values — generated by setup wizard\n";
26
+ yaml += "# Usage: helm install vellaveto oci://ghcr.io/paolovella/vellaveto/chart -f vellaveto-values.yaml\n\n";
27
+ yaml += `image:\n`;
28
+ yaml += ` tag: "${IMAGE_TAG}"\n\n`;
29
+ yaml += "securityContext:\n";
30
+ yaml += " runAsNonRoot: true\n";
31
+ yaml += " runAsUser: 1000\n";
32
+ yaml += " runAsGroup: 1000\n";
33
+ yaml += " readOnlyRootFilesystem: true\n";
34
+ yaml += " allowPrivilegeEscalation: false\n";
35
+ yaml += " capabilities:\n";
36
+ yaml += " drop:\n";
37
+ yaml += " - ALL\n\n";
38
+ yaml += "resources:\n";
39
+ yaml += " limits:\n";
40
+ yaml += " cpu: 500m\n";
41
+ yaml += " memory: 128Mi\n";
42
+ yaml += " requests:\n";
43
+ yaml += " cpu: 100m\n";
44
+ yaml += " memory: 64Mi\n\n";
45
+ yaml += "vellaveto:\n";
46
+ yaml += " logLevel: info\n";
47
+ yaml += " strictMode: true\n\n";
48
+ yaml += " injection:\n";
49
+ yaml += ` enabled: ${state.injectionEnabled}\n`;
50
+ yaml += ` blocking: ${state.injectionBlocking}\n\n`;
51
+ yaml += " dlp:\n";
52
+ yaml += ` enabled: ${state.dlpEnabled}\n`;
53
+ yaml += ` blocking: ${state.dlpBlocking}\n\n`;
54
+ yaml += " audit:\n";
55
+ yaml += ` redactionLevel: "${capitalize(state.redactionLevel)}"\n\n`;
56
+ yaml += " # API key should be provided via Kubernetes Secret:\n";
57
+ yaml += " # kubectl create secret generic vellaveto-api-key --from-literal=api-key=<YOUR_KEY>\n";
58
+ yaml += " extraEnv:\n";
59
+ yaml += " - name: VELLAVETO_API_KEY\n";
60
+ yaml += " valueFrom:\n";
61
+ yaml += " secretKeyRef:\n";
62
+ yaml += " name: vellaveto-api-key\n";
63
+ yaml += " key: api-key\n\n";
64
+ yaml += "metrics:\n";
65
+ yaml += " enabled: true\n";
66
+ yaml += " serviceMonitor:\n";
67
+ yaml += " enabled: false\n\n";
68
+ yaml += "probes:\n";
69
+ yaml += " liveness:\n";
70
+ yaml += " enabled: true\n";
71
+ yaml += " readiness:\n";
72
+ yaml += " enabled: true\n";
73
+ return yaml;
74
+ }
75
+ function generateConfigMap(state) {
76
+ const toml = generateToml(state);
77
+ // Indent each TOML line by 4 spaces for the ConfigMap data block
78
+ const indented = toml
79
+ .split("\n")
80
+ .map((line) => (line ? ` ${line}` : ""))
81
+ .join("\n");
82
+ let yaml = "";
83
+ yaml += "# Vellaveto ConfigMap — generated by setup wizard\n";
84
+ yaml += "# Usage: kubectl apply -f vellaveto-configmap.yaml\n";
85
+ yaml += "apiVersion: v1\n";
86
+ yaml += "kind: ConfigMap\n";
87
+ yaml += "metadata:\n";
88
+ yaml += " name: vellaveto-config\n";
89
+ yaml += " labels:\n";
90
+ yaml += " app.kubernetes.io/name: vellaveto\n";
91
+ yaml += " app.kubernetes.io/component: config\n";
92
+ yaml += "data:\n";
93
+ yaml += " config.toml: |\n";
94
+ yaml += indented;
95
+ yaml += "\n";
96
+ return yaml;
97
+ }
98
+ function capitalize(s) {
99
+ return s.charAt(0).toUpperCase() + s.slice(1);
100
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * SDK integration code snippet generator.
3
+ *
4
+ * Each snippet shows VellavetoClient construction, evaluate(), and verdict
5
+ * handling. Matches actual SDK APIs from sdk/{python,typescript,go,java}/.
6
+ */
7
+ import type { SdkLanguage } from "../types.js";
8
+ export declare function generateSnippet(language: SdkLanguage, apiKey: string): string;
9
+ export declare function installCommand(language: SdkLanguage): string;
@@ -0,0 +1,147 @@
1
+ /**
2
+ * SDK integration code snippet generator.
3
+ *
4
+ * Each snippet shows VellavetoClient construction, evaluate(), and verdict
5
+ * handling. Matches actual SDK APIs from sdk/{python,typescript,go,java}/.
6
+ */
7
+ import { DEFAULT_PORT } from "../constants.js";
8
+ export function generateSnippet(language, apiKey) {
9
+ switch (language) {
10
+ case "python":
11
+ return pythonSnippet(apiKey);
12
+ case "typescript":
13
+ return typescriptSnippet(apiKey);
14
+ case "go":
15
+ return goSnippet(apiKey);
16
+ case "java":
17
+ return javaSnippet(apiKey);
18
+ case "skip":
19
+ return "";
20
+ }
21
+ }
22
+ export function installCommand(language) {
23
+ switch (language) {
24
+ case "python":
25
+ return "pip install vellaveto";
26
+ case "typescript":
27
+ return "npm install vellaveto";
28
+ case "go":
29
+ return "go get github.com/paolovella/vellaveto/sdk/go";
30
+ case "java":
31
+ return "<!-- Add to pom.xml -->\n<dependency>\n <groupId>io.vellaveto</groupId>\n <artifactId>vellaveto-sdk</artifactId>\n <version>4.0.0</version>\n</dependency>";
32
+ case "skip":
33
+ return "";
34
+ }
35
+ }
36
+ function pythonSnippet(apiKey) {
37
+ return `from vellaveto import VellavetoClient
38
+
39
+ client = VellavetoClient(
40
+ url="http://localhost:${DEFAULT_PORT}",
41
+ api_key="${apiKey}",
42
+ )
43
+
44
+ result = client.evaluate(
45
+ tool="filesystem",
46
+ function="read_file",
47
+ parameters={"path": "/etc/passwd"},
48
+ )
49
+
50
+ if result.verdict == "Allow":
51
+ print("Action allowed")
52
+ elif result.verdict == "Deny":
53
+ print(f"Action denied: {result.reason}")
54
+ elif result.verdict == "RequireApproval":
55
+ print(f"Approval required: {result.reason}")
56
+ `;
57
+ }
58
+ function typescriptSnippet(apiKey) {
59
+ return `import { VellavetoClient } from "vellaveto";
60
+
61
+ const client = new VellavetoClient({
62
+ baseUrl: "http://localhost:${DEFAULT_PORT}",
63
+ apiKey: "${apiKey}",
64
+ });
65
+
66
+ const result = await client.evaluate({
67
+ tool: "filesystem",
68
+ function: "read_file",
69
+ parameters: { path: "/etc/passwd" },
70
+ });
71
+
72
+ if (result.verdict === "Allow") {
73
+ console.log("Action allowed");
74
+ } else if (result.verdict === "Deny") {
75
+ console.log(\`Action denied: \${result.reason}\`);
76
+ } else if (result.verdict === "RequireApproval") {
77
+ console.log(\`Approval required: \${result.reason}\`);
78
+ }
79
+ `;
80
+ }
81
+ function goSnippet(apiKey) {
82
+ return `package main
83
+
84
+ import (
85
+ "context"
86
+ "fmt"
87
+ "log"
88
+
89
+ "github.com/paolovella/vellaveto/sdk/go/vellaveto"
90
+ )
91
+
92
+ func main() {
93
+ client := vellaveto.NewClient(
94
+ "http://localhost:${DEFAULT_PORT}",
95
+ vellaveto.WithAPIKey("${apiKey}"),
96
+ )
97
+
98
+ result, err := client.Evaluate(context.Background(), &vellaveto.Action{
99
+ Tool: "filesystem",
100
+ Function: "read_file",
101
+ Parameters: map[string]any{
102
+ "path": "/etc/passwd",
103
+ },
104
+ })
105
+ if err != nil {
106
+ log.Fatal(err)
107
+ }
108
+
109
+ switch result.Verdict {
110
+ case "Allow":
111
+ fmt.Println("Action allowed")
112
+ case "Deny":
113
+ fmt.Printf("Action denied: %s\\n", result.Reason)
114
+ case "RequireApproval":
115
+ fmt.Printf("Approval required: %s\\n", result.Reason)
116
+ }
117
+ }
118
+ `;
119
+ }
120
+ function javaSnippet(apiKey) {
121
+ return `import io.vellaveto.VellavetoClient;
122
+ import io.vellaveto.model.Action;
123
+ import io.vellaveto.model.EvaluationResult;
124
+
125
+ import java.util.Map;
126
+
127
+ public class Example {
128
+ public static void main(String[] args) {
129
+ VellavetoClient client = VellavetoClient.builder("http://localhost:${DEFAULT_PORT}")
130
+ .apiKey("${apiKey}")
131
+ .build();
132
+
133
+ EvaluationResult result = client.evaluate(Action.builder()
134
+ .tool("filesystem")
135
+ .function("read_file")
136
+ .parameters(Map.of("path", "/etc/passwd"))
137
+ .build());
138
+
139
+ switch (result.getVerdict()) {
140
+ case "Allow" -> System.out.println("Action allowed");
141
+ case "Deny" -> System.out.println("Action denied: " + result.getReason());
142
+ case "RequireApproval" -> System.out.println("Approval required: " + result.getReason());
143
+ }
144
+ }
145
+ }
146
+ `;
147
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * TOML configuration generator.
3
+ *
4
+ * Output must match vellaveto-server/src/setup_wizard.rs generate_config_toml()
5
+ * (lines ~1596-1844) so configs are interchangeable between the web wizard and
6
+ * this CLI wizard.
7
+ */
8
+ import type { WizardState } from "../types.js";
9
+ export declare function generateToml(state: WizardState): string;