Skip to content

FUSE: Implement SFTP remote connections #12

Description

@efimsky

Parent Issue

Part of #118 (FUSE-based Archive & Remote Browsing Feature)

Summary

Add SFTP browsing support using sshfs.

Dependencies

Requires #121 (MountManager integration with App)

Tasks

MountManager

  • Implement mount_sftp(connection: str) -> Path | None

    • Parse connection string (user@host:/path)
    • Generate mount point using hash
    • Execute sshfs user@host:/path /mount/point
    • Track in active_mounts with mount_type='sftp'
    • Return mount point or None on failure
  • Implement can_mount_sftp() -> bool

    • Return self.tools.sshfs

Menu Integration

  • Add new Action enum values:

    CONNECT_SFTP = auto()
  • Add "Connect" menu between File and Command in menu.py:

    Menu('Connect', [
        MenuItem('SFTP...', 'connect_sftp'),
        # ... more items in future phases
    ])
  • Add 'connect_sftp': Action.CONNECT_SFTP to MENU_ACTION_MAP

App Methods

  • Handle Action.CONNECT_SFTP in run loop
  • Implement App._prompt_sftp_connect():
    • Show input dialog for connection string
    • Validate format (user@host:/path or user@host)
    • Call mount_manager.mount_sftp()
    • Navigate to mount point on success
    • Show error on failure

Input Dialog

  • Create simple text input dialog for SFTP connection string
  • Support format: user@hostname:/remote/path or user@hostname

Testing

  • Test mount_sftp() calls sshfs with correct arguments
  • Test mount_sftp() tracks mount with mount_type='sftp'
  • Test can_mount_sftp() returns correct value based on tool availability
  • Test SFTP menu item exists in Connect menu
  • Test CONNECT_SFTP action triggers connection prompt

Files

  • Modify: tnc/mount.py
  • Modify: tnc/app.py
  • Modify: tnc/menu.py
  • Modify: tests/test_mount.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions