oxidizer-workflow について
oxidizer-workflowは、Pythonのモジュール、パッケージ、コマンドラインツールをRustへ移行するスキルです。テストを先行させる反復型の手順で、カバレッジのゲートと機能互換性・品質の検証を行います。
主な機能
- 01Python ASTとAPIの分析
- 02移植前のテストカバレッジゲート
- 03モジュール単位の反復移行
- 04機能互換性と劣化の検査
- 05Rustのビルド、テスト、Lint、整形チェック
活用シーン
- 01PythonパッケージのRustクレート化
- 02Python CLIをRustバイナリに置換
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ rysweet/ amplihack --skill oxidizer-workflowインストール後、Claude Code で/oxidizer-workflowを入力して読み込まれたか確認します。
詳細
Oxidizer ワークフロースキル
目的
oxidizer-workflow レシピを実行して、Python コードベースを Rust に移行します。
このワークフローは再帰的に目標を追求し、品質監査とサイレントな機能低下のチェックを毎回行いながら、機能の完全な同等性が達成されるまで繰り返します。
使用する場面
- Python のモジュール、パッケージ、または CLI を Rust に移行する場合
- Python ライブラリを単独の Rust クレートに移植する場合
- Python ツールに代わる Rust バイナリを作成する場合
基本原則
- テストを先に実施 — 移植を始める前に、Python のテストカバレッジを完全な状態にする必要があります
- 妥協しない — 100%の同等性が必要です。部分的な結果は受け入れられません
- 品質ゲート — 各反復で clippy、fmt、およびテストスイート全体を実行します
- サイレントな機能低下を防止 — すべての機能、エッジケース、エラーパスを維持する必要があります
- 反復による収束 — モジュール単位で進め、収束するまで繰り返します
必須の入力
| 入力 | 例 | 説明 |
|---|---|---|
python_package_path | src/amplihack/recipes | 移行する Python パッケージへのパス |
rust_target_path | rust/recipe-runner | Rust プロジェクトを作成する場所 |
rust_repo_name | amplihack-recipe-runner | Rust プロジェクトの GitHub リポジトリ名 |
rust_repo_org | rysweet | リポジトリの GitHub 組織またはユーザー |
実行方法
Recipe Runner 経由
recipe-runner-rs amplifier-bundle/recipes/oxidizer-workflow.yaml \
--set python_package_path=src/mypackage \
--set rust_target_path=rust/mypackage \
--set rust_repo_name=my-rust-package \
--set rust_repo_org=myorg
Python API 経由
from amplihack.recipes import run_recipe_by_name
result = run_recipe_by_name(
"oxidizer-workflow",
user_context={
"python_package_path": "src/mypackage",
"rust_target_path": "rust/mypackage",
"rust_repo_name": "my-rust-package",
"rust_repo_org": "myorg",
},
)
ワークフローのフェーズ
Phase 1: Analysis
└─ AST analysis, dependency mapping, type inference, public API extraction
Phase 1B: Test Completeness Gate
└─ Measure coverage → write missing tests → re-verify → BLOCK if < 100%
Phase 2: Scaffolding
└─ cargo init, add dependencies, create module structure
Phase 3: Test Extraction
└─ Port Python tests to Rust test modules → quality audit tests
Phase 4-6: Iterative Convergence Loop (× N until 100% parity)
├─ Select next module (priority order from Phase 1)
├─ Implement module in Rust
├─ Compare: feature matrix diff against Python
├─ Quality gate: cargo clippy + fmt + test
├─ Silent degradation audit: check for lossy conversions
├─ Fix any degradation found
└─ Convergence check: if < 100% parity → loop again
Final: Summary report with parity matrix
収束ルール
- 各反復では、一度に 1 つのモジュールを処理します(コアから外側へ進む戦略)
- レシピ内で最大 5 回のアンロールされたループを実行し、サブレシピには
max_depth: 8を適用します - レシピは、
convergence_status == "CONVERGED"またはiteration_number > max_iterations(デフォルトは 30)になると終了します - 最大反復回数に達しても収束しない場合、最終サマリーに未完了のモジュールが示されます
成功の条件
- Rust プロジェクトがエラーなくビルドできる(
cargo build) - すべてのテストが成功する(
cargo test) - clippy の警告がゼロである(
cargo clippy -- -D warnings) - フォーマットが適用されている(
cargo fmt --check) - 機能同等性マトリックスでカバレッジが 100%と示されている
- サイレントな機能低下が検出されない
コメント
Markdown 対応