@trojeancedric/sentinel-cli 1.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.
package/LICENSE ADDED
@@ -0,0 +1,62 @@
1
+ Supercheck Community License
2
+
3
+ Copyright (c) 2026 Supercheck Contributors
4
+
5
+ GRANT OF RIGHTS
6
+
7
+ You are granted a non-exclusive, royalty-free license to use, modify, and distribute
8
+ this software and its source code, subject to the restrictions and conditions outlined below.
9
+
10
+ PERMITTED USE
11
+
12
+ 1. Personal Use: You may use Supercheck for personal projects and development purposes.
13
+
14
+ 2. Open Source Development: You may use Supercheck as a foundation for open-source projects
15
+ that advance the testing and monitoring community, provided such projects are also
16
+ made publicly available under compatible open-source terms.
17
+
18
+ 3. Internal Deployment: You may deploy and operate Supercheck internally within your
19
+ organization for your own business operations and testing needs.
20
+
21
+ 4. Contributing Back: You may submit improvements, bug fixes, and features back to the
22
+ official Supercheck project via pull requests.
23
+
24
+ RESTRICTIONS
25
+
26
+ You may NOT:
27
+
28
+ 1. Whitelabel or resell Supercheck as your own product or service.
29
+
30
+ 2. Launch a competitive SaaS (Software-as-a-Service) product, testing platform, or
31
+ monitoring service based on or derived from Supercheck without explicit written
32
+ permission from Supercheck Contributors.
33
+
34
+ 3. Use Supercheck as the primary component in a commercial offering that competes
35
+ with the official Supercheck service.
36
+
37
+ 4. Remove or obscure copyright notices, licenses, or attribution.
38
+
39
+ 5. Use Supercheck's branding, trademarks, or logos in any way that implies endorsement
40
+ or affiliation without permission.
41
+
42
+ COMMERCIAL LICENSING
43
+
44
+ If you wish to use Supercheck for commercial purposes, competitive products, or
45
+ whitelabeling, please contact the Supercheck team to discuss a commercial license agreement.
46
+
47
+ DISCLAIMER
48
+
49
+ This software is provided "AS IS" without warranty of any kind, express or implied,
50
+ including but not limited to the warranties of merchantability, fitness for a particular
51
+ purpose, and non-infringement. In no event shall the authors or copyright holders be
52
+ liable for any claim, damages, or other liability arising from the use of this software.
53
+
54
+ TERMINATION
55
+
56
+ Violation of the restrictions above will result in immediate termination of your license
57
+ and rights granted hereunder. You must cease all use and distribution of Supercheck.
58
+
59
+ GOVERNING LAW
60
+
61
+ This license is governed by applicable law. Any disputes shall be resolved in the
62
+ appropriate courts of jurisdiction.
package/README.md ADDED
@@ -0,0 +1,310 @@
1
+ # @trojeancedric/sentinel-cli
2
+
3
+ Open-Source Testing, Monitoring, and Reliability — as Code.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@trojeancedric/sentinel-cli.svg)](https://www.npmjs.com/package/@trojeancedric/sentinel-cli)
6
+ [![License](https://img.shields.io/badge/license-Supercheck_Community_License-blue.svg)](LICENSE)
7
+
8
+ The Sentinel CLI provides a first-class command-line interface for managing your testing and monitoring infrastructure as code. It is designed for CI/CD integration, automation, and power-user workflows.
9
+
10
+ ## Features
11
+
12
+ - **Monitoring-as-Code**: Define monitors, tests, jobs, and status pages in TypeScript.
13
+ - **CI/CD Integration**: Trigger jobs and wait for results directly from your pipeline.
14
+ - **Full Resource Management**: Manage all resources (tests, monitors, jobs, variables, tags, notifications) from the terminal.
15
+ - **Local Development**: Run and debug tests locally before deploying.
16
+ - **Security-First**: Token scanning in config files, SHA-256 hashed storage, prefix-validated authentication.
17
+ - **Proxy Support**: Full HTTP/HTTPS proxy support with `NO_PROXY` awareness via `undici`.
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ npm install -g @trojeancedric/sentinel-cli
23
+ ```
24
+
25
+ Or run directly with `npx`:
26
+
27
+ ```bash
28
+ npx @trojeancedric/sentinel-cli --help
29
+ ```
30
+
31
+ ## Upgrade
32
+
33
+ Upgrade the CLI to the latest release:
34
+
35
+ ```bash
36
+ sentinel upgrade
37
+ ```
38
+
39
+ ## Migrating from `@supercheck/cli`
40
+
41
+ The CLI was renamed from `supercheck` to `sentinel`. The old names still work but
42
+ warn, so you can migrate at your own pace.
43
+
44
+ ```bash
45
+ npm uninstall -g @supercheck/cli
46
+ npm install -g @trojeancedric/sentinel-cli
47
+ ```
48
+
49
+ | Was | Now | Old form still accepted? |
50
+ |---|---|---|
51
+ | `supercheck <cmd>` | `sentinel <cmd>` | ✗ — the old binary is gone |
52
+ | `@supercheck/cli` | `@trojeancedric/sentinel-cli` | ✗ |
53
+ | `supercheck.config.ts` | `sentinel.config.ts` | ✓ with a warning |
54
+ | `supercheck.config.local.ts` | `sentinel.config.local.ts` | ✓ with a warning |
55
+ | `SUPERCHECK_TOKEN`, `SUPERCHECK_TRIGGER_KEY`, `SUPERCHECK_URL`, `SUPERCHECK_ORG`, `SUPERCHECK_PROJECT` | `SENTINEL_*` | ✓ with a warning |
56
+ | `_supercheck_/` test folder | `_sentinel_/` | ✓ — via explicit `testMatch` |
57
+ | `SupercheckConfig`, `SupercheckUserConfig` | `SentinelConfig`, `SentinelUserConfig` | ✓ — deprecated type aliases |
58
+
59
+ Unchanged on purpose: **token values keep their `sck_live_` / `sck_trigger_` /
60
+ `sck_test_` prefixes** (the server issues them), as do API endpoints and the
61
+ default API URL.
62
+
63
+ Your stored login is migrated automatically the first time you run `sentinel` —
64
+ no need to re-authenticate.
65
+
66
+ `_supercheck_/` is only renamed for **new** projects. An existing project keeps
67
+ working because its `testMatch` patterns point at the old folder; rename the
68
+ folder and update `tests.playwright.testMatch` / `tests.k6.testMatch` together
69
+ when you want to move.
70
+
71
+ ## Quick Start
72
+
73
+ 1. **Initialize a new project**:
74
+ ```bash
75
+ sentinel init
76
+ ```
77
+ This creates a `sentinel.config.ts` and a `_sentinel_` directory with example tests under `_sentinel_/playwright` and `_sentinel_/k6`.
78
+
79
+ 2. **Authenticate**:
80
+ ```bash
81
+ sentinel login --token sck_live_...
82
+ ```
83
+ You can generate a CLI token in your Dashboard under **Project Settings > CLI Tokens**.
84
+
85
+ 3. **Pull existing resources**:
86
+ ```bash
87
+ sentinel pull
88
+ ```
89
+
90
+ 4. **Preview & Deploy**:
91
+ ```bash
92
+ sentinel diff
93
+ sentinel deploy
94
+ ```
95
+
96
+ 5. **Validate scripts**:
97
+ ```bash
98
+ sentinel validate
99
+ ```
100
+ Validation runs automatically during deploy and cannot be skipped.
101
+
102
+ 6. **Run tests locally (optional)**:
103
+ ```bash
104
+ sentinel test run --file _sentinel_/playwright/homepage-check.<id>.pw.ts
105
+ sentinel test run --all --type browser
106
+ sentinel test run --all --type performance
107
+ sentinel test run --all --type api
108
+ sentinel test run --all --type database
109
+ sentinel test run --all --type custom
110
+ ```
111
+
112
+ For remote execution with persisted run history, trigger a job:
113
+ ```bash
114
+ sentinel job run --id <job-id>
115
+ # or (CI/CD trigger key flow)
116
+ SENTINEL_TRIGGER_KEY=sck_trigger_... sentinel job trigger <job-id>
117
+ ```
118
+
119
+ `sentinel job trigger` requires `SENTINEL_TRIGGER_KEY`. If you also pass `--wait`, set `SENTINEL_TOKEN` so the CLI can poll the resulting run.
120
+
121
+ ## Command Reference
122
+
123
+ ### Authentication
124
+
125
+ | Command | Description |
126
+ |---|---|
127
+ | `sentinel login --token <token>` | Authenticate with a CLI token |
128
+ | `sentinel logout` | Clear stored credentials |
129
+ | `sentinel whoami` | Show current authentication context |
130
+
131
+ ### Monitoring-as-Code
132
+
133
+ | Command | Description |
134
+ |---|---|
135
+ | `sentinel init` | Initialize a new project with config and example tests |
136
+ | `sentinel pull` | Sync cloud resources to local config |
137
+ | `sentinel diff` | Preview changes between local config and cloud |
138
+ | `sentinel deploy` | Apply local config changes to the cloud |
139
+ | `sentinel validate` | Validate local test scripts (same rules as Playground) |
140
+ | `sentinel destroy` | Remove all managed resources from the cloud (`--dry-run`, `--force`) |
141
+ | `sentinel config validate` | Validate your `sentinel.config.ts` |
142
+ | `sentinel config print` | Print resolved `sentinel.config.ts` |
143
+
144
+ > Note: In the current API, status pages are readable/deletable from CLI sync flows, but create/update endpoints are not available.
145
+ > Pull preserves non-default status page language values (for example `es`, `fr`) for config visibility.
146
+
147
+ > Note: Self-hosted email/password sign-in is for dashboard access. CLI authentication remains token-based (`sentinel login --token ...`).
148
+
149
+ ### Jobs & Runs
150
+
151
+ | Command | Description |
152
+ |---|---|
153
+ | `sentinel job list` | List all jobs |
154
+ | `sentinel job get <id>` | Get job details |
155
+ | `sentinel job create --name <name> --tests <test-id...>` | Create a new job with tests (`--dry-run`) |
156
+ | `sentinel job update <id> --name ...` | Update job fields (`--dry-run`) |
157
+ | `sentinel job delete <id>` | Delete a job |
158
+ | `sentinel job keys <jobId>` | List trigger keys for a job |
159
+ | `sentinel job keys create <jobId> --name <name>` | Create a trigger key |
160
+ | `sentinel job keys delete <jobId> <keyId>` | Revoke a trigger key |
161
+ | `sentinel job run --id <job-id>` | Run a job immediately |
162
+ | `sentinel job run --local` | Run a job locally using local test files |
163
+ | `sentinel job trigger <id> --wait` | Trigger a job with a trigger key and wait for completion (CI/CD) |
164
+ | `sentinel run list` | List recent execution runs (`--job`, `--status`, `--page`, `--limit`) |
165
+ | `sentinel run get <id>` | Get run details |
166
+ | `sentinel run status <id>` | Get run status |
167
+ | `sentinel run permissions <id>` | Get run permissions |
168
+ | `sentinel run stream <id>` | Stream live console output |
169
+ | `sentinel run cancel <id>` | Cancel a running execution |
170
+
171
+ ### Tests & Monitors
172
+
173
+ | Command | Description |
174
+ |---|---|
175
+ | `sentinel test list` | List all tests (`--search`, `--type`, `--page`, `--limit`) |
176
+ | `sentinel test get <id>` | Get test details (`--include-script`) |
177
+ | `sentinel test create` | Create a new test (`--dry-run`) |
178
+ | `sentinel test update <id>` | Update a test (`--dry-run`) |
179
+ | `sentinel test delete <id>` | Delete a test |
180
+ | `sentinel test validate` | Validate local test scripts (same rules as Playground) |
181
+ | `sentinel test run` | Run tests locally |
182
+ | `sentinel test tags <id>` | List tags for a test |
183
+ | `sentinel test status <id>` | Stream live status events for a test |
184
+ | `sentinel monitor list` | List all monitors |
185
+ | `sentinel monitor get <id>` | Get monitor details |
186
+ | `sentinel monitor results <id>` | Get monitor check results |
187
+ | `sentinel monitor stats <id>` | Get monitor statistics |
188
+ | `sentinel monitor status <id>` | Get current monitor status |
189
+ | `sentinel monitor create ...` | Create a monitor (`--interval-minutes`, `--dry-run`) |
190
+ | `sentinel monitor update <id> ...` | Update a monitor (`--interval-minutes`, `--dry-run`) |
191
+ | `sentinel monitor delete <id>` | Delete a monitor |
192
+
193
+ > **Dry run support:** `test create`, `test update`, `job create`, `job update`, `monitor create`, `monitor update`, and `deploy` all support `--dry-run` to preview the API payload without making changes.
194
+
195
+ `sentinel test run` is local-only. Cloud test execution has been replaced by `sentinel job run` / `sentinel job trigger`.
196
+
197
+ ### Variables, Tags & Notifications
198
+
199
+ | Command | Description |
200
+ |---|---|
201
+ | `sentinel var list / get / set / delete` | Manage project variables (`var set` supports `--value-stdin` for secrets) |
202
+ | `sentinel tag list / create / delete` | Manage tags |
203
+ | `sentinel notification list / get / create / update / delete / test` | Manage notification providers |
204
+ | `sentinel alert history` | View alert history |
205
+ | `sentinel audit` | View audit logs (admin) |
206
+
207
+ `sentinel notification test` validates an ad-hoc provider configuration before creation or update. It does not take an existing provider ID.
208
+
209
+ ```bash
210
+ sentinel notification test --type slack --config '{"webhookUrl":"https://hooks.slack.com/..."}'
211
+ ```
212
+
213
+ ### Utilities
214
+
215
+ | Command | Description |
216
+ |---|---|
217
+ | `sentinel health` | Check API health |
218
+ | `sentinel locations` | List available execution locations |
219
+ | `sentinel doctor` | Validate local CLI dependencies and config (`--fix`) |
220
+ | `sentinel upgrade` | Upgrade the CLI to the latest release |
221
+
222
+ ## Configuration
223
+
224
+ The `sentinel.config.ts` file is the source of truth for your project configuration.
225
+
226
+ ```typescript
227
+ import { defineConfig } from '@trojeancedric/sentinel-cli'
228
+
229
+ export default defineConfig({
230
+ schemaVersion: '1.0',
231
+ project: {
232
+ organization: 'my-org-id',
233
+ project: 'my-project-id',
234
+ },
235
+ tests: {
236
+ playwright: {
237
+ testMatch: '_sentinel_/playwright/**/*.pw.ts',
238
+ },
239
+ k6: {
240
+ testMatch: '_sentinel_/k6/**/*.k6.ts',
241
+ },
242
+ },
243
+ monitors: [
244
+ {
245
+ name: 'API Health',
246
+ type: 'http_request',
247
+ target: 'https://api.example.com/health',
248
+ frequencyMinutes: 5,
249
+ }
250
+ ]
251
+ })
252
+ ```
253
+
254
+ ## CI/CD Integration
255
+
256
+ ### GitHub Actions
257
+
258
+ ```yaml
259
+ - name: Run E2E Tests
260
+ run: npx @trojeancedric/sentinel-cli job trigger ${{ secrets.SENTINEL_JOB_ID }} --wait --json
261
+ env:
262
+ SENTINEL_TRIGGER_KEY: ${{ secrets.SENTINEL_TRIGGER_KEY }}
263
+ SENTINEL_TOKEN: ${{ secrets.SENTINEL_TOKEN }}
264
+ ```
265
+
266
+ `SENTINEL_TRIGGER_KEY` is required to start the run. `SENTINEL_TOKEN` is only needed here because the example uses `--wait`.
267
+
268
+ ### GitLab CI
269
+
270
+ ```yaml
271
+ test:
272
+ image: node:18
273
+ script:
274
+ - npm install -g @trojeancedric/sentinel-cli
275
+ - sentinel job trigger $SENTINEL_JOB_ID --wait
276
+ variables:
277
+ SENTINEL_TRIGGER_KEY: $SENTINEL_TRIGGER_KEY
278
+ SENTINEL_TOKEN: $SENTINEL_TOKEN
279
+ ```
280
+
281
+ ## Environment Variables
282
+
283
+ | Variable | Description |
284
+ |---|---|
285
+ | `SENTINEL_TOKEN` | CLI token for authentication (CI/CD) |
286
+ | `SENTINEL_TRIGGER_KEY` | Trigger key for `job trigger` |
287
+ | `SENTINEL_URL` | Custom API URL (self-hosted) |
288
+ | `SENTINEL_ORG` | Override organization ID from config |
289
+ | `SENTINEL_PROJECT` | Override project ID from config |
290
+ | `HTTPS_PROXY` | Proxy URL for HTTPS requests |
291
+ | `HTTP_PROXY` | Proxy URL for HTTP requests |
292
+ | `NO_PROXY` | Hosts to bypass proxy (comma-separated) |
293
+
294
+ ## Global Options
295
+
296
+ | Flag | Description |
297
+ |---|---|
298
+ | `--json` | Output in JSON format |
299
+ | `--quiet` | Suppress non-essential output |
300
+ | `--debug` | Enable debug logging |
301
+ | `-v, --version` | Show CLI version |
302
+
303
+ Config-aware commands such as `config`, `diff`, `deploy`, `pull`, `validate`, and `destroy` accept `--config <path>`.
304
+
305
+ ## Links
306
+
307
+ - [Website](https://supercheck.io)
308
+ - [CLI Documentation](https://supercheck.io/docs/cli/commands)
309
+ - [App Documentation](https://supercheck.io/docs/app/welcome)
310
+ - [GitHub](https://github.com/sentinel-io/sentinel)