@kubbisec/ai 0.1.1

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.
Files changed (3) hide show
  1. package/README.md +69 -0
  2. package/bin/kubbisec.js +108 -0
  3. package/package.json +30 -0
package/README.md ADDED
@@ -0,0 +1,69 @@
1
+ # KubbiSec CLI (`kubbisec`)
2
+
3
+ Command-line assistant for [KubbiSec](https://kubbisec.com) — remediate findings, chat with security context, and run autopilot in your environment.
4
+
5
+ | | |
6
+ |---|---|
7
+ | **Package** | `@kubbisec/ai` |
8
+ | **Binary** | `kubbisec` |
9
+ | **Node.js** | 20+ |
10
+
11
+ **Platforms:** Linux x64, Linux arm64, macOS arm64 (Apple Silicon), Windows x64.
12
+
13
+ ## What it does
14
+
15
+ - **Remediate vulnerabilities** — AI-assisted fixes from ASPM findings, with optional auto-PR.
16
+ - **Interactive chat** — TUI with KubbiSec skills (pipelines, scanners, remediation, local `gh`/`git` when needed).
17
+ - **Autopilot watch** — background daemon that consumes remediation tasks from your org queue.
18
+ - **CLI hub** — when NAUS or ASPM are on `PATH`, run `kubbisec naus …` or `kubbisec aspm …` from one entry point.
19
+
20
+ LLM calls go through your KubbiSec API using **BYOK** (Settings → AI in the web app).
21
+
22
+ ## Install
23
+
24
+ ```bash
25
+ npm install -g @kubbisec/ai
26
+ kubbisec doctor
27
+ kubbisec login
28
+ ```
29
+
30
+ ## Quick start
31
+
32
+ Create an API key in the KubbiSec web UI (prefix `kbs_`), then:
33
+
34
+ ```bash
35
+ kubbisec login \
36
+ --api-url https://api.your-instance.example \
37
+ --api-key "$KBS_API_KEY" \
38
+ --org "$ORG_ID" \
39
+ --project "$PROJECT_ID"
40
+
41
+ kubbisec whoami
42
+ kubbisec ls
43
+ ```
44
+
45
+ Credentials are stored locally under `~/.kubbisec/ai/kubbisec.json`.
46
+
47
+ ## Commands
48
+
49
+ | Command | Description |
50
+ |---------|-------------|
51
+ | `kubbisec login` / `logout` / `whoami` | API session |
52
+ | `kubbisec doctor` | Config and API diagnostics |
53
+ | `kubbisec ls` / `show <id>` | Findings |
54
+ | `kubbisec fix <id>` | AI remediation |
55
+ | `kubbisec chat` | Interactive TUI |
56
+ | `kubbisec do` | Multi-step agent run |
57
+ | `kubbisec watch` | Autopilot daemon (heartbeat + tasks) |
58
+ | `kubbisec daemon list` / `stop` / `logs` | Manage watch sessions |
59
+ | `kubbisec naus …` / `kubbisec aspm …` | Forward to NAUS/ASPM when installed |
60
+
61
+ Run `kubbisec --help` for the full list.
62
+
63
+ ## Terms
64
+
65
+ The `kubbisec` CLI is distributed as prebuilt binaries for use with the [KubbiSec](https://kubbisec.com) platform. It is not open source. Use is subject to your agreement with KubbiSec.
66
+
67
+ ## Trademarks
68
+
69
+ **KubbiSec** and related marks are property of their respective owners.
@@ -0,0 +1,108 @@
1
+ #!/usr/bin/env node
2
+
3
+ "use strict";
4
+
5
+ const { spawn } = require("child_process");
6
+ const path = require("path");
7
+ const fs = require("fs");
8
+
9
+ const PLATFORM_MAP = {
10
+ "linux-x64": "@kubbisec/ai-linux-x64",
11
+ "linux-arm64": "@kubbisec/ai-linux-arm64",
12
+ "darwin-arm64": "@kubbisec/ai-darwin-arm64",
13
+ "win32-x64": "@kubbisec/ai-win32-x64",
14
+ };
15
+
16
+ const platformKey = `${process.platform}-${process.arch}`;
17
+ const packageName = PLATFORM_MAP[platformKey];
18
+
19
+ if (!packageName) {
20
+ console.error(
21
+ `[kubbisec] Unsupported platform: ${process.platform}/${process.arch}\n` +
22
+ `Supported: ${Object.keys(PLATFORM_MAP)
23
+ .map((k) => k.replace("-", "/"))
24
+ .join(", ")}`,
25
+ );
26
+ process.exit(1);
27
+ }
28
+
29
+ const binaryName = process.platform === "win32" ? "kubbisec.exe" : "kubbisec";
30
+
31
+ /** @type {string[]} */
32
+ const scopedParts = packageName.split("/");
33
+
34
+ let binaryPath = null;
35
+
36
+ try {
37
+ const pkgDir = path.dirname(require.resolve(`${packageName}/package.json`));
38
+ const candidate = path.join(pkgDir, "bin", binaryName);
39
+ if (fs.existsSync(candidate)) {
40
+ binaryPath = candidate;
41
+ }
42
+ } catch {
43
+ // optional dep may be missing
44
+ }
45
+
46
+ if (!binaryPath) {
47
+ const globalSearchPaths = [
48
+ path.resolve(__dirname, "..", "node_modules", ...scopedParts, "bin", binaryName),
49
+ path.resolve(__dirname, "..", "..", "..", ...scopedParts, "bin", binaryName),
50
+ ];
51
+ for (const candidate of globalSearchPaths) {
52
+ if (fs.existsSync(candidate)) {
53
+ binaryPath = candidate;
54
+ break;
55
+ }
56
+ }
57
+ }
58
+
59
+ if (!binaryPath) {
60
+ console.error(
61
+ `[kubbisec] Native binary not found for ${process.platform}/${process.arch}.\n` +
62
+ `Expected package: ${packageName}\n` +
63
+ `Install the platform binary (optional dependency), then retry:\n` +
64
+ ` npm install -g ${packageName}\n` +
65
+ `Or reinstall the meta package including optional deps:\n` +
66
+ ` npm install -g @kubbisec/ai --include=optional\n` +
67
+ `If optional installs are disabled globally, run: npm config delete omit`,
68
+ );
69
+ process.exit(1);
70
+ }
71
+
72
+ if (process.platform !== "win32") {
73
+ try {
74
+ fs.chmodSync(binaryPath, 0o755);
75
+ } catch {
76
+ // ignore
77
+ }
78
+ }
79
+
80
+ const child = spawn(binaryPath, process.argv.slice(2), {
81
+ stdio: "inherit",
82
+ env: process.env,
83
+ windowsHide: true,
84
+ });
85
+
86
+ const forwardSignal = (signal) => {
87
+ try {
88
+ child.kill(signal);
89
+ } catch {
90
+ // ignore
91
+ }
92
+ };
93
+
94
+ process.on("SIGINT", () => forwardSignal("SIGINT"));
95
+ process.on("SIGTERM", () => forwardSignal("SIGTERM"));
96
+
97
+ child.on("error", (err) => {
98
+ console.error(`[kubbisec] Failed to execute binary: ${err.message}`);
99
+ process.exit(1);
100
+ });
101
+
102
+ child.on("exit", (code, signal) => {
103
+ if (signal) {
104
+ process.kill(process.pid, signal);
105
+ } else {
106
+ process.exit(code ?? 1);
107
+ }
108
+ });
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@kubbisec/ai",
3
+ "version": "0.1.1",
4
+ "description": "KubbiSec CLI (kubbisec) — AI remediation, chat, autopilot watch, and CLI hub",
5
+ "license": "UNLICENSED",
6
+ "bin": {
7
+ "kubbisec": "bin/kubbisec.js"
8
+ },
9
+ "files": [
10
+ "bin",
11
+ "README.md"
12
+ ],
13
+ "optionalDependencies": {
14
+ "@kubbisec/ai-linux-x64": "0.1.1",
15
+ "@kubbisec/ai-linux-arm64": "0.1.1",
16
+ "@kubbisec/ai-darwin-arm64": "0.1.1",
17
+ "@kubbisec/ai-win32-x64": "0.1.1"
18
+ },
19
+ "engines": {
20
+ "node": ">=20"
21
+ },
22
+ "keywords": [
23
+ "kubbisec",
24
+ "aspm",
25
+ "security",
26
+ "ai",
27
+ "remediation",
28
+ "cli"
29
+ ]
30
+ }