Skip to main content
Glama
README.md
# HOI4 AI Studio

《钢铁雄心4》(Hearts of Iron IV) 全自动化 Mod 开发工具集

## 功能特性

- 🎯 **自然语言驱动**: 通过自然语言描述自动生成完整的 Mod 内容
- 🔄 **全流程自动化**: 从国策树到事件链、决议、民族精神等全自动生成
- ✅ **智能校验**: 集成 hoi4lint 实时校验并自愈语法错误
- 🎨 **美术提示词**: 自动生成 Midjourney/Flux 美术提示词
- 🌐 **MCP 协议支持**: 可与 Claude Desktop、Cursor、Windsurf 等 AI 工具无缝集成

## 安装

```bash
pip install -r requirements.txt
```

## 使用方式

### 1. MCP 协议集成

在你的 MCP 配置中添加:

```json
{
  "mcpServers": {
    "hoi4-studio": {
      "command": "python",
      "args": ["-m", "ai_studio.mcp_server"],
      "env": {
        "PYTHONPATH": "/path/to/HOI4_mod_builder/src"
      }
    }
  }
}
```

### 2. 命令行使用

```bash
# JSON 输出模式(适合 Agent 管道)
python -m ai_studio.cli --mod-dir "C:/path/to/mod" --intent "设计联共抗日路线" --tag "GXC" --name "桂系" --json

# 交互模式
python -m ai_studio.cli -d "C:/path/to/mod" -i "设计联共抗日路线" -t "GXC" -n "桂系"
```

## 生成物规范

- 国策树: `common/national_focus/{tag}_focus.txt`
- 联动事件: `events/{tag}_events.txt`
- 政治平衡: `common/bop/{tag}_bop.txt`
- 决策卡片: `common/decisions/`
- 民族精神: `common/ideas/{tag}_ideas.txt`
- 武器变体: `history/units/{tag}_variants.txt`
- 材质定义: `interface/{tag}_studio_generated.gfx`
- 本地化: `localisation/simp_chinese/{tag}_studio_l_simp_chinese.yml`
- 美术提示词: `docs/ART_PROMPTS_{TAG}.md`

## 架构

```
ai_studio/
├── core/           # 核心模型与 AI 客户端
├── generators/     # 各类内容生成器
├── pipeline/       # 流程编排与打包
├── art/            # 美术提示词引擎
├── ui/             # GUI 向导
├── cli.py          # 命令行入口
└── mcp_server.py   # MCP 服务器
```

## 依赖

- Python 3.8+
- OpenAI API 兼容接口
- hoi4lint (用于代码校验)

## 许可证

MIT License

## 贡献

欢迎提交 Issue 和 Pull Request!