About this project
`encx-cli` is a Go client and CLI for the API of the Encounter urban quest engine (`en.cx`). The project includes a library for embedding into your own code (`encx`), a console utility `encli`, a mock server for local development, an LLM agent based on PicoClaw, a Web UI, as well as builds for iOS (gomobile) and PHP (FFI).
## Key Features
- **`encx` library**: login, game list, game state, code submission, statistics, profile, hints, joining a game. Supports both the old (ASP.NET) and new (REST) Encounter engines with automatic detection.
- **`encli` CLI**: commands for authorization, viewing games, levels, bonuses, sectors, hints, check log, messages, code submission, as well as a full set of admin commands (creating/deleting levels, bonuses, sectors, hints, tasks, managing games, teams, time adjustments).
- **`encx-mock` mock server**: emulates the Encounter domain locally, supports loading a scenario from HTML, network loss emulation (PZDC code), Docker image.
- **LLM agent**: built-in PicoClaw with tool-calling — reads game state, invokes admin commands, searches Wikipedia, reads local files. Works via OpenRouter or a local llama.cpp model (via yzma, without cgo).
- **Web UI**: local interface with an agent chat, dark theme, LLM configuration.
- **iOS**: gomobile wrapper `mobile/encxmobile`, `Encx.xcframework` build for Xcode.
- **PHP**: shared library via FFI, the client lives on the Go side.
## Installation
Ready-made binaries for macOS, Linux, Windows are available on the Releases page. You can also install via `go install`:
```sh
go install github.com/skrashevich/encx-cli/cmd/encli@latest
go install github.com/skrashevich/encx-cli/cmd/encx-mock@latest
```
Or via Docker:
```sh
docker run --rm ghcr.io/skrashevich/encx-cli -v
docker run --rm ghcr.io/skrashevich/encx-cli games -domain tech.en.cx
```
## Library Usage Example
```go
client := encx.New("tech.en.cx", encx.WithInsecureTLS())
resp, err := client.Login(ctx, "user", "password")
list, _ := client.GetGameList(ctx)
model, _ := client.GetGameModel(ctx, 12345)
result, _ := client.SendCode(ctx, 12345, model.Level.LevelId, model.Level.Number, "CODE123")
```
## CLI: Typical Flow
```sh
encli login -domain tech.en.cx -insecure
encli games
encli status -game-id 12345
encli level -game-id 12345
encli send-code -game-id 12345 "CODE123"
```
## LLM Agent
```sh
export LLM_API_KEY=sk-or-v1-...
export LLM_MODEL=anthropic/claude-sonnet-4
encli -game-id 12345 --llm "create 3 levels with bonuses and hints"
encli -readonly -game-id 12345 --llm "show the contents of all levels"
```
If no cloud provider is configured, the agent runs locally via llama.cpp (Qwen3-VL-2B-Instruct model, ~1 GB).
## MCP
The `agentmcp` package exposes the engine's tool catalog externally via MCP:
```sh
encli mcp -domain tech.en.cx # read-only
encli mcp -domain tech.en.cx -security approve # mutations are confirmed by the client
```
## iOS and PHP
For iOS, there is a gomobile wrapper and an `Encx.xcframework` build (script `./mobile/bind-ios.sh`). For PHP, there is a shared library with FFI wrappers generated from the Go source.
## Additional Information
- Client options: TLS, HTTP, timeout, User-Agent, language, engine, API base URL.
- Automatic engine detection (legacy/new) via an API request.
- Engine settings saved to `~/.config/encli/engine/settings.json`.
- The mock server supports a public demo at `encounter.exe.xyz`.
Comments
0 Rating appears after 10 ratings
Sign in to join the discussion.