Context Commands
A context is a named environment registered on the operator machine. It tells SFTPWarden where the project lives, which provider it uses, whether it is local or remote, and how remote sync should work.
sftpwarden context
Command group for the context registry. It also exposes dynamic field commands
such as sftpwarden context root and sftpwarden context remote-root.
sftpwarden context --help
Subcommands:
lscurrentusedefaultshowaddrenameremovecleardynamic field commands documented under
sftpwarden context FIELD
sftpwarden context ls
Lists registered contexts.
sftpwarden context ls
sftpwarden context ls --json
Options
Flag |
Value |
Default |
What it does |
|---|---|---|---|
|
flag |
false |
Prints the full context registry as JSON. |
Cleanup Behavior
Before listing, SFTPWarden prunes local contexts whose local project folder was deleted manually. For remote local-sync contexts, this cleanup is local-only: it removes stale local registry and watcher traces but does not connect to the remote host or delete remote files.
Remote-only contexts have no local project folder to prune. Real remote commands
such as deploy, refresh, health, or backup detect missing remote roots
when they connect.
sftpwarden context current
Prints the active context name.
sftpwarden context current
Options
No command-specific options.
sftpwarden context use
Sets the active context.
sftpwarden context use dev
Arguments
Argument |
Required |
Value |
What it means |
|---|---|---|---|
|
Yes |
|
Existing registered context to make active. |
Options
No command-specific options.
sftpwarden context default
Explicit form of sftpwarden context use.
sftpwarden context default prod
Arguments
Argument |
Required |
Value |
What it means |
|---|---|---|---|
|
Yes |
|
Existing registered context to make active. |
Options
No command-specific options.
sftpwarden context show
Shows one context as JSON.
sftpwarden context show
sftpwarden context show prod
Arguments
Argument |
Required |
Value |
What it means |
|---|---|---|---|
|
No |
|
Context to show. If omitted, the active context is shown. |
Options
No command-specific options.
sftpwarden context add
Registers an existing local or remote project.
sftpwarden context add dev
sftpwarden context add dev --root ~/sftpwarden-dev
sftpwarden context add prod [email protected]:/opt/sftpwarden --critical
sftpwarden context add archive [email protected]:/opt/sftpwarden --remote-only --critical
Arguments
Argument |
Required |
Value |
What it means |
|---|---|---|---|
|
Yes |
|
Context name to register. |
|
No |
|
Optional |
Options
Flag |
Value |
Default |
What it does |
|---|---|---|---|
|
|
|
Local project root for local and remote local-sync contexts. |
|
|
provider from local config, or global default for remote |
Provider type stored in the registry. |
|
|
parsed from remote URL or SSH default |
Remote SSH user. |
|
|
global SSH default |
Remote SSH port. |
|
|
global remote root |
Explicit remote project root. |
|
flag |
false |
Registers a context that has no local project files. |
|
|
SSH default |
Explicit SSH key for remote operations and Docker watcher mode. |
|
|
auto when needed |
Watcher backend to install or reuse for remote local-sync contexts. |
|
flag |
false |
Marks the context as critical. |
|
flag |
false |
Skips remote prerequisite checks. |
|
flag |
false |
Accepts prompts, including production-like non-critical confirmation and watcher prompts. |
When To Use It
Use context add when the SFTPWarden project already exists. Use
sftpwarden init for new projects.
sftpwarden context rename
Renames a registered context.
sftpwarden context rename old-name new-name
Arguments
Argument |
Required |
Value |
What it means |
|---|---|---|---|
|
Yes |
|
Existing registered context. |
|
Yes |
|
Replacement context name. |
Options
No command-specific options.
sftpwarden context remove
Removes a context and cleans project-owned local resources.
sftpwarden context remove dev
sftpwarden context remove dev --yes
sftpwarden context remove prod --yes --delete-remote
Arguments
Argument |
Required |
Value |
What it means |
|---|---|---|---|
|
Yes |
|
Registered context to remove. |
Options
Flag |
Value |
Default |
What it does |
|---|---|---|---|
|
flag |
false |
Accepts local cleanup confirmation. For remote contexts, |
|
flag |
false |
Also stops/removes remote runtime resources and deletes the remote project root for remote contexts. |
Effects
For local Compose contexts, SFTPWarden stops the local Compose runtime when
possible and removes project-owned local files when they are not shared with
another context. For remote local-sync contexts, it removes the local synced
project folder and watcher traces. Remote files are left untouched unless
--delete-remote is explicitly requested or confirmed interactively.
sftpwarden context clear
Clears the active/default context.
sftpwarden context clear
Options
No command-specific options.
sftpwarden context FIELD
Reads or updates one field in the active context registry entry. If VALUE is
omitted, the command prints the current value. If VALUE is supplied, the
command updates the registry field.
sftpwarden context root
sftpwarden context root ~/sftpwarden-dev2 --yes
sftpwarden context remote-root /opt/sftpwarden-prod --yes
sftpwarden context type remote --remote [email protected]:/opt/sftpwarden --yes
sftpwarden context type local --yes
Arguments
Argument |
Required |
Value |
What it means |
|---|---|---|---|
|
Yes |
one supported field command |
Registry field command, such as |
|
No |
YAML-like scalar text |
Replacement value. Omit it to read the current value. |
Options
Flag |
Value |
Default |
What it does |
|---|---|---|---|
|
|
active context |
Context entry to read or edit. |
|
|
prompt when converting to remote |
Remote URL used when changing |
|
|
existing root or generated default |
Local root used by root moves or type conversion. |
|
|
existing remote user or SSH default |
Remote SSH user used by type conversion. |
|
|
existing or default SSH port |
Remote SSH port used by type conversion. |
|
|
existing or default remote root |
Remote root used by type conversion. |
|
flag |
false |
Creates a remote-only registry entry when converting to remote. |
|
flag |
false |
Deletes the previous local root after copying it during |
|
flag |
false |
Accepts prompts for root copy/delete, remote-root updates, type conversion, and watcher cleanup. |
Supported Field Commands
Command |
Registry field |
Notes |
|---|---|---|
|
|
Renames the context and updates |
|
|
Accepts |
|
|
Copies project files to the new root and updates the registered config path. |
|
|
Direct registry config path. Use carefully. |
|
|
Provider type stored in the registry. |
|
|
Boolean critical-context flag. |
|
|
Remote storage mode, normally |
|
|
Boolean flag used by watcher planning. |
|
|
Remote project root. Updates dependent remote config path. |
|
|
Remote path to |
|
|
Explicit remote SSH key path. |
|
|
Remote SSH host. |
|
|
Remote SSH user. |
|
|
Remote SSH port. |
|
|
Remote Compose file path/name. |
Safety
Changing context registry fields changes how future commands find and operate on
projects. It does not move remote files automatically. After changing fields that
affect deployment, run sftpwarden deploy to apply project desired state.