feat!: Huge update - Link another CLI (such as gemini directly from with Claude Code / Codex). https://github.com/BeehiveInnovations/zen-mcp-server/issues/208

Zen now allows you to define `roles` for an external CLI and delegate work to another CLI via the new `clink` tool (short for `CLI + Link`). Gemini, for instance, offers 1000 free requests a day - this means you can save on tokens and your weekly limits within Claude Code by delegating work to another entirely capable CLI agent!

Define your own system prompts as `roles` and make another CLI do anything you'd like. Like the current tool you're connected to, the other CLI has complete access to your files and the current context. This also works incredibly well with Zen's `conversation continuity`.
This commit is contained in:
Fahad
2025-10-05 10:40:44 +04:00
parent 0d46976a8a
commit a2ccb48e9a
21 changed files with 1387 additions and 0 deletions

36
clink/constants.py Normal file
View File

@@ -0,0 +1,36 @@
"""Internal defaults and constants for clink."""
from __future__ import annotations
from dataclasses import dataclass, field
from pathlib import Path
DEFAULT_TIMEOUT_SECONDS = 1800
DEFAULT_STREAM_LIMIT = 10 * 1024 * 1024 # 10MB per stream
PROJECT_ROOT = Path(__file__).resolve().parent.parent
BUILTIN_PROMPTS_DIR = PROJECT_ROOT / "systemprompts" / "clink"
CONFIG_DIR = PROJECT_ROOT / "conf" / "cli_clients"
USER_CONFIG_DIR = Path.home() / ".zen" / "cli_clients"
@dataclass(frozen=True)
class CLIInternalDefaults:
"""Internal defaults applied to a CLI client during registry load."""
parser: str
additional_args: list[str] = field(default_factory=list)
env: dict[str, str] = field(default_factory=dict)
default_role_prompt: str | None = None
timeout_seconds: int = DEFAULT_TIMEOUT_SECONDS
runner: str | None = None
INTERNAL_DEFAULTS: dict[str, CLIInternalDefaults] = {
"gemini": CLIInternalDefaults(
parser="gemini_json",
additional_args=["-o", "json"],
default_role_prompt="systemprompts/clink/gemini_default.txt",
runner="gemini",
),
}