Major refactoring: HTTP client unification and project restructuring
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 13m53s

## HTTP Client Refactoring
- Create unified HttpClient module (src/http_client.rs)
- Refactor 24 files to use shared HTTP client
- Replace .unwrap() with proper error handling
- Eliminate code duplication in HTTP requests

## Project Restructuring
- Rename package: ai → aibot
- Add dual binary support: aibot (main) + ai (compatibility alias)
- Migrate config directory: ~/.config/ai/ → ~/.config/syui/ai/bot/
- Implement backward compatibility with automatic migration

## Testing Infrastructure
- Add unit tests for HttpClient
- Create test infrastructure with cargo-make
- Add test commands: test, test-quick, test-verbose

## Documentation
- Complete migration guide with step-by-step instructions
- Updated development guide with new structure
- HTTP client API reference documentation
- Comprehensive refactoring summary

## Files Changed
- Modified: 24 source files (HTTP client integration)
- Added: src/http_client.rs, src/alias.rs, src/tests/
- Added: 5 documentation files in docs/
- Added: migration setup script

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-06-06 23:47:12 +09:00
parent 998777d46a
commit a17d2c9d66
45 changed files with 1871 additions and 593 deletions

117
docs/README.md Normal file
View File

@ -0,0 +1,117 @@
# ai.bot ドキュメント
ai.botプロジェクトの包括的なドキュメント集です。
## ドキュメント一覧
### 開発者向け
1. **[開発ガイド](./development-guide.md)**
- プロジェクト概要とアーキテクチャ
- 開発環境のセットアップ
- 開発ワークフローとベストプラクティス
- 新機能追加の手順
2. **[HTTPクライアントAPI](./http-client-api.md)**
- HttpClientモジュールの完全なAPIリファレンス
- 使用例とサンプルコード
- エラーハンドリングのベストプラクティス
### 保守・運用向け
3. **[移行ガイド](./migration-guide.md)**
- パッケージ名・CLI名の変更詳細
- 段階的移行手順
- 後方互換性の説明
- トラブルシューティング
4. **[リファクタリングサマリー](./refactoring-summary.md)**
- HTTPクライアント共通化の詳細
- エラーハンドリング改善の記録
- 対象ファイル一覧とBefore/After
## クイックスタート
### 1. 基本セットアップ
```bash
# 依存関係インストール
cargo install cargo-make
# プロジェクトビルド
cargo build
# テスト実行
cargo test
```
### 2. CLI使用方法
```bash
# 新しいコマンド(推奨)
./target/debug/aibot --help
# 旧コマンド(互換性)
./target/debug/ai --help
```
### 3. 設定ディレクトリ
- **新**: `~/.config/syui/ai/bot/`
- **旧**: `~/.config/ai/` (自動移行対応)
## 主要な変更履歴
### 2025年6月6日 - 大規模リファクタリング
#### HTTPクライアント共通化
- 24個のファイルをHttpClientモジュールで統合
- コード重複を大幅削減
- エラーハンドリングを改善(`.unwrap()``match`
#### 命名規則統一
- パッケージ名: `ai``aibot`
- CLI名: `ai``aibot``ai`は互換性維持)
- 設定ディレクトリ: `~/.config/ai/``~/.config/syui/ai/bot/`
#### テストインフラ構築
- ユニットテストの追加
- cargo-makeによるタスク管理
- CI/CD対応の準備
## アーキテクチャ概要
```
ai.bot/
├── src/
│ ├── main.rs # メインCLI (aibot)
│ ├── alias.rs # 互換性CLI (ai)
│ ├── http_client.rs # 統合HTTPクライアント
│ ├── data.rs # 設定・データ管理
│ ├── game/ # ゲーム機能
│ └── tests/ # テストスイート
├── docs/ # ドキュメント
├── scripts/ # セットアップスクリプト
└── ~/.config/syui/ai/bot/ # 設定ディレクトリ
├── scpt/ # コマンドスクリプト
└── txt/ # ログファイル
```
## サポート・問い合わせ
### 開発関連
- 新機能追加: [開発ガイド](./development-guide.md)を参照
- API使用方法: [HTTPクライアントAPI](./http-client-api.md)を参照
### 移行・運用関連
- 移行作業: [移行ガイド](./migration-guide.md)を参照
- トラブル: 各ドキュメントのトラブルシューティング章を参照
### 履歴・詳細
- 実装詳細: [リファクタリングサマリー](./refactoring-summary.md)を参照
## 貢献ガイドライン
1. **コードスタイル**: `cargo fmt`でフォーマット必須
2. **テスト**: 新機能には対応するテストを追加
3. **エラーハンドリング**: `.unwrap()`の使用禁止
4. **ドキュメント**: 重要な変更は対応ドキュメントも更新
詳細は[開発ガイド](./development-guide.md)の「コントリビューション」章を参照してください。