mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-25 18:16:32 +00:00
通过 SSH exec channel 在远程机器上执行 ls 命令获取目录内容,
在补全菜单中显示文件/目录列表。
实现:
- sshBridge.cjs: 新增 netcatty:ssh:listdir IPC handler,
使用 session.conn.exec() 在独立 channel 执行 ls -1Fap,
不影响交互式终端
- main.cjs: 新增 netcatty:local:listdir,本地终端用 fs.readdir
- preload.cjs: 暴露 listRemoteDir/listLocalDir API
- remotePathCompleter.ts: 路径补全核心模块
- shouldDoPathCompletion: 检测 fig spec template/generators、
PATH_COMMANDS 白名单、或输入以 / ./ ../ ~/ 开头
- resolvePathComponents: 解析目录路径和过滤前缀
- getPathSuggestions: 编排检测→解析→IPC→格式化
- 5 秒 TTL 缓存 + in-flight 请求去重
- completionEngine.ts: SuggestionSource 新增 "path" 类型,
CompletionSuggestion 新增 fileType 字段,
getCompletions 接受 sessionId/protocol/cwd 参数
- AutocompletePopup.tsx: 路径建议显示 📁/📄/🔗 图标
- Terminal.tsx: 传入 protocol 和 getCwd
支持:SSH 远程目录、本地终端、cd 仅显示目录、
空格文件名转义、head -100 限制输出
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>