@r4security/cli 0.0.2 → 0.0.5
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 +58 -10
- package/lib/index.js +1616 -294
- package/lib/index.js.map +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -12,16 +12,32 @@ Requires Node.js >= 18.0.0.
|
|
|
12
12
|
|
|
13
13
|
## Commands
|
|
14
14
|
|
|
15
|
+
### `r4 agent`
|
|
16
|
+
Bootstrap the local runtime.
|
|
17
|
+
- `r4 agent init` -- Read credentials, generate/reuse a private key, register the public key, save the profile, and run a health check
|
|
18
|
+
|
|
15
19
|
### `r4 auth`
|
|
16
20
|
Manage API key authentication.
|
|
17
|
-
- `r4 auth login` --
|
|
18
|
-
- `r4 auth logout` -- Remove
|
|
21
|
+
- `r4 auth login` -- Save API key credentials to a named profile
|
|
22
|
+
- `r4 auth logout` -- Remove saved credentials
|
|
19
23
|
- `r4 auth status` -- Show current authentication state
|
|
24
|
+
- `r4 auth whoami` -- Show the current profile identity and runtime target
|
|
25
|
+
- `r4 auth diagnose` -- Alias for `r4 doctor`
|
|
26
|
+
|
|
27
|
+
### `r4 doctor`
|
|
28
|
+
Verify API key auth, public-key registration, visible vaults, wrapped keys, and zero-trust health.
|
|
29
|
+
|
|
30
|
+
### `r4 profile`
|
|
31
|
+
Manage saved CLI profiles.
|
|
32
|
+
- `r4 profile list` -- List saved profiles
|
|
33
|
+
- `r4 profile use <name>` -- Switch the active profile
|
|
20
34
|
|
|
21
35
|
### `r4 vault`
|
|
22
36
|
Manage vault secrets.
|
|
23
37
|
- `r4 vault list` -- List locally decrypted environment variables
|
|
24
38
|
- `r4 vault get <name>` -- Get a specific locally decrypted secret
|
|
39
|
+
- `r4 vault list-items` -- List vault item metadata without local decryption
|
|
40
|
+
- `r4 vault items --metadata-only` -- Metadata-only alias when decryption is failing
|
|
25
41
|
|
|
26
42
|
### `r4 project`
|
|
27
43
|
Manage projects.
|
|
@@ -42,19 +58,46 @@ r4 run --prefix R4 -- docker compose up
|
|
|
42
58
|
| Flag | Description |
|
|
43
59
|
|--------------------|---------------------------------------------------|
|
|
44
60
|
| `--api-key <key>` | API key (overrides `R4_API_KEY` env var and config)|
|
|
61
|
+
| `--profile <name>` | CLI profile name (overrides `R4_PROFILE`) |
|
|
45
62
|
| `--project-id <id>`| Optional project filter (overrides `R4_PROJECT_ID` env var) |
|
|
46
|
-
| `--dev` | Use `https://dev.r4.dev` unless an explicit base URL is set |
|
|
47
63
|
| `--base-url <url>` | API base URL (default: `https://r4.dev`) |
|
|
48
64
|
| `--private-key-path <path>` | Path to the local agent private key PEM |
|
|
49
65
|
| `--trust-store-path <path>` | Path to the local signer trust-store JSON |
|
|
50
66
|
| `--json` | Output as JSON for scripting and piping |
|
|
51
67
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
68
|
+
## First Run
|
|
69
|
+
|
|
70
|
+
The simplest bootstrap path is:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
r4 agent init --credentials-file ./agent-creds.csv
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
That flow can:
|
|
77
|
+
- read a CSV, `.env`, JSON, or plain-text credentials handoff
|
|
78
|
+
- accept either a full `apiKey` or split `accessKey` + `secretKey`
|
|
79
|
+
- generate `~/.r4/keys/<profile>.pem` if no local private key exists
|
|
80
|
+
- register the matching public key with the machine API
|
|
81
|
+
- save the resolved settings into the active profile
|
|
82
|
+
- run `r4 doctor` to confirm the runtime is healthy
|
|
83
|
+
|
|
84
|
+
The CLI supports either `R4_API_KEY` or split `R4_ACCESS_KEY` +
|
|
85
|
+
`R4_SECRET_KEY` environment variables. Saved credentials now live in named
|
|
86
|
+
profiles, so you can switch with `r4 profile use <name>`.
|
|
87
|
+
|
|
88
|
+
The zero-trust runtime path still needs an AGENT-scoped API key plus a local
|
|
89
|
+
private key. Provide the key path via `--private-key-path`,
|
|
90
|
+
`R4_PRIVATE_KEY_PATH`, or let `r4 agent init` create the default profile key.
|
|
91
|
+
Use `--base-url` or `R4_BASE_URL` when you need to point the CLI at a
|
|
92
|
+
non-default environment.
|
|
93
|
+
Operators should let the runtime complete that first public-key registration
|
|
94
|
+
before they assign security-group, project, or direct vault access to the
|
|
95
|
+
agent. Re-registering the same key is safe, but rotating to a different key is
|
|
96
|
+
currently blocked while vault-backed access still exists.
|
|
97
|
+
|
|
98
|
+
When decryption is failing but API access is otherwise correct, use
|
|
99
|
+
`r4 doctor`, `r4 vault list-items`, or `r4 vault items --metadata-only` to
|
|
100
|
+
separate metadata/access problems from local key or trust issues.
|
|
58
101
|
|
|
59
102
|
## Dependencies
|
|
60
103
|
|
|
@@ -65,6 +108,11 @@ Uses the published `@r4security/sdk` package under the hood for API communicatio
|
|
|
65
108
|
```bash
|
|
66
109
|
pnpm run build # Build with tsup
|
|
67
110
|
pnpm run dev # Watch mode
|
|
68
|
-
pnpm run test # Run CLI
|
|
111
|
+
pnpm run test # Run CLI unit tests from test/
|
|
112
|
+
pnpm run test:pack # Verify npm publish excludes src/ and test/
|
|
69
113
|
pnpm run clean # Remove lib/
|
|
70
114
|
```
|
|
115
|
+
|
|
116
|
+
The published CLI only ships the allowlisted `lib/` and `bin/` outputs from
|
|
117
|
+
`package.json#files`. Source files under `src/` and package-local tests under
|
|
118
|
+
`test/` stay out of the npm tarball.
|