Metadata-Version: 2.4
Name: jarvis-c2rust
Version: 0.1.0
Summary: Jarvis C2Rust: C/C++ to Rust migration pipeline with progressive migration and checkpoint resume
Author-email: skyfire <skyfireitdiy@hotmail.com>
License: MIT License
        
        Copyright (c) 2025 skyfire
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
Keywords: jarvis,c2rust,rust,migration,transpiler
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: jarvis-ai-assistant>=7.0.1
Requires-Dist: typer
Requires-Dist: tree-sitter==0.25.2; platform_machine != "armv6l" and platform_machine != "armv7l" and platform_machine != "armv8l" and platform_machine != "armhf"
Requires-Dist: tree-sitter-c==0.24.1; platform_machine != "armv6l" and platform_machine != "armv7l" and platform_machine != "armv8l" and platform_machine != "armhf"
Requires-Dist: tree-sitter-cpp==0.23.4; platform_machine != "armv6l" and platform_machine != "armv7l" and platform_machine != "armv8l" and platform_machine != "armhf"
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"
Provides-Extra: clang16
Requires-Dist: clang==16.*; extra == "clang16"
Provides-Extra: clang17
Requires-Dist: clang==17.*; extra == "clang17"
Provides-Extra: clang18
Requires-Dist: clang==18.*; extra == "clang18"
Provides-Extra: clang19
Requires-Dist: clang==19.*; extra == "clang19"
Provides-Extra: clang20
Requires-Dist: clang==20.*; extra == "clang20"
Provides-Extra: clang21
Requires-Dist: clang==21.*; extra == "clang21"
Dynamic: license-file

# Jarvis C2Rust

Jarvis C2Rust（`jarvis-c2rust` / `jc2r`）是 Jarvis 的 C/C++ → Rust 迁移套件，提供完整的自动化迁移流水线：扫描（scan）→ 库替代（lib-replace）→ 模块规划（prepare）→ 转译（transpile）→ 优化（optimize），支持渐进式迁移与断点续跑。

> **注意**：本工具是 Jarvis 的独立组件，以 `jarvis-ai-assistant` 为运行时依赖。安装后即可独立使用，无需安装完整 Jarvis 主包。

## 安装

```bash
pip install jarvis-c2rust
```

依赖要求：Python 3.12，运行时依赖 `jarvis-ai-assistant>=7.0.1`（提供 Agent、CodeAgent、配置与输出等基础能力）。

C/C++ 扫描依赖 libclang（Python 绑定 `clang` 16-22）。按需安装对应版本：

```bash
# 例如 clang 18
pip install "jarvis-c2rust[clang18]"
# 或直接
pip install "clang>=16,<23"
```

同时需确保系统已安装 libclang（如 `apt install llvm-18 clang-18 libclang-18-dev`），或设置 `LIBCLANG_PATH` / `LLVM_HOME` 指向 libclang 所在目录。

## 使用

```bash
# 查看帮助
jc2r --help
jarvis-c2rust --help

# 配置管理（根符号列表、禁用库列表、附加说明等）
jc2r config

# 执行完整转译流水线（scan -> lib-replace -> prepare -> transpile -> optimize），支持断点续跑
jc2r run

# 验证功能对齐
jc2r verify
```

或模块方式：

```bash
python -m jarvis.jarvis_c2rust.cli <subcommand>
```

## 核心数据

所有路径均推荐使用 `<project_root>/.jarvis/c2rust` 下的标准文件名，便于断点续跑与复用：

- 统一符号表（JSONL）：`<project_root>/.jarvis/c2rust/symbols.jsonl`（后续流程的主输入）
- 原始符号表（JSONL）：`<project_root>/.jarvis/c2rust/symbols_raw.jsonl`
- 其他产物：`translation_order.jsonl`、`library_replacements.jsonl`、`progress.json`、`config.json`、`symbol_map.jsonl` 等

## 开发

```bash
pip install -e ".[dev]"
pytest
```

## 许可证

MIT
