Add Claude Code integration: shared config + Setup tab
- Shared servers.json at ~/.server-connections/ (GUI + Claude Code) - Setup tab: one-click install of ssh.py, /ssh skill, SSH key - Duplicate checks — safe to run multiple times - tools/ssh.py + tools/skill-ssh.md bundled - Updated README with integration docs (EN/RU/ZH) - Deploy guide for new machines Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4,11 +4,16 @@ Server store — CRUD + JSON persistence + observer pattern.
|
||||
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
from typing import Callable, Optional
|
||||
|
||||
CONFIG_DIR = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "config")
|
||||
SERVERS_FILE = os.path.join(CONFIG_DIR, "servers.json")
|
||||
EXAMPLE_FILE = os.path.join(CONFIG_DIR, "servers.example.json")
|
||||
# Shared config — same file used by ssh.py and Claude Code /ssh skill
|
||||
SHARED_DIR = os.path.expanduser("~/.server-connections")
|
||||
SERVERS_FILE = os.path.join(SHARED_DIR, "servers.json")
|
||||
|
||||
# Fallback: local config dir (for example file)
|
||||
LOCAL_CONFIG_DIR = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "config")
|
||||
EXAMPLE_FILE = os.path.join(LOCAL_CONFIG_DIR, "servers.example.json")
|
||||
|
||||
SERVER_TYPES = ["ssh", "telnet", "rdp", "mariadb", "mssql", "postgresql"]
|
||||
|
||||
@@ -39,7 +44,7 @@ class ServerStore:
|
||||
self._save()
|
||||
|
||||
def _save(self):
|
||||
os.makedirs(CONFIG_DIR, exist_ok=True)
|
||||
os.makedirs(SHARED_DIR, exist_ok=True)
|
||||
with open(SERVERS_FILE, "w", encoding="utf-8") as f:
|
||||
json.dump(self._data, f, indent=2, ensure_ascii=False)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user