Metadata-Version: 2.4
Name: liantai
Version: 0.1.0
Summary: LianTai (莲台) - cross-platform launcher: open a terminal, activate a conda/venv Python env, and resume an opencode session, with adjustable window position.
Author-email: CodeOfMe <cycleuser@cycleuser.org>
License: MIT
Project-URL: Homepage, https://github.com/CodeOfMe/LianTai
Project-URL: Repository, https://github.com/CodeOfMe/LianTai
Project-URL: Issues, https://github.com/CodeOfMe/LianTai/issues
Keywords: terminal,conda,venv,opencode,launcher,cross-platform
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: System :: Shells
Classifier: Topic :: Utilities
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: rich
Requires-Dist: rich>=13.0; extra == "rich"
Provides-Extra: dev
Requires-Dist: pytest>=7; extra == "dev"
Requires-Dist: ruff>=0.4; extra == "dev"
Requires-Dist: mypy>=1.10; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"
Dynamic: license-file

# LianTai (莲台)

> Cross-platform launcher: open a terminal, activate a conda / venv Python environment,
> optionally resume an AI agent session (opencode, codex, claude, cursor, gemini),
> and place the window anywhere on screen — from one command.

跨平台终端启动器：一条命令开新终端、激活 conda 或 venv 的 Python 环境、续接 AI agent 的对话
session（opencode / codex / claude / cursor / gemini），并可以把窗口放到屏幕任意位置。

## Why

Tabby / Windows Terminal / iTerm2 each have their own profile system, and none of them
know about conda environments or AI agent sessions. LianTai bridges that gap with a
single, dependency-free Python CLI that works on Windows, macOS, and Linux.

Architectural inspiration: [muxy](https://github.com/muxy-app/muxy)'s
`AIProviderRegistry` / `AIAgentLaunchProvider` and
[tabby](https://github.com/Eugeny/tabby)'s `Shell` / `ProfileProvider` abstractions.

## Install

```bash
pip install liantai
# or from source:
pip install .
```

Requires Python ≥ 3.9. No runtime dependencies (optional `rich` for prettier output).

## Quick start

```bash
# List discovered Python environments
liantai envs

# List opencode sessions
liantai sessions

# List installed AI agent CLIs
liantai agents

# List sessions for any supported agent
liantai agent-sessions --agent opencode

# Open a terminal, activate conda env 'dev', do nothing else
liantai --env dev

# Open a terminal, activate 'dev', and resume an opencode session
liantai --env dev --opencode ses_0858eeaa6ffeSOGKMMSZslLEhf

# Agent-agnostic form (works for codex / claude / cursor / gemini too)
liantai --env dev --agent codex --session <session-id>

# Open Windows Terminal at (100,100) sized 1200x800
liantai --env dev --terminal wt --geometry 100,100,1200,800

# Run an arbitrary command after activation
liantai --env dev -- python -c "import sys; print(sys.executable)"
```

## Commands

| Action | Example |
| --- | --- |
| Open terminal + activate env | `liantai --env dev` |
| Resume opencode session (shorthand) | `liantai -o ses_xxx` |
| Resume any agent session | `liantai --agent codex --session <id>` |
| Place window | `liantai -g 100,100,1200,800` |
| Use a specific terminal | `liantai -t wt` / `-t tabby` / `-t iterm2` / `-t gnome-terminal` |
| List envs | `liantai envs` |
| List opencode sessions | `liantai sessions` |
| List agent CLIs | `liantai agents` |
| List sessions per agent | `liantai agent-sessions --agent opencode` |
| Show resolved paths | `liantai where` |
| List terminals | `liantai terminals` |

## Configuration (optional)

`~/.config/liantai/config.toml`:

```toml
terminal = "wt"
env = "dev"
shell = "powershell"
cwd = "C:\\Users\\frede"
hold = true

[geometry]
x = 100
y = 100
width = 1400
height = 900
```

## Supported AI agents

- **opencode** (sessions discovered from the SQLite DB at `~/.local/share/opencode/opencode.db`)
- **codex** (`codex --resume <id>`)
- **claude code** (`claude --resume <id>`)
- **cursor** (`cursor-agent --resume <id>`)
- **gemini** (`gemini --resume <id>`)

Use `liantai agents` to see which are installed on PATH.

## Supported terminals

- **Windows**: Windows Terminal (`wt`), Tabby, ConEmu, plain `cmd.exe`
- **macOS**: Terminal.app, iTerm2
- **Linux**: gnome-terminal, Konsole, Kitty, Alacritty, xterm

The first available launcher on the current OS is used unless `-t` is given.

## Window positioning

- Windows: `SetWindowPos` via `ctypes` (no extra deps)
- macOS: AppleScript `System Events`
- Linux: `wmctrl` or `xdotool` (auto-detected)

## License

MIT — © CodeOfMe
