@screenshotscout/cli 0.2.0 → 0.4.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 CHANGED
@@ -10,7 +10,7 @@ You need:
10
10
 
11
11
  - Node.js 22 or newer;
12
12
  - a Screenshot Scout [access key](https://screenshotscout.com/app/api-keys); and
13
- - the matching secret key only when you want automatic signing or the API key requires signed requests.
13
+ - the matching secret key only when you want signed capture URLs or the API key requires signed requests.
14
14
 
15
15
  ## Install
16
16
 
@@ -55,7 +55,7 @@ $env:SCREENSHOTSCOUT_ACCESS_KEY = "YOUR_ACCESS_KEY"
55
55
  $env:SCREENSHOTSCOUT_SECRET_KEY = "YOUR_SECRET_KEY"
56
56
  ```
57
57
 
58
- `SCREENSHOTSCOUT_ACCESS_KEY` is required. `SCREENSHOTSCOUT_SECRET_KEY` is optional; omit its assignment for unsigned requests. When the secret key is configured, capture requests and generated capture URLs are signed automatically, while the secret key stays local.
58
+ `SCREENSHOTSCOUT_ACCESS_KEY` is required. `SCREENSHOTSCOUT_SECRET_KEY` is optional; omit its assignment for unsigned requests. When the secret key is configured, generated capture URLs and captures are signed automatically, while the secret key stays local.
59
59
 
60
60
  ## Commands
61
61
 
@@ -77,7 +77,7 @@ screenshotscout capture "https://example.com" \
77
77
  --output screenshot.webp
78
78
  ```
79
79
 
80
- `capture` accepts `--method get` or `--method post`. You can omit `--method` unless you need to select one explicitly.
80
+ `capture` accepts `--method get` or `--method post`. Without `--method`, it uses POST, or GET when `SCREENSHOTSCOUT_SECRET_KEY` is set. POST requests can't be signed, so `--method post` fails while the secret key is set.
81
81
 
82
82
  ```sh
83
83
  screenshotscout capture "https://example.com" --method post --format webp --output screenshot.webp
@@ -225,7 +225,7 @@ More inline-flag, options-file, POSIX shell, PowerShell, and CI examples are in
225
225
 
226
226
  - Run `screenshotscout --help` or `screenshotscout <command> --help` to check command syntax and current capture-option value shapes.
227
227
  - If the CLI reports that an access key is required, set `SCREENSHOTSCOUT_ACCESS_KEY` in the same process environment that runs the command.
228
- - If the API reports `signature_required`, set the matching `SCREENSHOTSCOUT_SECRET_KEY`; the CLI will sign the request automatically. See [Signed requests](https://screenshotscout.com/docs/signed-requests).
228
+ - If the API reports `signature_required`, set the matching `SCREENSHOTSCOUT_SECRET_KEY`. See [Signed requests](https://screenshotscout.com/docs/signed-requests).
229
229
  - If an option is rejected with exit status `2`, check whether it uses CLI `kebab-case`, whether a boolean uses bare or inline syntax, and whether a singleton flag was repeated.
230
230
  - If an options file is rejected, confirm that it is a JSON object using exact API `snake_case` names and JSON value types.
231
231
  - If a file write fails, confirm that its parent directory exists and is writable.
package/dist/help.js CHANGED
@@ -26,7 +26,7 @@ export function captureCommandHelp() {
26
26
 
27
27
  CLI controls:
28
28
  --options <path|-> Read a snake_case JSON options object from a file or standard input.
29
- --method <get|post> Select the SDK capture request method.
29
+ --method <get|post> Select the request method (default post, or get when SCREENSHOTSCOUT_SECRET_KEY is set).
30
30
  -o, --output <path|-> Write the response to a file or standard output.
31
31
  --help Show this help.
32
32
 
package/dist/sdk.js CHANGED
@@ -1,17 +1,11 @@
1
1
  import { CaptureHttpMethod, ScreenshotScoutClient, } from "@screenshotscout/sdk";
2
- const DEFAULT_CLIENT_FACTORY = (options) => new ScreenshotScoutClient(options);
3
- /** Construct the official SDK client from the two approved environment names. */
4
- export function createScreenshotScoutClient(environment = process.env, clientFactory = DEFAULT_CLIENT_FACTORY) {
5
- const accessKey = environment.SCREENSHOTSCOUT_ACCESS_KEY;
6
- const secretKey = environment.SCREENSHOTSCOUT_SECRET_KEY;
7
- const options = {
8
- // Missing and invalid values deliberately reach the SDK's own validation.
9
- accessKey: accessKey,
10
- ...(secretKey === undefined ? {} : { secretKey }),
11
- };
12
- return clientFactory(options);
2
+ // The SDK reads SCREENSHOTSCOUT_ACCESS_KEY and SCREENSHOTSCOUT_SECRET_KEY itself.
3
+ const DEFAULT_CLIENT_FACTORY = () => new ScreenshotScoutClient();
4
+ /** Construct the official SDK client, which takes its keys from the environment. */
5
+ export function createScreenshotScoutClient(clientFactory = DEFAULT_CLIENT_FACTORY) {
6
+ return clientFactory();
13
7
  }
14
- /** Make one capture call with only an explicitly selected request method. */
8
+ /** Make one capture call with only an explicitly selected request method; the SDK picks the default. */
15
9
  export function captureWithScreenshotScoutClient(client, targetUrl, captureOptions, method) {
16
10
  if (method === undefined) {
17
11
  return client.capture(targetUrl, captureOptions);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@screenshotscout/cli",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "Official command-line interface for the Screenshot Scout screenshot API.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -49,7 +49,7 @@
49
49
  "node": ">=22"
50
50
  },
51
51
  "dependencies": {
52
- "@screenshotscout/sdk": "0.3.0"
52
+ "@screenshotscout/sdk": "0.5.0"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@eslint/js": "10.0.1",