cli-anything-slay-the-spire-ii

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

cli-anything-slay-the-spire-ii

cli-anything-slay-the-spire-ii

A stateful command-line interface for controlling the real Slay the Spire 2 game through the local
STS2_Bridge
mod. The CLI reads normalized game state and sends action commands via a local HTTP API at
localhost:15526
.
一个有状态的命令行界面,通过本地
STS2_Bridge
mod控制真实的《杀戮尖塔2》游戏。该CLI通过本地HTTP API(地址为
localhost:15526
)读取标准化游戏状态并发送操作指令。

Installation

安装

This CLI requires a bridge mod that runs inside the game process. Both the CLI and the bridge are distributed from the same repository:
https://github.com/HKUDS/CLI-Anything
此CLI需要一个运行在游戏进程内的桥接mod。CLI和桥接mod均从同一仓库分发:
https://github.com/HKUDS/CLI-Anything

1. Install the CLI

1. 安装CLI

bash
git clone https://github.com/HKUDS/CLI-Anything.git
cd CLI-Anything/slay_the_spire_ii/agent-harness
pip install -e .
bash
git clone https://github.com/HKUDS/CLI-Anything.git
cd CLI-Anything/slay_the_spire_ii/agent-harness
pip install -e .

2. Build and install the bridge mod

2. 构建并安装桥接mod

The bridge mod is a
.NET 9
plugin that must be compiled and installed into the game directory. Full instructions are in the repository README, but the short version is:
bash
cd CLI-Anything/slay_the_spire_ii/agent-harness/bridge/plugin
./build.sh
cd ../install
./install_bridge.sh
If the build script cannot auto-detect the game data directory, set
STS2_GAME_DATA_DIR
explicitly:
bash
STS2_GAME_DATA_DIR="/path/to/data_sts2" ./build.sh
桥接mod是一个
.NET 9
插件,必须编译后安装到游戏目录中。完整说明见仓库README,以下是简化步骤:
bash
cd CLI-Anything/slay_the_spire_ii/agent-harness/bridge/plugin
./build.sh
cd ../install
./install_bridge.sh
如果构建脚本无法自动检测游戏数据目录,请显式设置
STS2_GAME_DATA_DIR
bash
STS2_GAME_DATA_DIR="/path/to/data_sts2" ./build.sh

3. Enable the mod and verify

3. 启用mod并验证

Launch Slay the Spire 2 via Steam, enable the
STS2_Bridge
mod in the mod manager, then verify the connection:
bash
cli-anything-sts2 state
If this returns JSON, the CLI and bridge are connected.
Prerequisites:
  • Python 3.10+
  • Slay the Spire 2 (Steam) with
    STS2_Bridge
    mod enabled
  • .NET 9 SDK
    (only needed to build the bridge mod)
通过Steam启动《杀戮尖塔2》,在mod管理器中启用
STS2_Bridge
mod,然后验证连接:
bash
cli-anything-sts2 state
如果返回JSON数据,则说明CLI与桥接mod已成功连接。
前置要求:
  • Python 3.10+
  • 已启用
    STS2_Bridge
    mod的Steam版《杀戮尖塔2》
  • .NET 9 SDK
    (仅构建桥接mod时需要)

Usage

使用方法

Basic Commands

基础命令

bash
undefined
bash
undefined

Read normalized game state (always start here)

读取标准化游戏状态(建议从该命令开始)

cli-anything-sts2 state
cli-anything-sts2 state

Start interactive REPL mode (default)

启动交互式REPL模式(默认模式)

cli-anything-sts2
cli-anything-sts2

Show all available commands

查看所有可用命令

cli-anything-sts2 --help
undefined
cli-anything-sts2 --help
undefined

Command Groups

命令分组

State Inspection

状态检查

CommandDescription
state
Normalized state with
decision
field
raw-state
Raw bridge JSON
命令描述
state
包含
decision
字段的标准化状态
raw-state
桥接mod返回的原始JSON数据

Main Menu

主菜单

CommandDescription
continue-game
Continue a saved run
start-game --character IRONCLAD --ascension 0
Start a new run
abandon-game
Abandon the current save
return-to-main-menu
Return to menu from any screen
Characters:
IRONCLAD
,
SILENT
,
DEFECT
,
NECROBINDER
,
REGENT
命令描述
continue-game
继续已保存的游戏进程
start-game --character IRONCLAD --ascension 0
开启新游戏进程
abandon-game
放弃当前存档
return-to-main-menu
从任意界面返回主菜单
可选角色:
IRONCLAD
,
SILENT
,
DEFECT
,
NECROBINDER
,
REGENT

Combat

战斗

CommandDescription
play-card <index> [--target <enemy_id>]
Play a card from hand
use-potion <slot> [--target <enemy_id>]
Use a potion
end-turn
End the current turn
命令描述
play-card <index> [--target <enemy_id>]
使用手牌中的指定卡牌
use-potion <slot> [--target <enemy_id>]
使用指定槽位的药水
end-turn
结束当前回合

Map & Room Flow

地图与房间流程

CommandDescription
choose-map <index>
Select a map node
proceed
Leave the current room
命令描述
choose-map <index>
选择地图节点
proceed
离开当前房间

Rewards

奖励

CommandDescription
claim-reward <index>
Claim a combat reward
pick-card-reward <index>
Pick a card reward
skip-card-reward
Skip the card reward
claim-treasure-relic <index>
Claim a treasure relic
select-relic <index>
Select a relic
skip-relic-selection
Skip relic selection
命令描述
claim-reward <index>
领取战斗奖励
pick-card-reward <index>
选择卡牌奖励
skip-card-reward
跳过卡牌奖励选择
claim-treasure-relic <index>
领取宝藏遗物
select-relic <index>
选择遗物
skip-relic-selection
跳过遗物选择

Events & Rest Sites

事件与休息站点

CommandDescription
event <index>
Choose an event option
advance-dialogue
Advance dialogue-only events
rest <index>
Choose a campfire action
命令描述
event <index>
选择事件选项
advance-dialogue
推进纯对话类事件
rest <index>
选择营火操作

Shop

商店

CommandDescription
shop-buy <index>
Buy from the shop
命令描述
shop-buy <index>
从商店购买物品

Card/Relic Selection Overlays

卡牌/遗物选择弹窗

CommandDescription
select-card <index>
Select a card in overlay
confirm-selection
Confirm the current selection
cancel-selection
Cancel the current selection
combat-select-card <index>
Select a card during combat overlay
combat-confirm-selection
Confirm combat card selection
命令描述
select-card <index>
在弹窗中选择卡牌
confirm-selection
确认当前选择
cancel-selection
取消当前选择
combat-select-card <index>
在战斗弹窗中选择卡牌
combat-confirm-selection
确认战斗卡牌选择

Raw Action

原始操作

CommandDescription
action <name> --kv key=value
Send a raw bridge action
命令描述
action <name> --kv key=value
发送原始桥接mod操作指令

Decision States

决策状态

The
state
command returns JSON with a
decision
field indicating the current game screen. Route your next command based on this value:
DecisionMeaningTypical Next Commands
menu
Main menu
continue-game
,
start-game
combat_play
In combat, your turn
play-card
,
use-potion
,
end-turn
hand_select
Card selection overlay
combat-select-card
,
combat-confirm-selection
map_select
Map node selection
choose-map
game_over
Run ended
return-to-main-menu
combat_rewards
Post-combat rewards
claim-reward
,
proceed
card_reward
Card reward pick
pick-card-reward
,
skip-card-reward
event_choice
Event screen
event
,
advance-dialogue
rest_site
Campfire
rest
shop
Shop screen
shop-buy
,
proceed
card_select
Card selection screen
select-card
,
confirm-selection
relic_select
Relic selection
select-relic
,
skip-relic-selection
treasure
Treasure room
claim-treasure-relic
,
proceed
state
命令返回的JSON数据中包含
decision
字段,用于标识当前游戏界面。可根据该值选择下一步命令:
决策值含义典型后续命令
menu
主菜单
continue-game
,
start-game
combat_play
战斗中,我方回合
play-card
,
use-potion
,
end-turn
hand_select
卡牌选择弹窗
combat-select-card
,
combat-confirm-selection
map_select
地图节点选择界面
choose-map
game_over
游戏进程结束
return-to-main-menu
combat_rewards
战后奖励界面
claim-reward
,
proceed
card_reward
卡牌奖励选择界面
pick-card-reward
,
skip-card-reward
event_choice
事件界面
event
,
advance-dialogue
rest_site
营火界面
rest
shop
商店界面
shop-buy
,
proceed
card_select
卡牌选择界面
select-card
,
confirm-selection
relic_select
遗物选择界面
select-relic
,
skip-relic-selection
treasure
宝藏房间
claim-treasure-relic
,
proceed

Configuration

配置

OptionDefaultDescription
--base-url
http://localhost:15526
Bridge API URL
--timeout
10.0
HTTP timeout in seconds
选项默认值描述
--base-url
http://localhost:15526
桥接mod API地址
--timeout
10.0
HTTP请求超时时间(秒)

For AI Agents

面向AI Agent的指南

  1. Always read
    state
    first
    to get the
    decision
    field
  2. Re-read state after each action - indices and energy change during combat
  3. Check return codes - 0 for success, non-zero for errors
  4. Parse stdout for JSON output
  1. **始终先读取
    state
    **以获取
    decision
    字段
  2. 每次操作后重新读取状态 - 战斗中卡牌索引和能量值会发生变化
  3. 检查返回码 - 0表示成功,非0表示出错
  4. 解析标准输出获取JSON格式的返回数据