2026-04-27 21:17:53 -07:00
|
|
|
# SCP Plugin Walkthrough
|
|
|
|
|
|
2026-05-16 15:26:08 -07:00
|
|
|
This walkthrough covers the bundled `scp` plugin, backed by existing SSH
|
|
|
|
|
libraries:
|
2026-04-27 21:17:53 -07:00
|
|
|
|
|
|
|
|
- `paramiko` for SSH and SFTP directory listing
|
|
|
|
|
- `scp` for file transfers
|
|
|
|
|
|
|
|
|
|
The implementation lives in [plugins/scp/__init__.py](plugins/scp/__init__.py).
|
|
|
|
|
|
2026-05-16 15:26:08 -07:00
|
|
|
## What the plugin does
|
2026-04-27 21:17:53 -07:00
|
|
|
|
|
|
|
|
The SCP plugin mirrors the FTP walkthrough, but on top of SSH:
|
2026-05-16 15:26:08 -07:00
|
|
|
- `search-file -plugin scp -instance <name> ...` lists remote files and folders over SFTP
|
|
|
|
|
- plain `@N` on a folder drills into that directory
|
|
|
|
|
- plain `@N` on a file runs `download-file -plugin scp -instance <name> -url ...`
|
|
|
|
|
- `@N | add-file -instance ...` downloads first, then ingests the local temp file
|
2026-05-24 12:32:57 -07:00
|
|
|
- `add-file <local-file> -plugin scp -instance <name>` uploads a local file to the configured remote path
|
2026-04-27 21:17:53 -07:00
|
|
|
|
2026-05-16 15:26:08 -07:00
|
|
|
## Example config
|
2026-04-27 21:17:53 -07:00
|
|
|
|
2026-05-16 15:26:08 -07:00
|
|
|
Add one or more named SCP plugin instances to your config. The current stored
|
|
|
|
|
key path remains `provider.scp.<instance>` for legacy compatibility:
|
2026-04-27 21:17:53 -07:00
|
|
|
|
|
|
|
|
```toml
|
2026-04-28 22:20:54 -07:00
|
|
|
[provider.scp.work]
|
2026-04-27 21:17:53 -07:00
|
|
|
host = "ssh.example.com"
|
|
|
|
|
port = 22
|
|
|
|
|
username = "deploy"
|
|
|
|
|
password = "secret"
|
|
|
|
|
key_path = "C:/Users/Admin/.ssh/id_ed25519"
|
|
|
|
|
base_path = "/srv/files"
|
|
|
|
|
timeout = 20
|
|
|
|
|
search_depth = 1
|
|
|
|
|
allow_agent = true
|
|
|
|
|
look_for_keys = true
|
2026-04-28 22:20:54 -07:00
|
|
|
|
|
|
|
|
[provider.scp.archive]
|
|
|
|
|
host = "ssh-archive.example.com"
|
|
|
|
|
port = 2222
|
|
|
|
|
username = "archive"
|
|
|
|
|
key_path = "C:/Users/Admin/.ssh/archive_ed25519"
|
|
|
|
|
base_path = "/srv/archive"
|
|
|
|
|
timeout = 20
|
2026-04-27 21:17:53 -07:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Notes:
|
2026-05-16 15:26:08 -07:00
|
|
|
- `work` and `archive` are instance names.
|
2026-04-28 22:20:54 -07:00
|
|
|
- `host` and `username` are required for each instance to validate.
|
2026-04-27 21:17:53 -07:00
|
|
|
- You can use password auth, key auth, or both.
|
|
|
|
|
- `base_path` is both the default search root and the default upload directory.
|
2026-05-16 15:26:08 -07:00
|
|
|
- You can browse configured instances from `.config plugins` in the CLI.
|
2026-04-27 21:17:53 -07:00
|
|
|
|
2026-05-16 15:26:08 -07:00
|
|
|
## Search flow
|
2026-04-27 21:17:53 -07:00
|
|
|
|
|
|
|
|
```powershell
|
2026-04-28 22:20:54 -07:00
|
|
|
search-file -plugin scp -instance work "*"
|
|
|
|
|
search-file -plugin scp -instance work "invoice"
|
|
|
|
|
search-file -plugin scp -instance work "path:/srv/files/releases depth:2 *.zip"
|
|
|
|
|
search-file -plugin scp -instance work "path:/srv/files type:folder *"
|
2026-04-27 21:17:53 -07:00
|
|
|
```
|
|
|
|
|
|
2026-05-16 15:26:08 -07:00
|
|
|
## Selection flow
|
2026-04-27 21:17:53 -07:00
|
|
|
|
|
|
|
|
Folder rows are navigation rows:
|
|
|
|
|
|
|
|
|
|
```powershell
|
2026-04-28 22:20:54 -07:00
|
|
|
search-file -plugin scp -instance work "*"
|
2026-04-27 21:17:53 -07:00
|
|
|
@2
|
|
|
|
|
```
|
|
|
|
|
|
2026-05-16 15:26:08 -07:00
|
|
|
File rows carry an explicit row action, so terminal selection downloads
|
|
|
|
|
directly:
|
2026-04-27 21:17:53 -07:00
|
|
|
|
|
|
|
|
```powershell
|
2026-04-28 22:20:54 -07:00
|
|
|
search-file -plugin scp -instance work "report"
|
2026-04-27 21:17:53 -07:00
|
|
|
@1
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
That expands to the equivalent of:
|
|
|
|
|
|
|
|
|
|
```powershell
|
2026-04-28 22:20:54 -07:00
|
|
|
download-file -plugin scp -instance work -url scp://ssh.example.com/srv/files/report.pdf
|
2026-04-27 21:17:53 -07:00
|
|
|
```
|
|
|
|
|
|
2026-05-16 15:26:08 -07:00
|
|
|
## Download and add-file flow
|
2026-04-27 21:17:53 -07:00
|
|
|
|
|
|
|
|
```powershell
|
2026-04-28 22:20:54 -07:00
|
|
|
search-file -plugin scp -instance work "report"
|
2026-04-27 21:17:53 -07:00
|
|
|
@1 | download-file -path C:\Downloads
|
|
|
|
|
|
2026-04-28 22:20:54 -07:00
|
|
|
search-file -plugin scp -instance work "report"
|
2026-05-03 21:20:05 -07:00
|
|
|
@1 | add-file -instance tutorial
|
2026-04-27 21:17:53 -07:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Why this works:
|
|
|
|
|
- file rows advertise `_selection_action` for `download-file`
|
2026-05-16 15:26:08 -07:00
|
|
|
- `add-file` selection replay inserts that plugin download stage before ingest
|
|
|
|
|
- the plugin also implements `resolve_pipe_result_download()` for plugin-owned SCP rows
|
|
|
|
|
- file rows carry the chosen `instance`, so replay stays bound to the same SSH target
|
2026-04-27 21:17:53 -07:00
|
|
|
|
2026-05-16 15:26:08 -07:00
|
|
|
## Upload flow
|
2026-04-27 21:17:53 -07:00
|
|
|
|
|
|
|
|
```powershell
|
2026-05-24 12:32:57 -07:00
|
|
|
add-file C:\Media\report.pdf -plugin scp -instance archive
|
2026-04-27 21:17:53 -07:00
|
|
|
```
|
|
|
|
|
|
2026-05-16 15:26:08 -07:00
|
|
|
## Implementation notes
|
2026-04-27 21:17:53 -07:00
|
|
|
|
2026-05-16 15:26:08 -07:00
|
|
|
The plugin uses SFTP for directory listing because SCP itself is a transfer
|
|
|
|
|
protocol, not a browse/search protocol. That split keeps the plugin simple:
|
2026-04-27 21:17:53 -07:00
|
|
|
- browse and metadata via Paramiko SFTP
|
|
|
|
|
- file transfer via the `scp` package
|
|
|
|
|
|
2026-05-16 15:26:08 -07:00
|
|
|
## Recommended demo commands
|
2026-04-27 21:17:53 -07:00
|
|
|
|
|
|
|
|
```powershell
|
2026-04-28 22:20:54 -07:00
|
|
|
search-file -plugin scp -instance work "*"
|
|
|
|
|
search-file -plugin scp -instance work "path:/srv/files depth:2 *.zip"
|
2026-04-27 21:17:53 -07:00
|
|
|
@1
|
|
|
|
|
@1 | download-file -path C:\Downloads
|
2026-05-03 21:20:05 -07:00
|
|
|
@1 | add-file -instance tutorial
|
2026-05-24 12:32:57 -07:00
|
|
|
add-file C:\Media\report.pdf -plugin scp -instance archive
|
2026-04-27 21:17:53 -07:00
|
|
|
```
|