@supercheck/cli 0.1.0-beta.1 → 0.1.0-beta.3

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 CHANGED
@@ -1,6 +1,18 @@
1
1
  # @supercheck/cli
2
2
 
3
- Supercheck CLI monitoring-as-code for Playwright and k6.
3
+ Open-Source Testing, Monitoring, and Reliability as Code.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@supercheck/cli.svg)](https://www.npmjs.com/package/@supercheck/cli)
6
+ [![License](https://img.shields.io/badge/license-Supercheck_Community_License-blue.svg)](LICENSE)
7
+
8
+ The Supercheck 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, and status pages in TypeScript.
13
+ - **CI/CD Integration**: Trigger jobs and wait for results directly from your pipeline.
14
+ - **Local Development**: Run and debug tests locally before deploying.
15
+ - **Full API Access**: Manage all resources (jobs, variables, tags) from the terminal.
4
16
 
5
17
  ## Installation
6
18
 
@@ -8,31 +20,68 @@ Supercheck CLI — monitoring-as-code for Playwright and k6.
8
20
  npm install -g @supercheck/cli
9
21
  ```
10
22
 
11
- Or use with npx:
23
+ Or run directly with `npx`:
12
24
 
13
25
  ```bash
14
- npx @supercheck/cli
26
+ npx @supercheck/cli --help
15
27
  ```
16
28
 
17
29
  ## Quick Start
18
30
 
19
- ```bash
20
- # Initialize a new project
21
- supercheck init
31
+ 1. **Initialize a new project**:
32
+ ```bash
33
+ supercheck init
34
+ ```
35
+ This creates a `supercheck.config.ts` and a `_supercheck_` directory with example tests.
22
36
 
23
- # Authenticate
24
- supercheck login --token <your-token>
37
+ 2. **Authenticate**:
38
+ ```bash
39
+ supercheck login --token sck_live_...
40
+ ```
41
+ You can generate a CLI token in your Dashboard under **Project Settings > CLI Tokens**.
25
42
 
26
- # Validate config
27
- supercheck config validate
43
+ 3. **Validate configuration**:
44
+ ```bash
45
+ supercheck config validate
46
+ ```
28
47
 
29
- # Check API health
30
- supercheck health
31
- ```
48
+ 4. **Deploy to Cloud**:
49
+ ```bash
50
+ supercheck deploy
51
+ ```
52
+
53
+ ## Command Reference
54
+
55
+ ### Authentication
56
+
57
+ - `supercheck login --token <token>`: Authenticate with a CLI token.
58
+ - `supercheck logout`: clear stored credentials.
59
+ - `supercheck whoami`: Show current authentication context.
60
+
61
+ ### Jobs & Runs
62
+
63
+ - `supercheck job list`: List all jobs.
64
+ - `supercheck job trigger <id> --wait`: Trigger a job and wait for completion (ideal for CI/CD).
65
+ - `supercheck job run --id <id>`: Run a job immediately.
66
+ - `supercheck run list`: List recent execution runs.
67
+ - `supercheck run stream <id>`: Stream live console output from a running job.
68
+
69
+ ### Tests & Monitors
70
+
71
+ - `supercheck test list`: List all tests.
72
+ - `supercheck test create --file <path>`: Create a new test from a script file.
73
+ - `supercheck monitor list`: List all monitors.
74
+ - `supercheck monitor status <id>`: Check the real-time status of a monitor.
75
+
76
+ ### Resources
77
+
78
+ - `supercheck pull`: Sync cloud resources to your local config.
79
+ - `supercheck diff`: Preview changes between local config and cloud.
80
+ - `supercheck deploy`: Apply local config changes to the cloud.
32
81
 
33
82
  ## Configuration
34
83
 
35
- Create a `supercheck.config.ts` in your project root:
84
+ The `supercheck.config.ts` file is the source of truth for your project configuration.
36
85
 
37
86
  ```typescript
38
87
  import { defineConfig } from '@supercheck/cli'
@@ -40,40 +89,49 @@ import { defineConfig } from '@supercheck/cli'
40
89
  export default defineConfig({
41
90
  schemaVersion: '1.0',
42
91
  project: {
43
- organization: 'my-org',
44
- project: 'my-project',
92
+ organization: 'my-org-slug',
93
+ project: 'my-project-slug',
45
94
  },
46
95
  tests: {
47
96
  playwright: {
48
97
  testMatch: '_supercheck_/tests/**/*.pw.ts',
49
- browser: 'chromium',
50
98
  },
51
99
  k6: {
52
100
  testMatch: '_supercheck_/tests/**/*.k6.ts',
53
101
  },
54
102
  },
103
+ monitors: [
104
+ {
105
+ name: 'API Health',
106
+ type: 'http_request',
107
+ target: 'https://api.example.com/health',
108
+ frequencyMinutes: 5,
109
+ }
110
+ ]
55
111
  })
56
112
  ```
57
113
 
58
- ## File Conventions
114
+ ## CI/CD Integration
59
115
 
60
- ```
61
- _supercheck_/
62
- ├── tests/
63
- │ ├── homepage.pw.ts # Playwright test
64
- │ └── load-test.k6.ts # k6 test
65
- ├── monitors/
66
- │ └── api-monitor.ts # Monitor definition
67
- └── status-pages/
68
- └── main-status.ts # Status page definition
116
+ ### GitHub Actions
117
+
118
+ ```yaml
119
+ - name: Run E2E Tests
120
+ run: |
121
+ npx @supercheck/cli job trigger ${{ secrets.SUPERCHECK_JOB_ID }} --wait --json
122
+ env:
123
+ SUPERCHECK_TOKEN: ${{ secrets.SUPERCHECK_TOKEN }}
69
124
  ```
70
125
 
71
- ## Development
126
+ ### GitLab CI
72
127
 
73
- ```bash
74
- npm install
75
- npm run dev # Watch mode
76
- npm run build # Production build
77
- npm run typecheck # Type checking
78
- npm run supercheck # Run CLI in dev mode
128
+ ```yaml
129
+ test:
130
+ image: node:18
131
+ script:
132
+ - npm install -g @supercheck/cli
133
+ - supercheck job trigger $SUPERCHECK_JOB_ID --wait
134
+ variables:
135
+ SUPERCHECK_TOKEN: $SUPERCHECK_TOKEN
79
136
  ```
137
+
@@ -210,7 +210,7 @@ function requireTriggerKey() {
210
210
  }
211
211
 
212
212
  // src/version.ts
213
- var CLI_VERSION = true ? "0.1.0-beta.1" : "0.0.0-dev";
213
+ var CLI_VERSION = true ? "0.1.0-beta.3" : "0.0.0-dev";
214
214
 
215
215
  // src/api/client.ts
216
216
  import { ProxyAgent } from "undici";
@@ -1713,7 +1713,7 @@ jobCommand.command("get <id>").description("Get job details").action(async (id)
1713
1713
  const { data } = await client.get(`/api/jobs/${id}`);
1714
1714
  outputDetail(data);
1715
1715
  });
1716
- jobCommand.command("create").description("Create a new job").requiredOption("--name <name>", "Job name").option("--description <description>", "Job description", "").option("--schedule <cron>", "Cron schedule expression").option("--timeout <seconds>", "Timeout in seconds", "300").option("--retries <count>", "Retry count on failure", "0").action(async (options) => {
1716
+ jobCommand.command("create").description("Create a new job").requiredOption("--name <name>", "Job name").option("--description <description>", "Job description", "").option("--type <type>", "Job type (playwright, k6)").option("--schedule <cron>", "Cron schedule expression").option("--timeout <seconds>", "Timeout in seconds", "300").option("--retries <count>", "Retry count on failure", "0").action(async (options) => {
1717
1717
  const client = createAuthenticatedClient();
1718
1718
  const body = {
1719
1719
  name: options.name,
@@ -1723,6 +1723,7 @@ jobCommand.command("create").description("Create a new job").requiredOption("--n
1723
1723
  config: {},
1724
1724
  tests: []
1725
1725
  };
1726
+ if (options.type) body.jobType = options.type;
1726
1727
  if (options.schedule) body.cronSchedule = options.schedule;
1727
1728
  const { data } = await client.post("/api/jobs", body);
1728
1729
  logger.success(`Job "${options.name}" created (${data.id})`);
@@ -2379,11 +2380,7 @@ monitorCommand.command("status <id>").description("Get current monitor status").
2379
2380
  });
2380
2381
  monitorCommand.command("create").description("Create a new monitor").requiredOption("--name <name>", "Monitor name").requiredOption("--url <url>", "URL to monitor").option("--type <type>", "Monitor type (http_request, website, ping_host, port_check, synthetic_test)", "http_request").option("--interval <seconds>", "Check interval in seconds", "300").option("--timeout <seconds>", "Request timeout in seconds", "30").option("--method <method>", "HTTP method (GET, POST, HEAD)", "GET").action(async (options) => {
2381
2382
  const client = createAuthenticatedClient();
2382
- const intervalSeconds = parseInt(options.interval, 10);
2383
- if (!Number.isFinite(intervalSeconds) || intervalSeconds <= 0) {
2384
- logger.error("Invalid --interval value: must be a positive number of seconds");
2385
- return;
2386
- }
2383
+ const intervalSeconds = parseIntStrict(options.interval, "--interval", { min: 1 });
2387
2384
  const frequencyMinutes = Math.max(1, Math.ceil(intervalSeconds / 60));
2388
2385
  const body = {
2389
2386
  name: options.name,
@@ -2391,7 +2388,7 @@ monitorCommand.command("create").description("Create a new monitor").requiredOpt
2391
2388
  type: options.type,
2392
2389
  frequencyMinutes,
2393
2390
  config: {
2394
- timeout: parseInt(options.timeout, 10) * 1e3,
2391
+ timeout: parseIntStrict(options.timeout, "--timeout", { min: 1 }) * 1e3,
2395
2392
  // API expects milliseconds
2396
2393
  method: options.method
2397
2394
  }
@@ -2406,16 +2403,12 @@ monitorCommand.command("update <id>").description("Update a monitor").option("--
2406
2403
  if (options.name !== void 0) body.name = options.name;
2407
2404
  if (options.url !== void 0) body.target = options.url;
2408
2405
  if (options.interval !== void 0) {
2409
- const intervalSeconds = parseInt(options.interval, 10);
2410
- if (!Number.isFinite(intervalSeconds) || intervalSeconds <= 0) {
2411
- logger.error("Invalid --interval value: must be a positive number of seconds");
2412
- return;
2413
- }
2406
+ const intervalSeconds = parseIntStrict(options.interval, "--interval", { min: 1 });
2414
2407
  body.frequencyMinutes = Math.max(1, Math.ceil(intervalSeconds / 60));
2415
2408
  }
2416
2409
  if (options.active !== void 0) body.enabled = options.active === "true";
2417
2410
  const config = {};
2418
- if (options.timeout !== void 0) config.timeout = parseInt(options.timeout, 10) * 1e3;
2411
+ if (options.timeout !== void 0) config.timeout = parseIntStrict(options.timeout, "--timeout", { min: 1 }) * 1e3;
2419
2412
  if (options.method !== void 0) config.method = options.method;
2420
2413
  if (Object.keys(config).length > 0) body.config = config;
2421
2414
  if (Object.keys(body).length === 0) {