scp-next 1.0.2 → 1.0.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.
Files changed (2) hide show
  1. package/README.md +57 -36
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,7 +1,20 @@
1
1
  # scp-next
2
2
 
3
- `scp-next` is a SCP command-line tool and library for secure file transfers over SSH.
4
- The package uses SFTP internally through `ssh2-sftp-client` instead of implementing SCP or SFTP protocols manually.
3
+ [![npm version][npm-image]][npm-url]
4
+ [![license][license-image]][license-url]
5
+ [![node version][node-image]][npm-url]
6
+ [![module type][module-image]][npm-url]
7
+
8
+ [npm-image]: https://img.shields.io/npm/v/scp-next
9
+ [npm-url]: https://npmjs.org/package/scp-next
10
+ [license-image]: https://img.shields.io/npm/l/scp-next
11
+ [license-url]: https://github.com/chengchuu/scp-next
12
+ [node-image]: https://img.shields.io/node/v/scp-next
13
+ [module-image]: https://img.shields.io/badge/module-ESM%20%2B%20CJS-blue
14
+
15
+ `scp-next` is an SCP-style command-line tool and library for secure file transfers over SSH.
16
+ The package uses SFTP internally through `ssh2-sftp-client` instead of implementing SCP or
17
+ SFTP protocols manually.
5
18
 
6
19
  ## Features
7
20
 
@@ -9,7 +22,7 @@ The package uses SFTP internally through `ssh2-sftp-client` instead of implement
9
22
  - CLI usage with clear `<source> <destination>` operands.
10
23
  - ESM `import` and CommonJS `require` support.
11
24
  - JSON configuration files, named profiles, and configured jobs.
12
- - Environment-variable based credentials.
25
+ - Environment-variable-based credentials.
13
26
  - Dry-run mode, progress callbacks, timeouts, overwrite control, and destination directory creation.
14
27
  - Secret redaction for passwords, passphrases, and private-key contents.
15
28
  - Reusable transfer client.
@@ -29,14 +42,6 @@ scp-next download <source> <destination> [options]
29
42
  scp-next run <job> [source] [destination] [options]
30
43
  ```
31
44
 
32
- Terminology is intentionally consistent:
33
-
34
- ```text
35
- Operation Source Destination
36
- Upload Local Remote
37
- Download Remote Local
38
- ```
39
-
40
45
  CLI commands use `<source> <destination>`. Programmatic upload and download APIs use
41
46
  `localPath` and `remotePath`.
42
47
 
@@ -51,6 +56,20 @@ scp-next upload ./dist /var/www/example \
51
56
  --create-directories
52
57
  ```
53
58
 
59
+ Password authentication:
60
+
61
+ ```bash
62
+ scp-next upload ./dist /var/www/example \
63
+ --host example.com \
64
+ --username deploy \
65
+ --password "your-password" \
66
+ --recursive
67
+ ```
68
+
69
+ Password arguments are convenient, but they may be exposed through shell history and process
70
+ listings. Prefer `SCP_NEXT_PASSWORD`, SSH agents, or protected private-key files for shared
71
+ or production environments.
72
+
54
73
  ## Download Examples
55
74
 
56
75
  ```bash
@@ -63,30 +82,26 @@ scp-next download /var/log/example.log ./logs/example.log \
63
82
 
64
83
  ## CLI Options
65
84
 
66
- | Option | Description |
67
- | --- | --- |
68
- | `--host <host>` | SSH server host. |
69
- | `--port <port>` | SSH server port. Defaults to `22`. |
70
- | `--username <username>` | SSH username. |
71
- | `--password <password>` | SSH password. Prefer environment variables, SSH agents, or key files. |
72
- | `--private-key <privateKey>` | Private-key content. Redacted from logs and errors. |
73
- | `--private-key-file <privateKeyFile>` | Private-key file path. Supports `~` expansion. |
74
- | `--passphrase <passphrase>` | Passphrase for an encrypted private key. |
75
- | `--config <path>` | Explicit configuration file path. |
76
- | `--profile <name>` | Named server profile from the configuration file. |
77
- | `--recursive` | Transfer directories recursively. |
78
- | `--overwrite` | Allow replacing existing destination files. |
79
- | `--create-directories` | Create missing destination directories when supported. |
80
- | `--dry-run` | Resolve and validate the operation without connecting or transferring. |
81
- | `--timeout <milliseconds>` | Connection and operation timeout in milliseconds. |
82
- | `--verbose` | Print non-sensitive diagnostic details. |
83
- | `--quiet` | Disable progress and non-error output. |
84
- | `--help` | Show command help. |
85
- | `--version` | Show the package version. |
86
-
87
- Avoid `--password` when possible because command-line arguments may be visible in shell
88
- history and process listings. Prefer environment variables, SSH agents, or protected
89
- private-key files.
85
+ | Option | Description |
86
+ | ------------------------------------- | ---------------------------------------------------------------------- |
87
+ | `--host <host>` | SSH server host. |
88
+ | `--port <port>` | SSH server port. Defaults to `22`. |
89
+ | `--username <username>` | SSH username. |
90
+ | `--password <password>` | SSH password. Prefer environment variables, SSH agents, or key files. |
91
+ | `--private-key <privateKey>` | Private-key content. Redacted from logs and errors. |
92
+ | `--private-key-file <privateKeyFile>` | Private-key file path. Supports `~` expansion. |
93
+ | `--passphrase <passphrase>` | Passphrase for an encrypted private key. |
94
+ | `--config <path>` | Explicit configuration file path. |
95
+ | `--profile <name>` | Named server profile from the configuration file. |
96
+ | `--recursive` | Transfer directories recursively. |
97
+ | `--overwrite` | Allow replacing existing destination files. |
98
+ | `--create-directories` | Create missing destination directories when supported. |
99
+ | `--dry-run` | Resolve and validate the operation without connecting or transferring. |
100
+ | `--timeout <milliseconds>` | Connection and operation timeout in milliseconds. |
101
+ | `--verbose` | Print non-sensitive diagnostic details. |
102
+ | `--quiet` | Disable progress and non-error output. |
103
+ | `--help` | Show command help. |
104
+ | `--version` | Show the package version. |
90
105
 
91
106
  ## Configuration Files
92
107
 
@@ -353,7 +368,13 @@ non-sensitive context.
353
368
  import { AuthenticationError, upload } from "scp-next";
354
369
 
355
370
  try {
356
- await upload({ localPath: "./dist", remotePath: "/var/www/example" });
371
+ await upload({
372
+ host: process.env.SCP_NEXT_HOST,
373
+ username: process.env.SCP_NEXT_USERNAME,
374
+ privateKeyFile: process.env.SCP_NEXT_PRIVATE_KEY_FILE,
375
+ localPath: "./dist",
376
+ remotePath: "/var/www/example"
377
+ });
357
378
  } catch (error) {
358
379
  if (error instanceof AuthenticationError) {
359
380
  console.error("SSH authentication failed.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scp-next",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "A SCP CLI and library for secure SSH file transfers using SFTP.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",