From 81ae0037d9d58669dc6bc202881fca5254ba5bf4 Mon Sep 17 00:00:00 2001 From: syui Date: Mon, 2 Jun 2025 00:32:00 +0900 Subject: [PATCH] fix config --- .claude/settings.local.json | 5 ++++- .gitignore | 2 +- Cargo.toml | 4 ++-- Makefile | 18 +++++++++--------- README.md | 12 ++++++------ config/default.toml | 4 ++-- docs/architecture.md | 2 +- docs/development-status.md | 16 ++++++++-------- scripts/setup.sh | 24 ++++++++++++------------ scripts/start.sh | 8 ++++---- src/config.rs | 8 +++++--- src/main.rs | 6 +++--- 12 files changed, 57 insertions(+), 52 deletions(-) diff --git a/.claude/settings.local.json b/.claude/settings.local.json index 24f34ab..dbe291f 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -2,7 +2,10 @@ "permissions": { "allow": [ "Bash(chmod:*)", - "Bash(cargo:*)" + "Bash(cargo:*)", + "Bash(grep:*)", + "Bash(find:*)", + "Bash(lsof:*)" ], "deny": [] } diff --git a/.gitignore b/.gitignore index 686d529..0fac2cc 100644 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,7 @@ venv/ .venv # ai.shell specific -~/.ai-shell/ +~/.config/syui/ai/shell/ *.log # IDE diff --git a/Cargo.toml b/Cargo.toml index fe61252..c038262 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "ai-shell" +name = "aishell" version = "0.1.0" edition = "2021" authors = ["syui"] @@ -30,5 +30,5 @@ default = [] # tui = ["ratatui", "crossterm"] [[bin]] -name = "ai-shell" +name = "aishell" path = "src/main.rs" \ No newline at end of file diff --git a/Makefile b/Makefile index ba0daa8..fd00eff 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ all: build -# Initial setup (creates venv in ~/.config/ai-shell) +# Initial setup (creates venv in ~/.config/syui/ai/shell) setup: @./scripts/setup.sh @@ -12,29 +12,29 @@ build: # Run MCP server (after setup) run-server: - @if [ ! -d "$$HOME/.config/ai-shell/venv" ]; then \ + @if [ ! -d "$$HOME/.config/syui/ai/shell/venv" ]; then \ echo "Please run 'make setup' first"; \ exit 1; \ fi - @$$HOME/.config/ai-shell/bin/mcp-server + @$$HOME/.config/syui/ai/shell/bin/mcp-server # Run CLI in development mode run-cli: cargo run -# Run ai-shell (after setup) +# Run aishell (after setup) run: - @if [ ! -d "$$HOME/.config/ai-shell/venv" ]; then \ + @if [ ! -d "$$HOME/.config/syui/ai/shell/venv" ]; then \ echo "Please run 'make setup' first"; \ exit 1; \ fi - @$$HOME/.config/ai-shell/bin/ai-shell + @$$HOME/.config/syui/ai/shell/bin/aishell # Run tests test: cargo test - @if [ -d "$$HOME/.config/ai-shell/venv" ]; then \ - source $$HOME/.config/ai-shell/venv/bin/activate && python -m pytest tests/; \ + @if [ -d "$$HOME/.config/syui/ai/shell/venv" ]; then \ + source $$HOME/.config/syui/ai/shell/venv/bin/activate && python -m pytest tests/; \ fi # Clean build artifacts @@ -45,5 +45,5 @@ clean: # Remove all installed files (complete uninstall) uninstall: - rm -rf $$HOME/.config/ai-shell + rm -rf $$HOME/.config/syui/ai/shell @echo "ai.shell has been uninstalled" \ No newline at end of file diff --git a/README.md b/README.md index f150b00..7db9434 100644 --- a/README.md +++ b/README.md @@ -20,11 +20,11 @@ ai.shellは、ローカルLLMを活用してコード生成、ファイル操作 git clone https://git.syui.ai/ai/shell.git cd shell -# 2. セットアップ(venv環境を~/.config/ai-shellに構築) +# 2. セットアップ(venv環境を~/.config/syui/ai/shellに構築) make setup # 3. PATHに追加(~/.zshrcまたは~/.bash_profileに追記) -export PATH="$HOME/.config/ai-shell/bin:$PATH" +export PATH="$HOME/.config/syui/ai/shell/bin:$PATH" ``` ## 使い方 @@ -33,7 +33,7 @@ export PATH="$HOME/.config/ai-shell/bin:$PATH" ```bash # ai.shellを起動 -ai-shell +aishell # または、プロジェクトディレクトリから make run @@ -49,8 +49,8 @@ ai> /analyze src/main.rs ai> /create rust my-project # ワンショット実行 -ai-shell exec "create a fibonacci function" -ai-shell analyze src/main.rs +aishell exec "create a fibonacci function" +aishell analyze src/main.rs ``` ## 機能 @@ -63,7 +63,7 @@ ai-shell analyze src/main.rs ## 設定 -設定ファイル: `~/.config/ai-shell/config.toml` +設定ファイル: `~/.config/syui/ai/shell/config.toml` ```toml [server] diff --git a/config/default.toml b/config/default.toml index 26683b6..0284947 100644 --- a/config/default.toml +++ b/config/default.toml @@ -15,13 +15,13 @@ timeout_seconds = 300 [logging] # Log configuration level = "info" # debug, info, warn, error -file = "~/.ai-shell/ai-shell.log" +file = "~/.config/syui/ai/shell/aishell.log" max_size_mb = 10 max_backups = 3 [cli] # CLI behavior -history_file = "~/.ai-shell/history" +history_file = "~/.config/syui/ai/shell/history" max_history = 1000 prompt = "ai> " color_output = true diff --git a/docs/architecture.md b/docs/architecture.md index 5b475c2..422072e 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -4,7 +4,7 @@ ``` ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ -│ User Input │ │ ai-shell CLI │ │ MCP Server │ +│ User Input │ │ aishell CLI │ │ MCP Server │ │ (Terminal) │────▶│ (Rust) │────▶│ (Python) │ └─────────────────┘ └─────────────────┘ └─────────────────┘ │ │ diff --git a/docs/development-status.md b/docs/development-status.md index f5e5fbb..2c31204 100644 --- a/docs/development-status.md +++ b/docs/development-status.md @@ -16,15 +16,15 @@ - HTTP REST API通信 2. **環境構築** - - `~/.config/ai-shell/` にPython venv環境 + - `~/.config/syui/ai/shell/` にPython venv環境 - セットアップスクリプト (`make setup`) - 起動スクリプト 3. **CLI機能** - インタラクティブモード - - ワンショット実行 (`ai-shell exec "prompt"`) - - ファイル分析 (`ai-shell analyze file`) - - ヘルスチェック (`ai-shell health`) + - ワンショット実行 (`aishell exec "prompt"`) + - ファイル分析 (`aishell analyze file`) + - ヘルスチェック (`aishell health`) 4. **コマンド** - `/help` - ヘルプ表示 @@ -96,12 +96,12 @@ ├── setup.sh # セットアップスクリプト └── start.sh # 起動スクリプト -~/.config/ai-shell/ # ユーザー設定ディレクトリ +~/.config/syui/ai/shell/ # ユーザー設定ディレクトリ ├── venv/ # Python仮想環境 ├── config.toml # ユーザー設定 ├── mcp_server.py # MCPサーバーコピー └── bin/ - ├── ai-shell # CLIラッパー + ├── aishell # CLIラッパー └── mcp-server # サーバーラッパー ``` @@ -123,10 +123,10 @@ git status make run-server # CLIを起動(Terminal 2) -./target/debug/ai-shell +./target/debug/aishell # または、セットアップ済みなら -ai-shell +aishell ``` ## 重要な設計思想 diff --git a/scripts/setup.sh b/scripts/setup.sh index dd629e4..ccfbae3 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -1,6 +1,6 @@ #!/bin/bash # ai.shell setup script for macOS -# Sets up Python venv environment in ~/.config/ai-shell +# Sets up Python venv environment in ~/.config/syui/ai/shell set -e @@ -12,7 +12,7 @@ YELLOW='\033[1;33m' NC='\033[0m' # No Color # Directories -CONFIG_DIR="$HOME/.config/ai-shell" +CONFIG_DIR="$HOME/.config/syui/ai/shell" VENV_DIR="$CONFIG_DIR/venv" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_DIR="$(dirname "$SCRIPT_DIR")" @@ -72,7 +72,7 @@ cat > "$CONFIG_DIR/bin/mcp-server" << 'EOF' #!/bin/bash # MCP Server startup script -CONFIG_DIR="$HOME/.config/ai-shell" +CONFIG_DIR="$HOME/.config/syui/ai/shell" VENV_DIR="$CONFIG_DIR/venv" # Activate virtual environment @@ -85,12 +85,12 @@ EOF chmod +x "$CONFIG_DIR/bin/mcp-server" -# Create ai-shell wrapper script -cat > "$CONFIG_DIR/bin/ai-shell" << EOF +# Create aishell wrapper script +cat > "$CONFIG_DIR/bin/aishell" << EOF #!/bin/bash -# ai-shell wrapper script +# aishell wrapper script -CONFIG_DIR="\$HOME/.config/ai-shell" +CONFIG_DIR="\$HOME/.config/syui/ai/shell" PROJECT_DIR="$PROJECT_DIR" # Check if MCP server is running @@ -107,12 +107,12 @@ if ! curl -s http://localhost:8765/health > /dev/null 2>&1; then done fi -# Run ai-shell CLI +# Run aishell CLI cd "\$PROJECT_DIR" cargo run --release -- "\$@" EOF -chmod +x "$CONFIG_DIR/bin/ai-shell" +chmod +x "$CONFIG_DIR/bin/aishell" # Check if Ollama is installed echo -e "${YELLOW}🦙 Checking Ollama...${NC}" @@ -140,9 +140,9 @@ cargo build --release echo -e "\n${GREEN}✨ Setup complete!${NC}" echo -e "\n${BLUE}To use ai.shell:${NC}" -echo -e "1. Add to your PATH: ${YELLOW}export PATH=\"\$HOME/.config/ai-shell/bin:\$PATH\"${NC}" -echo -e "2. Run: ${YELLOW}ai-shell${NC}" -echo -e "\nOr use the full path: ${YELLOW}~/.config/ai-shell/bin/ai-shell${NC}" +echo -e "1. Add to your PATH: ${YELLOW}export PATH=\"\$HOME/.config/syui/ai/shell/bin:\$PATH\"${NC}" +echo -e "2. Run: ${YELLOW}aishell${NC}" +echo -e "\nOr use the full path: ${YELLOW}~/.config/syui/ai/shell/bin/aishell${NC}" # Deactivate virtual environment deactivate \ No newline at end of file diff --git a/scripts/start.sh b/scripts/start.sh index b9a9aee..d2f918f 100755 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -1,9 +1,9 @@ #!/bin/bash -# ai.shell startup script (uses ~/.config/ai-shell setup) +# ai.shell startup script (uses ~/.config/syui/ai/shell setup) set -e -CONFIG_DIR="$HOME/.config/ai-shell" +CONFIG_DIR="$HOME/.config/syui/ai/shell" # Check if setup has been run if [ ! -d "$CONFIG_DIR/venv" ]; then @@ -12,5 +12,5 @@ if [ ! -d "$CONFIG_DIR/venv" ]; then exit 1 fi -# Run ai-shell -exec "$CONFIG_DIR/bin/ai-shell" "$@" \ No newline at end of file +# Run aishell +exec "$CONFIG_DIR/bin/aishell" "$@" \ No newline at end of file diff --git a/src/config.rs b/src/config.rs index 805abd2..2c360f7 100644 --- a/src/config.rs +++ b/src/config.rs @@ -65,7 +65,9 @@ impl Config { home_dir() .unwrap_or_else(|| PathBuf::from(".")) .join(".config") - .join("ai-shell") + .join("syui") + .join("ai") + .join("shell") .join("config.toml") } @@ -99,12 +101,12 @@ impl Default for Config { }, logging: LoggingConfig { level: "info".to_string(), - file: "~/.config/ai-shell/ai-shell.log".to_string(), + file: "~/.config/syui/ai/shell/aishell.log".to_string(), max_size_mb: 10, max_backups: 3, }, cli: CLIConfig { - history_file: "~/.config/ai-shell/history".to_string(), + history_file: "~/.config/syui/ai/shell/history".to_string(), max_history: 1000, prompt: "ai> ".to_string(), color_output: true, diff --git a/src/main.rs b/src/main.rs index 566a030..b94d522 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,11 +2,11 @@ use clap::{Parser, Subcommand}; use colored::*; use tokio; -use ai_shell::{Config, MCPClient, Prompt}; -use ai_shell::commands::CommandHandler; +use aishell::{Config, MCPClient, Prompt}; +use aishell::commands::CommandHandler; #[derive(Parser)] -#[command(name = "ai-shell")] +#[command(name = "aishell")] #[command(about = "AI-powered shell for code generation and automation")] #[command(version = "0.1.0")] struct Cli {