diff --git a/README.md b/README.md index 0cedf4e..a61c23b 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ | Structural outlines (functions, structs, imports) | Multi-project support | | Reverse dependency graph | Remote indexing over SSH | | Atomic line-range edits with version tracking | | -| Auto-registration in Claude, Codex, Gemini, Cursor | | +| Auto-registration in Claude, Codex, Gemini, Cursor, Swival | | | Polling file watcher with filtered directory walker | | | Portable snapshot for instant MCP startup | | | Multi-agent support with file locking + heartbeats | | @@ -64,7 +64,7 @@ curl -fsSL https://codedb.codegraff.com/install.sh | sh ``` -Downloads the binary for your platform and auto-registers codedb as an MCP server in **Claude Code**, **Codex**, **Gemini CLI**, and **Cursor**. +Downloads the binary for your platform and auto-registers codedb as an MCP server in **Claude Code**, **Codex**, **Gemini CLI**, **Cursor**, and **Swival**. | Platform | Binary | Signed | |----------|--------|--------| diff --git a/install/install.sh b/install/install.sh index 0130dc3..07022a8 100644 --- a/install/install.sh +++ b/install/install.sh @@ -150,6 +150,84 @@ PYEOF printf " ${G}✓${N} cursor ${D}→ $config${N}\n" } +register_swival() { + local codedb_bin="$1" + local config_dir="${XDG_CONFIG_HOME:-$HOME/.config}/swival" + local config="$config_dir/config.toml" + + if [ ! -d "$config_dir" ]; then + return + fi + + if ! command -v python3 >/dev/null 2>&1; then + printf " ${D}swival: skip (python3 not found)${N}\n" + return + fi + + local status + if python3 - "$config" "$codedb_bin" << 'PYEOF' +import os, stat, sys, tempfile + +config_path, codedb_bin = sys.argv[1], sys.argv[2] +block_header = "[mcp_servers.codedb]" + +if os.path.exists(config_path): + with open(config_path, encoding="utf-8") as f: + content = f.read() + if block_header in content: + sys.exit(10) +else: + content = "" + +command = codedb_bin.translate(str.maketrans({ + "\\": "\\\\", + '"': '\\"', + "\b": "\\b", + "\t": "\\t", + "\n": "\\n", + "\f": "\\f", + "\r": "\\r", +})) +block = f'{block_header}\ncommand = "{command}"\nargs = ["mcp"]\n' +if content and not content.endswith("\n"): + content += "\n" +if content: + content += "\n" +content += block + +fd, temp_path = tempfile.mkstemp(dir=os.path.dirname(config_path) or ".") +try: + os.fchmod(fd, stat.S_IRUSR | stat.S_IWUSR) + with os.fdopen(fd, "w", encoding="utf-8") as f: + f.write(content) + os.replace(temp_path, config_path) + os.chmod(config_path, stat.S_IRUSR | stat.S_IWUSR) +except Exception: + try: + os.unlink(temp_path) + except FileNotFoundError: + pass + raise +PYEOF + then + status=0 + else + status=$? + fi + + case "$status" in + 0) + printf " ${G}✓${N} swival ${D}→ $config${N}\n" + ;; + 10) + printf " ${G}✓${N} swival ${D}→ $config (already registered)${N}\n" + ;; + *) + return "$status" + ;; + esac +} + main() { local platform version ext="" platform="$(detect_platform)" @@ -203,6 +281,7 @@ main() { register_codex "$dest" register_gemini "$dest" register_cursor "$dest" + register_swival "$dest" # Check PATH case ":$PATH:" in diff --git a/website/app/index.zig b/website/app/index.zig index 70f20ea..2abf494 100644 --- a/website/app/index.zig +++ b/website/app/index.zig @@ -348,7 +348,7 @@ const html = \\