mirror of
https://github.com/hanzoai/python-sdk.git
synced 2026-10-23 20:23:00 +00:00
Rename hanzo-repl → hanzo-dev to match @hanzo/dev (Rust/TS). New packages: - hanzo-lsp: async LSP client (diagnostics, go-to-def, references, context enrichment) - hanzo-hooks: pre/post tool use hooks (shell scripts, exit-code deny) - hanzo-sandbox: container detection, filesystem isolation, Linux unshare hanzo-dev TUI: - Vim keybindings (Normal/Insert/Visual/Command modes, 37 tests) - Git slash commands (/branch /commit /worktree /diff /stash, 13 tests) - All slash commands at parity: /model /permissions /clear /resume /memory /init /export /session /plan /solve /code /auto /fast /remote-control - Multi-provider auth: Anthropic OAuth, OpenAI device code, Hanzo PKCE, auto-detect Auth: - login_with_anthropic() — PKCE via console.hanzo.ai - login_with_openai() — device code flow via auth.openai.com - login_auto() — env var detection + saved credential fallback - OAuthCredentialStore supports provider keys (hanzo/anthropic/openai) Parity test suite (38 tests): SSE, MCP normalization, permissions, compaction, token usage, PKCE RFC vector, config, backoff, session roundtrip, hooks. 348 tests total, 0 failures across Python + Rust + Universe E2E.
48 lines
1.1 KiB
Python
48 lines
1.1 KiB
Python
"""CLI entry point for Hanzo REPL."""
|
|
|
|
import asyncio
|
|
|
|
import click
|
|
|
|
from .ipython_repl import main as ipython_main
|
|
from .repl import HanzoREPL
|
|
|
|
|
|
@click.command()
|
|
@click.option(
|
|
"--mode",
|
|
default="ipython",
|
|
type=click.Choice(["basic", "ipython", "tui"]),
|
|
help="REPL mode to use",
|
|
)
|
|
@click.option("--debug", is_flag=True, help="Enable debug mode")
|
|
@click.option("--model", help="LLM model to use")
|
|
@click.option(
|
|
"--config",
|
|
"config_home",
|
|
default=None,
|
|
help="Path to config home (default: ~/.hanzo)",
|
|
)
|
|
def main(mode, debug, model, config_home):
|
|
"""Hanzo REPL - Interactive testing environment."""
|
|
import os
|
|
|
|
if config_home:
|
|
os.environ["HANZO_CONFIG_HOME"] = config_home
|
|
|
|
if mode == "tui":
|
|
from .textual_repl import main as tui_main
|
|
tui_main()
|
|
elif mode == "ipython":
|
|
# Use IPython-based REPL (recommended)
|
|
ipython_main()
|
|
else:
|
|
# Use basic REPL
|
|
config = {"debug": debug, "model": model}
|
|
repl = HanzoREPL(config)
|
|
asyncio.run(repl.run())
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|