Files
zhaolei 3c72efcb7f
Some checks failed
build-packages / resolve bundled mosh-client (push) Has been cancelled
build-packages / resolve bundled et-client (push) Has been cancelled
build-packages / build-macos (push) Has been cancelled
build-packages / build-windows (push) Has been cancelled
build-packages / build-linux-x64 (push) Has been cancelled
build-packages / build-linux-arm64 (push) Has been cancelled
build-packages / release (push) Has been cancelled
build-packages / update Nix release metadata (push) Has been cancelled
build-packages / bump homebrew tap (push) Has been cancelled
test / lint-and-test (push) Has been cancelled
AI automation / Route event (push) Has been cancelled
AI automation / Hand reopened issue to maintainers (push) Has been cancelled
AI automation / Clean source issue state (push) Has been cancelled
AI automation / Reconcile handoffs (push) Has been cancelled
AI automation / Classify issue (push) Has been cancelled
AI automation / Claude Code smoke (push) Has been cancelled
AI automation / Review issue follow-up (push) Has been cancelled
AI automation / Publish issue follow-up (push) Has been cancelled
AI automation / Implement with Claude Code (push) Has been cancelled
AI automation / Publish implement PR (push) Has been cancelled
AI automation / Continue queued issue comments (push) Has been cancelled
AI automation / Codex review loop (push) Has been cancelled
AI automation / Publish Codex fix (push) Has been cancelled
AI automation / Clear Codex dispatch marker (push) Has been cancelled
AI automation / Own PR re-request Codex (push) Has been cancelled
AI automation / External PR re-request Codex (push) Has been cancelled
AI automation / Poll Codex reaction / retry (push) Has been cancelled
build-et-binaries / build-linux-x64 (push) Has been cancelled
build-et-binaries / build-linux-arm64 (push) Has been cancelled
build-et-binaries / build-macos-universal (push) Has been cancelled
build-et-binaries / build-windows-x64 (push) Has been cancelled
build-et-binaries / release (push) Has been cancelled
[Init] Initial commit - NetMesh terminal manager
2026-09-13 18:24:01 +08:00

2.9 KiB

SFTP Reference

Use this reference for remote file or directory tasks.

Default Path

  • Treat file and directory tasks as SFTP tasks by default, not shell tasks.
  • If the user explicitly says to use only sftp, do not call exec.
  • Every sftp command must include both --session <session-id> and --chat-session <chat-session-id>.
  • Do not use reusable SFTP handles or --sftp <id>.
  • After choosing a target session, first run session --session <id> --json --chat-session <chat-session-id> and inspect the returned metadata.
  • Use SFTP only when that session result shows a connected SSH-backed session. For local, Mosh, Telnet, serial/raw, or network-device sessions, do not use SFTP.
  • Keep path semantics strict:
    • --remote-path always means a path on the remote host.
    • --local-path always means a path on the local machine running Netcatty.
  • If the user says "download" to a local destination such as /tmp, ~/Downloads, or Desktop, use sftp download.
  • If the user says to create or modify a file on the remote host, use sftp write, sftp upload, or another remote SFTP operation. Do not reinterpret that as a local download.

One-Off Commands

  • List a directory:
    • <netcatty-cli-prefix> sftp list --session <session-id> --remote-path <remote-path> --json --chat-session <chat-session-id>
  • Read a file:
    • <netcatty-cli-prefix> sftp read --session <session-id> --remote-path <remote-path> --json --chat-session <chat-session-id>
  • Write a small text file with known content:
    • <netcatty-cli-prefix> sftp write --session <session-id> --remote-path <remote-path> --content <text> --json --chat-session <chat-session-id>
  • Download a remote file to an existing local path:
    • <netcatty-cli-prefix> sftp download --session <session-id> --remote-path <remote-path> --local-path <local-path> --json --chat-session <chat-session-id>
  • Upload an existing local file:
    • <netcatty-cli-prefix> sftp upload --session <session-id> --local-path <local-path> --remote-path <remote-path> --json --chat-session <chat-session-id>
  • Delete a remote path:
    • <netcatty-cli-prefix> sftp delete --session <session-id> --remote-path <remote-path> --json --chat-session <chat-session-id>

Rules

  • Use sftp write directly for creating or updating a small text file with known content.
  • Use sftp upload only when a real local file already exists and must be transferred.
  • Use sftp download when the result must be saved to the local filesystem.
  • Do not create temporary local files just to upload text that could be sent with sftp write.
  • Do not use sftp read as a substitute for sftp download when the user asked for a local saved file.
  • Do not use sftp write as a substitute for sftp download; writing to /tmp/foo with sftp write writes to the remote host's /tmp, not the local machine.
  • Do not use shell commands like cat, touch, redirection, or ad hoc SCP/SSH usage for remote file tasks.