@scanrail/cli 0.1.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.
package/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # Scanrail CLI
2
+
3
+ [![npm](https://img.shields.io/npm/v/@scanrail/cli.svg)](https://www.npmjs.com/package/@scanrail/cli)
4
+ [![CI](https://github.com/raeseoklee/scanrail/actions/workflows/ci.yml/badge.svg)](https://github.com/raeseoklee/scanrail/actions/workflows/ci.yml)
5
+ [![License](https://img.shields.io/github/license/raeseoklee/scanrail.svg)](https://github.com/raeseoklee/scanrail/blob/main/LICENSE)
6
+
7
+ Developer-first security scan orchestration from one CLI.
8
+
9
+ This package installs the `scanrail` command and delegates to the platform-specific Go binary package for macOS, Windows, or Linux.
10
+
11
+ ## Install
12
+
13
+ ```bash
14
+ npm install -g @scanrail/cli
15
+ scanrail doctor
16
+ ```
17
+
18
+ You can also run it without a global install:
19
+
20
+ ```bash
21
+ npx @scanrail/cli doctor
22
+ ```
23
+
24
+ ## First Scan
25
+
26
+ ```bash
27
+ scanrail init --non-interactive --project-name demo --target https://example.com
28
+ scanrail run --only headers
29
+ ```
30
+
31
+ The first release candidate includes the CLI scaffold, config generation, workspace setup, JSON/HTML reporting, and a native security headers scanner. Docker-backed adapters for Gitleaks, Trivy, and Semgrep are planned next.
32
+
33
+ ## Package Layout
34
+
35
+ `@scanrail/cli` is the wrapper package. It installs one optional platform package:
36
+
37
+ - `@scanrail/cli-darwin-arm64`
38
+ - `@scanrail/cli-darwin-x64`
39
+ - `@scanrail/cli-win32-x64`
40
+ - `@scanrail/cli-win32-arm64`
41
+ - `@scanrail/cli-linux-x64`
42
+ - `@scanrail/cli-linux-arm64`
43
+
44
+ ## Links
45
+
46
+ - Repository: https://github.com/raeseoklee/scanrail
47
+ - Documentation: https://github.com/raeseoklee/scanrail#readme
48
+ - Issues: https://github.com/raeseoklee/scanrail/issues
49
+
50
+ ## License
51
+
52
+ Apache-2.0
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env node
2
+ const { spawnSync } = require("node:child_process");
3
+
4
+ const platform = process.platform;
5
+ const arch = process.arch;
6
+ const suffix = `${platform}-${arch}`;
7
+ const packageName = `@scanrail/cli-${suffix}`;
8
+ const binaryName = platform === "win32" ? "scanrail.exe" : "scanrail";
9
+
10
+ let binary = process.env.SCANRAIL_BINARY_PATH;
11
+ if (!binary) {
12
+ try {
13
+ binary = require.resolve(`${packageName}/${binaryName}`);
14
+ } catch {
15
+ console.error(`Unsupported platform or missing package: ${platform}/${arch}`);
16
+ console.error(`Expected package: ${packageName}`);
17
+ process.exit(1);
18
+ }
19
+ }
20
+
21
+ const result = spawnSync(binary, process.argv.slice(2), {
22
+ stdio: "inherit",
23
+ shell: shouldUseShell(binary)
24
+ });
25
+
26
+ if (result.error) {
27
+ console.error(result.error.message);
28
+ process.exit(1);
29
+ }
30
+
31
+ if (result.signal) {
32
+ const signalOffset = 128;
33
+ const signalNumbers = { SIGINT: 2, SIGTERM: 15 };
34
+ process.exit(signalOffset + (signalNumbers[result.signal] ?? 1));
35
+ }
36
+
37
+ process.exit(result.status ?? 1);
38
+
39
+ function shouldUseShell(binaryPath) {
40
+ return process.platform === "win32" && /\.(cmd|bat)$/i.test(binaryPath);
41
+ }
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@scanrail/cli",
3
+ "version": "0.1.0",
4
+ "description": "Developer-first security scan orchestrator",
5
+ "license": "Apache-2.0",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/raeseoklee/scanrail.git",
9
+ "directory": "packages/npm/cli"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/raeseoklee/scanrail/issues"
13
+ },
14
+ "homepage": "https://github.com/raeseoklee/scanrail#readme",
15
+ "bin": {
16
+ "scanrail": "bin/scanrail.js"
17
+ },
18
+ "files": [
19
+ "bin/scanrail.js",
20
+ "README.md"
21
+ ],
22
+ "optionalDependencies": {
23
+ "@scanrail/cli-darwin-arm64": "0.1.0",
24
+ "@scanrail/cli-darwin-x64": "0.1.0",
25
+ "@scanrail/cli-linux-arm64": "0.1.0",
26
+ "@scanrail/cli-linux-x64": "0.1.0",
27
+ "@scanrail/cli-win32-arm64": "0.1.0",
28
+ "@scanrail/cli-win32-x64": "0.1.0"
29
+ },
30
+ "publishConfig": {
31
+ "access": "public"
32
+ },
33
+ "keywords": [
34
+ "security",
35
+ "security-scanner",
36
+ "devsecops",
37
+ "sast",
38
+ "dast",
39
+ "semgrep",
40
+ "trivy",
41
+ "gitleaks",
42
+ "owasp",
43
+ "cli"
44
+ ]
45
+ }