aacode-rs 1.8.15

Rust port of the AACode ReAct coding agent, built on fastshell for mobile AI agents
Documentation
# Crates.io 发布指南

## 前置条件

1. 已注册 crates.io 账号并获取 API token
2. 已安装 cargo:`cargo install cargo-login`
3. 已登录:`cargo login <your-token>`

## 发布顺序

aacode-rs 依赖 fastshell,必须先发布 fastshell:

```bash
# 1. 先发布 fastshell
cd fastshell
cargo publish --registry crates-io

# 2. 再发布 aacode-rs
cd ../aacode-rs
cargo publish --registry crates-io
```

## 处理 malachite 冲突

### 问题原因

aacode-rs 依赖 fastshell 的 `python-rustpython` feature,会引入 `pymath` → `malachite-bigint 0.10.0`。

但 workspace 根目录的 `[patch.crates-io]` 会将 `malachite-bigint` 替换为本地 Apache-2.0 的 v0.9.2 shim。

**本地编译**:patch 生效,类型一致,编译通过

**发布到 crates.io**:patch 不会被打包,导致版本冲突,编译失败

### 解决方案:临时移除 features

发布时临时移除 `python-rustpython` 和 `js-oxc` features,发布后恢复:

```bash
# 1. 临时移除 features
sed -i '' 's/features = \["git", "python-rustpython", "js-oxc"\]/features = ["git"]/' Cargo.toml

# 2. 发布(需要 --allow-dirty,因为 Cargo.toml 有未提交的修改)
cargo publish --registry crates-io --allow-dirty

# 3. 恢复原来的 features
sed -i '' 's/features = \["git"\]/features = ["git", "python-rustpython", "js-oxc"]/' Cargo.toml
```

### 一行命令(推荐)

```bash
sed -i '' 's/features = \["git", "python-rustpython", "js-oxc"\]/features = ["git"]/' Cargo.toml && cargo publish --registry crates-io --allow-dirty && sed -i '' 's/features = \["git"\]/features = ["git", "python-rustpython", "js-oxc"]/' Cargo.toml
```

## 版本号更新

发布新版本前,更新 `Cargo.toml` 中的版本号:

```toml
version = "1.8.15"  # 改为新版本号
```

## 验证发布

发布后可在以下地址查看:

- **crates.io**: https://crates.io/crates/aacode-rs
- **docs.rs**: https://docs.rs/aacode-rs

## 注意事项

1. **不要提交临时修改**:sed 命令修改的 Cargo.toml 不要提交到 git
2. **检查 Cargo.lock**:如果 `spin v0.9.8` 有 yanked 警告,可忽略或更新依赖
3. **测试本地编译**:发布后执行 `cargo check` 确认本地编译正常

## 常见问题

### Q: 为什么不能直接发布?

A: workspace 的 `[patch.crates-io]` 在发布时不生效,导致 `malachite-bigint` 版本冲突。

### Q: 临时移除 features 会影响功能吗?

A: 不会影响。`python-rustpython` 和 `js-oxc` 是可选功能,核心功能不依赖它们。

### Q: 以后能修复这个问题吗?

A: 可以考虑:
1. 升级 malachite shim 到兼容 0.10.0 的版本
2. 或者将 `python-rustpython` 和 `js-oxc` 改为 aacode-rs 的可选 features