Commit 03dbb04
feat(editor): Remote-SSH 跨ホストの attach 対応 + up 時のターミナル自動表示 (PLAN31_3) (#70)
* feat(editor): Remote-SSH 跨ホストの attach 対応 + up 時のターミナル自動表示 (PLAN31_3)
Windows VS Code → Remote-SSH(Mac) → Mac の Docker 上コンテナ、という構成で
devbase up の自動オープンが「コンテナが存在しません」で失敗する問題を修正。
実機検証の結果、ネスト authority attached-container+...@ssh-remote+<host> は
実際にサポートされており、これを使うと docker ルックアップが ssh 先(コンテナの
ある側)で行われ解決できる(PLAN31_3 §2.3/§2.4 の当初想定を訂正)。
- build_attach_uri に ssh_host / docker_context を追加しネスト URI を生成
- DEVBASE_EDITOR_SSH_HOST(明示) / DEVBASE_EDITOR_DOCKER_CONTEXT(既定 docker context show)
※ ssh ホスト別名は VS Code が ssh 先端末 env に渡さず自動取得不可のため明示必須
- DEVBASE_OPEN_TERMINAL(既定 ON): up 時に folderOpen タスク .vscode/tasks.json を
docker exec で配置し、フォルダを開くと統合ターミナルを自動表示(既存はスキップ)
- CLI: --open-terminal / --no-open-terminal を追加
- docs / PLAN31_3 を実態へ更新、テスト追加
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* feat(editor): ssh-remote ホスト名を ~/.vscode-server から自動検出 (env 変数不要化)
跨ホスト Remote-SSH attach に必要な ssh-remote authority ラベル(例 mac2)を、
ssh 先 ~/.vscode-server の File History (entries.json の resource URI に残る
ssh-remote%2B<host>) から自動検出するようにし、DEVBASE_EDITOR_SSH_HOST の明示を
不要にした(明示は上書きとして残す)。
- IP / user@IP でのネスト attach は不可と実機確認(既存 ExecServer の authority と
一致が必須、"Parent authority found without ExecServer")。別名一致のみ有効
- resolve_editor_ssh_host: 明示 → ~/.vscode-server 自動検出 → None(フラット) の三段
- 複数 ssh-remote ホストは最新 mtime の entries.json を優先
- docs / PLAN31_3 を自動検出方式へ更新、テスト追加
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* perf(editor): ssh host 自動検出を mtime 降順・最初の一致で打ち切り
_detect_ssh_host_from_vscode が全 entries.json を読んでいたのを、mtime 降順で
新しいファイルから順に読み最初の ssh-remote 一致で即 return する実装へ変更。
History が巨大でも全読み込みを避け devbase up の遅延を防ぐ (gemini 指摘 / major)。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* feat(editor): ssh host 自動検出を複数エディタのサーバーディレクトリへ拡張
DEVBASE_EDITOR=cursor / code-insiders 等でも跨ホスト自動検出が効くよう、
~/.vscode-server に加え ~/.cursor-server / ~/.vscode-server-insiders /
~/.vscodium-server / ~/.windsurf-server を横断し、全 entries.json から最新
mtime のホストを採用する (_detect_ssh_host_from_dirs)。gemini 指摘 / major。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* perf(editor): ssh host 自動検出の entries.json 走査を上限 200 件に制限
無マッチ時に全 entries.json を read するのを避けるため、mtime 降順で新しい方から
最大 200 件のみ内容を読む (該当ホストは直近接続のファイルに載るため安全)。gemini 指摘 / minor。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* perf(editor): open_editor の skip 経路を URI 解決前に early return
skip 判定 (非TTY/CI・code 不在等) でも resolve_container_name(docker compose ps) や
resolve_docker_context(docker context show) を呼んでいたのを、skip を先に return して
無駄な外部コマンド実行を回避。gemini 指摘 / minor。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* feat(editor): DEVBASE_EDITOR_SSH_HOST/DOCKER_CONTEXT の空文字でオプトアウト可能に
env が空文字 ("") の場合を「明示的オプトアウト」として扱い、ssh host は自動推測を
スキップしてフラット URI 強制、docker context は settings.context を付けない。
判定を `is not None` に変更 (定義されていれば値を尊重し、空なら None)。gemini 指摘 / major。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* perf(editor): コンテナ名解決を 1 回に集約し docker compose ps の二重実行を回避
_maybe_place_terminal_task が解決した実コンテナ名を返し、_maybe_open_editor →
open_editor へ container_name として渡して resolve_container_name(docker compose ps)
の重複呼び出しを除去。gemini 指摘 / minor。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(editor): folderOpen ターミナルタスクを SHELL 未設定でも起動可能に
build_folder_open_tasks_json を type:shell + ${env:SHELL} から type:process +
/bin/sh -lc 'exec "${SHELL:-/bin/sh}"' へ変更。SHELL 未設定コンテナで command が
空になりタスクが即失敗する問題を修正。codex 指摘 / major。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* fix(editor): plain SSH では ssh host 自動検出を抑止 + open_index 集約 + scandir 化
- plain SSH (VS Code 外) は既存 ExecServer 不在でネスト URI が動かないため、自動検出は
in_vscode の時だけ有効化 (resolve_editor_ssh_host に auto_detect 引数追加)。plain SSH は
明示設定時のみネスト URI を採用。codex 指摘 / major
- open_index の env フォールバック+範囲チェックを _resolve_open_index に集約 (重複排除)。gemini / minor
- ssh host 自動検出の History 走査を os.walk → os.scandir (固定深さ 1 階層) に変更。gemini / minor
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* docs(editor): opener モジュール docstring を実態へ更新 (ネスト authority サポート)
冒頭 docstring が「ネスト authority は公式未サポート」と旧設計のまま残り実装・PLAN・
docs と矛盾していたのを、attached-container+...@ssh-remote+<host> 実サポート + 自動検出 +
plain SSH degrade の現設計へ更新。codex 指摘 (round 4/5/10 で line 13 が diff 外のため
inline 投稿 422 となり取りこぼしていた件) / minor。
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent f235d4b commit 03dbb04
8 files changed
Lines changed: 752 additions & 56 deletions
File tree
- docs/user
- issues
- lib/devbase
- commands
- editor
- env
- tests
- cli
- editor
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
152 | 155 | | |
153 | | - | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
154 | 168 | | |
155 | 169 | | |
156 | 170 | | |
157 | 171 | | |
158 | 172 | | |
159 | 173 | | |
160 | 174 | | |
161 | | - | |
| 175 | + | |
| 176 | + | |
162 | 177 | | |
163 | 178 | | |
164 | 179 | | |
165 | | - | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
166 | 200 | | |
167 | 201 | | |
168 | 202 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | | - | |
47 | | - | |
48 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
49 | 62 | | |
50 | 63 | | |
51 | 64 | | |
52 | 65 | | |
53 | 66 | | |
54 | 67 | | |
55 | 68 | | |
56 | | - | |
57 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
58 | 72 | | |
59 | 73 | | |
60 | | - | |
61 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
62 | 82 | | |
63 | 83 | | |
64 | 84 | | |
| |||
156 | 176 | | |
157 | 177 | | |
158 | 178 | | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
165 | 195 | | |
166 | 196 | | |
167 | 197 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
115 | 122 | | |
116 | 123 | | |
117 | 124 | | |
| |||
0 commit comments