@jalsoedesign/filezilla-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 +21 -0
- package/README.md +206 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +18 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/check.d.ts +33 -0
- package/dist/commands/check.d.ts.map +1 -0
- package/dist/commands/check.js +427 -0
- package/dist/commands/check.js.map +1 -0
- package/dist/commands/get.d.ts +3 -0
- package/dist/commands/get.d.ts.map +1 -0
- package/dist/commands/get.js +67 -0
- package/dist/commands/get.js.map +1 -0
- package/dist/commands/list.d.ts +3 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +62 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +119 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +21 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +48 -0
- package/dist/types.js.map +1 -0
- package/examples/transfer-recipes.ts +184 -0
- package/package.json +60 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 filezilla-js contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
**[Read the documentation](https://h2ooooooo.github.io/filezilla-js/)**
|
|
2
|
+
|
|
3
|
+
# @jalsoedesign/filezilla-cli
|
|
4
|
+
|
|
5
|
+
The network check and connector recipes now use Dockline through the FileZilla settings bridges. FileZilla owns reading/selection and host-key import; the separate Dockline FTP/SFTP packages own transport. The CLI remains `list`, `get`, and read-only `check`.
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@jalsoedesign/filezilla-cli)
|
|
8
|
+
[](https://opensource.org/licenses/MIT)
|
|
9
|
+
[](https://github.com/h2ooooooo/filezilla-js/actions/workflows/ci.yml)
|
|
10
|
+
|
|
11
|
+
Command-line interface for querying FileZilla `sitemanager.xml` files and optionally checking a connection without remote mutations. Metadata queries use [`@jalsoedesign/filezilla-core`](../core/README.md); the opt-in check uses the public FTP/SFTP connectors.
|
|
12
|
+
|
|
13
|
+
## Why
|
|
14
|
+
|
|
15
|
+
Connection details already live in FileZilla. This CLI lets you query them directly from the terminal, making it easy to pipe host names, users, or passwords into scripts and automation without copying values by hand.
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
Use Node `^22.22.2 || ^24.15.0 || >=26.0.0`. Install from the public npm registry.
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install -g @jalsoedesign/filezilla-cli
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Quick start
|
|
26
|
+
|
|
27
|
+
Get FileZilla sites as JSON with a single command.
|
|
28
|
+
|
|
29
|
+
### List all sites
|
|
30
|
+
```bash
|
|
31
|
+
filezilla-js list --json
|
|
32
|
+
```
|
|
33
|
+
```json
|
|
34
|
+
[
|
|
35
|
+
{
|
|
36
|
+
"path": "SFTP (root location)",
|
|
37
|
+
"host": "test.rebex.net",
|
|
38
|
+
"protocol": "SFTP"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"path": "Rebex/SFTP",
|
|
42
|
+
"host": "test.rebex.net",
|
|
43
|
+
"protocol": "SFTP"
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Get specific site details
|
|
49
|
+
```bash
|
|
50
|
+
filezilla-js get "Rebex/FTP" --json
|
|
51
|
+
```
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"path": "Rebex/FTP",
|
|
55
|
+
"host": "test.rebex.net",
|
|
56
|
+
"port": 21,
|
|
57
|
+
"protocol": 6,
|
|
58
|
+
"protocolName": "INSECURE_FTP",
|
|
59
|
+
"user": "demo",
|
|
60
|
+
"password": "(hidden)",
|
|
61
|
+
"remoteDirectory": "/pub/example"
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Documentation
|
|
66
|
+
|
|
67
|
+
For detailed information on all flags, output formats (Table, Generic), and error handling, see the [Extended Documentation](https://github.com/h2ooooooo/filezilla-js/blob/main/packages/cli/docs/extended.MD).
|
|
68
|
+
|
|
69
|
+
## Testing
|
|
70
|
+
|
|
71
|
+
To run the CLI tests:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
npm test
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Commands
|
|
78
|
+
|
|
79
|
+
### `list`
|
|
80
|
+
|
|
81
|
+
Lists all servers in the FileZilla configuration.
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
filezilla-js list [--file <path>] [--json] [--table] [--search <term>] [--recurse] [--full] [--show-password]
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**Example: Recursive JSON output**
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
filezilla-js list --json --recurse
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
```json
|
|
94
|
+
{
|
|
95
|
+
"name": "Root",
|
|
96
|
+
"folders": [
|
|
97
|
+
{
|
|
98
|
+
"name": "Rebex",
|
|
99
|
+
"folders": [],
|
|
100
|
+
"servers": [
|
|
101
|
+
{
|
|
102
|
+
"path": "Rebex/SFTP",
|
|
103
|
+
"host": "test.rebex.net",
|
|
104
|
+
"port": 22,
|
|
105
|
+
"protocol": 1,
|
|
106
|
+
"protocolName": "SFTP",
|
|
107
|
+
"user": "demo",
|
|
108
|
+
"password": "(hidden)"
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
],
|
|
113
|
+
"servers": []
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### `get`
|
|
118
|
+
|
|
119
|
+
Retrieves details for a specific server, or a single property value.
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
filezilla-js get <path> [property] [--file <path>] [--json] [--table] [--search <term>] [--show-password]
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**Example: Get as JSON**
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
filezilla-js get "Rebex/FTP" --json
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
```json
|
|
132
|
+
{
|
|
133
|
+
"path": "Rebex/FTP",
|
|
134
|
+
"host": "test.rebex.net",
|
|
135
|
+
"port": 21,
|
|
136
|
+
"protocol": 6,
|
|
137
|
+
"protocolName": "INSECURE_FTP",
|
|
138
|
+
"user": "demo",
|
|
139
|
+
"password": "(hidden)",
|
|
140
|
+
"remoteDirectory": "/pub/example"
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## More Examples (JSON)
|
|
145
|
+
|
|
146
|
+
### List as JSON (Summary)
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
filezilla-js list --file packages/core/fixtures/general/sitemanager.multi.xml --json
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
```json
|
|
153
|
+
[
|
|
154
|
+
{
|
|
155
|
+
"path": "SFTP (root location)",
|
|
156
|
+
"host": "test.rebex.net",
|
|
157
|
+
"protocol": "SFTP"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"path": "Rebex/SFTP",
|
|
161
|
+
"host": "test.rebex.net",
|
|
162
|
+
"protocol": "SFTP"
|
|
163
|
+
}
|
|
164
|
+
]
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Get as JSON (Full)
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
filezilla-js get "SFTP (root location)" --file packages/core/fixtures/general/sitemanager.multi.xml --json
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
```json
|
|
174
|
+
{
|
|
175
|
+
"path": "SFTP (root location)",
|
|
176
|
+
"host": "test.rebex.net",
|
|
177
|
+
"port": 22,
|
|
178
|
+
"protocol": 1,
|
|
179
|
+
"type": 0,
|
|
180
|
+
"user": "demo",
|
|
181
|
+
"password": "(hidden)",
|
|
182
|
+
"logonType": 1,
|
|
183
|
+
"timezoneOffset": 0,
|
|
184
|
+
"passiveMode": 0,
|
|
185
|
+
"maximumMultipleConnections": 0,
|
|
186
|
+
"encodingType": 2,
|
|
187
|
+
"bypassProxy": false,
|
|
188
|
+
"name": "SFTP (root location)",
|
|
189
|
+
"comments": "",
|
|
190
|
+
"localDirectory": "",
|
|
191
|
+
"remoteDirectory": "",
|
|
192
|
+
"synchronizedBrowsing": false,
|
|
193
|
+
"directoryComparison": false,
|
|
194
|
+
"protocolName": "SFTP"
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## Read-only connection check and recipes
|
|
199
|
+
|
|
200
|
+
`filezilla-js check "Production" --file ./sites.xml --host-key-sha256 <verified-pin> --json` uses an exact site selection and independently verified SFTP trust. Passwords come from the selected site or redirected `--password-stdin`; there is no password argument or automatic trust approval. `--directory` and `--include-listing` enable optional metadata work.
|
|
201
|
+
|
|
202
|
+
See [connection checks](https://h2ooooooo.github.io/filezilla-js/guide/connection-check.html) for strict flags, deadlines, cleanup results and stable exit codes. Existing list/get parsing and output are unchanged. The package also includes [typed transfer recipes](https://h2ooooooo.github.io/filezilla-js/guide/transfer-recipes.html) in `examples/transfer-recipes.ts`; these are application source examples, not CLI transfer commands.
|
|
203
|
+
|
|
204
|
+
## License
|
|
205
|
+
|
|
206
|
+
MIT © [JalsoeDesign](https://www.jalsoedesign.net)
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Force color on Windows by default if we are in a TTY to avoid messing up pipes
|
|
3
|
+
const args = process.argv.slice(2);
|
|
4
|
+
if (args.includes('--color')) {
|
|
5
|
+
process.env.FORCE_COLOR = '1';
|
|
6
|
+
}
|
|
7
|
+
else if (args.includes('--no-color')) {
|
|
8
|
+
process.env.FORCE_COLOR = '0';
|
|
9
|
+
}
|
|
10
|
+
else if (process.platform === 'win32' && process.env.FORCE_COLOR === undefined && process.stdout.isTTY) {
|
|
11
|
+
process.env.FORCE_COLOR = '1';
|
|
12
|
+
}
|
|
13
|
+
import { run } from './index.js';
|
|
14
|
+
run().catch(err => {
|
|
15
|
+
console.error(err);
|
|
16
|
+
process.exit(1);
|
|
17
|
+
});
|
|
18
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,iFAAiF;AACjF,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAEnC,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;IAC3B,OAAO,CAAC,GAAG,CAAC,WAAW,GAAG,GAAG,CAAC;AAClC,CAAC;KAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;IACrC,OAAO,CAAC,GAAG,CAAC,WAAW,GAAG,GAAG,CAAC;AAClC,CAAC;KAAM,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,KAAK,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IACvG,OAAO,CAAC,GAAG,CAAC,WAAW,GAAG,GAAG,CAAC;AAClC,CAAC;AAED,OAAO,EAAC,GAAG,EAAC,MAAM,YAAY,CAAC;AAE/B,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;IACd,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type Server } from '@jalsoedesign/filezilla-core';
|
|
2
|
+
import { type ConnectionStage } from '@jalsoedesign/filezilla-connector-abstract';
|
|
3
|
+
export type ConnectionCheckStage = ConnectionStage | 'input' | 'list' | 'cleanup';
|
|
4
|
+
export type ConnectionCheckStatus = 'ok' | 'invalid-options' | 'trust-rejected' | 'authentication-failed' | 'unsupported-protocol' | 'connection-failed' | 'directory-failed' | 'credentials-required' | 'invalid-site' | 'cleanup-failed' | 'listing-limit' | 'cancelled' | 'timeout';
|
|
5
|
+
export interface ConnectionCheckResult {
|
|
6
|
+
readonly schemaVersion: 1;
|
|
7
|
+
readonly ok: boolean;
|
|
8
|
+
readonly status: ConnectionCheckStatus;
|
|
9
|
+
readonly exitCode: number;
|
|
10
|
+
readonly stage: ConnectionCheckStage;
|
|
11
|
+
readonly message: string;
|
|
12
|
+
readonly connected: boolean;
|
|
13
|
+
readonly directoryChecked: boolean;
|
|
14
|
+
readonly cleanup: 'not-required' | 'closed' | 'failed';
|
|
15
|
+
readonly listing?: readonly {
|
|
16
|
+
readonly path: string;
|
|
17
|
+
readonly type: string;
|
|
18
|
+
readonly size?: number;
|
|
19
|
+
}[];
|
|
20
|
+
}
|
|
21
|
+
export interface ConnectionCheckOptions {
|
|
22
|
+
readonly hostKeySha256?: string;
|
|
23
|
+
readonly password?: string;
|
|
24
|
+
readonly directory?: string;
|
|
25
|
+
readonly includeListing?: boolean;
|
|
26
|
+
readonly timeoutMs?: number;
|
|
27
|
+
readonly maxEntries?: number;
|
|
28
|
+
readonly abortSignal?: AbortSignal;
|
|
29
|
+
}
|
|
30
|
+
/** Ordinary read-only connector operations with fixed, credential-free result messages. */
|
|
31
|
+
export declare function checkConnection(server: Server, options?: ConnectionCheckOptions): Promise<ConnectionCheckResult>;
|
|
32
|
+
export declare function runCheckCommand(args: string[]): Promise<void>;
|
|
33
|
+
//# sourceMappingURL=check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/commands/check.ts"],"names":[],"mappings":"AAGA,OAAO,EAA4C,KAAK,MAAM,EAAC,MAAM,8BAA8B,CAAC;AAGpG,OAAO,EAaH,KAAK,eAAe,EAGvB,MAAM,4CAA4C,CAAC;AAEpD,MAAM,MAAM,oBAAoB,GAAG,eAAe,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;AAClF,MAAM,MAAM,qBAAqB,GAAG,IAAI,GAAG,iBAAiB,GAAG,gBAAgB,GA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