@kubbisec/naus 1.0.2

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 (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +63 -0
  3. package/bin/naus.js +140 -0
  4. package/package.json +31 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 KubbiSec
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,63 @@
1
+ # @kubbisec/naus
2
+
3
+ Official **KubbiSec Naus** CLI — register runners, execute pipelines, and validate definitions against the KubbiSec control plane.
4
+
5
+ Naus connects your infrastructure to **KubbiSec CI/CD**: secure runner enrollment, remote job execution, and local pipeline workflows.
6
+
7
+ ## Features
8
+
9
+ - **Runner lifecycle** — register with a bootstrap token, start the agent, and report to your organization’s control plane.
10
+ - **Pipelines** — run YAML pipelines locally or integrate with hosted runs.
11
+ - **Validation** — catch pipeline errors before they hit the cluster.
12
+ - **Native binaries** — platform-specific executables via `optionalDependencies` (no `postinstall` scripts; compatible with `npm install --ignore-scripts`).
13
+
14
+ ## Requirements
15
+
16
+ - **Node.js** 18 or newer (for the global install and launcher).
17
+ - **Docker** (or equivalent) when jobs use containerized steps — see your organization’s documentation.
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ npm install -g @kubbisec/naus
23
+ ```
24
+
25
+ ## Quick start
26
+
27
+ ```bash
28
+ # Enroll a runner (replace URL with your KubbiSec API / enrollment endpoint)
29
+ naus register <bootstrap-token> --api https://your-api.example.com
30
+
31
+ # Start the runner process
32
+ naus start
33
+
34
+ # Run a pipeline file locally
35
+ naus run pipeline.yml
36
+
37
+ # Validate a pipeline without executing
38
+ naus validate pipeline.yml
39
+ ```
40
+
41
+ Run `naus --help` for the full command tree and flags.
42
+
43
+ ## Supported platforms
44
+
45
+ The meta-package `@kubbisec/naus` pulls the correct native binary for your OS and CPU:
46
+
47
+ | OS | Architecture | npm package |
48
+ |---------|--------------|--------------------------------|
49
+ | Linux | x64 | `@kubbisec/naus-linux-x64` |
50
+ | Linux | arm64 | `@kubbisec/naus-linux-arm64` |
51
+ | macOS | arm64 | `@kubbisec/naus-darwin-arm64` |
52
+ | Windows | x64 | `@kubbisec/naus-win32-x64` |
53
+
54
+ You normally **do not** install the platform packages directly; install `@kubbisec/naus` globally.
55
+
56
+
57
+ ## License
58
+
59
+ MIT — see `LICENSE` in this package.
60
+
61
+ ## Trademarks
62
+
63
+ **KubbiSec** and related marks are property of their respective owners. This package is distributed by KubbiSec for use with the KubbiSec platform.
package/bin/naus.js ADDED
@@ -0,0 +1,140 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * @kubbisec/naus — Launcher mínimo
5
+ *
6
+ * Detecta a plataforma e arquitetura do host, resolve o pacote de plataforma
7
+ * correspondente instalado via optionalDependencies e executa o binário nativo.
8
+ *
9
+ * Não depende de postinstall scripts. Funciona com --ignore-scripts=true.
10
+ */
11
+
12
+ "use strict";
13
+
14
+ const { execFileSync, spawn } = require("child_process");
15
+ const path = require("path");
16
+ const fs = require("fs");
17
+
18
+ // ---------------------------------------------------------------------------
19
+ // Mapeamento de plataforma + arch → nome do pacote npm
20
+ // ---------------------------------------------------------------------------
21
+
22
+ const PLATFORM_MAP = {
23
+ "linux-x64": "@kubbisec/naus-linux-x64",
24
+ "linux-arm64": "@kubbisec/naus-linux-arm64",
25
+ "darwin-arm64": "@kubbisec/naus-darwin-arm64",
26
+ "win32-x64": "@kubbisec/naus-win32-x64",
27
+ };
28
+
29
+ const platformKey = `${process.platform}-${process.arch}`;
30
+ const packageName = PLATFORM_MAP[platformKey];
31
+
32
+ if (!packageName) {
33
+ console.error(
34
+ `[naus] Plataforma não suportada: ${process.platform}/${process.arch}\n` +
35
+ `Plataformas suportadas: ${Object.keys(PLATFORM_MAP)
36
+ .map((k) => k.replace("-", "/"))
37
+ .join(", ")}`
38
+ );
39
+ process.exit(1);
40
+ }
41
+
42
+ // ---------------------------------------------------------------------------
43
+ // Resolver caminho do binário nativo
44
+ // ---------------------------------------------------------------------------
45
+
46
+ const binaryName = process.platform === "win32" ? "naus.exe" : "naus";
47
+
48
+ let binaryPath = null;
49
+
50
+ // Estratégia 1: require.resolve do pacote de plataforma
51
+ try {
52
+ const pkgDir = path.dirname(
53
+ require.resolve(`${packageName}/package.json`)
54
+ );
55
+ const candidate = path.join(pkgDir, "bin", binaryName);
56
+ if (fs.existsSync(candidate)) {
57
+ binaryPath = candidate;
58
+ }
59
+ } catch {
60
+ // pacote não encontrado via require.resolve
61
+ }
62
+
63
+ // Estratégia 2: busca relativa (quando instalado globalmente com npm)
64
+ if (!binaryPath) {
65
+ const globalSearchPaths = [
66
+ // npm global: node_modules ao lado deste pacote
67
+ path.resolve(__dirname, "..", "..", packageName, "bin", binaryName),
68
+ // pnpm global: node_modules/.pnpm/<pkg>/node_modules/<pkg>/bin
69
+ path.resolve(
70
+ __dirname,
71
+ "..",
72
+ "node_modules",
73
+ packageName,
74
+ "bin",
75
+ binaryName
76
+ ),
77
+ ];
78
+ for (const candidate of globalSearchPaths) {
79
+ if (fs.existsSync(candidate)) {
80
+ binaryPath = candidate;
81
+ break;
82
+ }
83
+ }
84
+ }
85
+
86
+ if (!binaryPath) {
87
+ console.error(
88
+ `[naus] Binário nativo não encontrado para ${process.platform}/${process.arch}.\n` +
89
+ `Pacote esperado: ${packageName}\n` +
90
+ `Tente reinstalar: npm install -g @kubbisec/naus`
91
+ );
92
+ process.exit(1);
93
+ }
94
+
95
+ // ---------------------------------------------------------------------------
96
+ // Garantir permissão de execução (Unix)
97
+ // ---------------------------------------------------------------------------
98
+
99
+ if (process.platform !== "win32") {
100
+ try {
101
+ fs.chmodSync(binaryPath, 0o755);
102
+ } catch {
103
+ // pode falhar se read-only; ignora
104
+ }
105
+ }
106
+
107
+ // ---------------------------------------------------------------------------
108
+ // Executar binário nativo herdando stdio, env e sinais
109
+ // ---------------------------------------------------------------------------
110
+
111
+ const child = spawn(binaryPath, process.argv.slice(2), {
112
+ stdio: "inherit",
113
+ env: process.env,
114
+ windowsHide: true,
115
+ });
116
+
117
+ // Propagar sinais
118
+ const forwardSignal = (signal) => {
119
+ try {
120
+ child.kill(signal);
121
+ } catch {
122
+ // processo já pode ter saído
123
+ }
124
+ };
125
+
126
+ process.on("SIGINT", () => forwardSignal("SIGINT"));
127
+ process.on("SIGTERM", () => forwardSignal("SIGTERM"));
128
+
129
+ child.on("error", (err) => {
130
+ console.error(`[naus] Falha ao executar binário: ${err.message}`);
131
+ process.exit(1);
132
+ });
133
+
134
+ child.on("exit", (code, signal) => {
135
+ if (signal) {
136
+ process.kill(process.pid, signal);
137
+ } else {
138
+ process.exit(code ?? 1);
139
+ }
140
+ });
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@kubbisec/naus",
3
+ "version": "1.0.2",
4
+ "description": "KubbiSec Naus CI/CD Runner — install globally, run anywhere",
5
+ "license": "MIT",
6
+ "bin": {
7
+ "naus": "bin/naus.js"
8
+ },
9
+ "files": [
10
+ "bin",
11
+ "README.md",
12
+ "LICENSE"
13
+ ],
14
+ "optionalDependencies": {
15
+ "@kubbisec/naus-linux-x64": "1.0.2",
16
+ "@kubbisec/naus-linux-arm64": "1.0.2",
17
+ "@kubbisec/naus-darwin-arm64": "1.0.2",
18
+ "@kubbisec/naus-win32-x64": "1.0.2"
19
+ },
20
+ "engines": {
21
+ "node": ">=18"
22
+ },
23
+ "keywords": [
24
+ "ci",
25
+ "cd",
26
+ "runner",
27
+ "pipeline",
28
+ "security",
29
+ "aspm"
30
+ ]
31
+ }