fix config
This commit is contained in:
parent
0f3776e75e
commit
81ae0037d9
@ -2,7 +2,10 @@
|
||||
"permissions": {
|
||||
"allow": [
|
||||
"Bash(chmod:*)",
|
||||
"Bash(cargo:*)"
|
||||
"Bash(cargo:*)",
|
||||
"Bash(grep:*)",
|
||||
"Bash(find:*)",
|
||||
"Bash(lsof:*)"
|
||||
],
|
||||
"deny": []
|
||||
}
|
||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -14,7 +14,7 @@ venv/
|
||||
.venv
|
||||
|
||||
# ai.shell specific
|
||||
~/.ai-shell/
|
||||
~/.config/syui/ai/shell/
|
||||
*.log
|
||||
|
||||
# IDE
|
||||
|
@ -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"
|
18
Makefile
18
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"
|
12
README.md
12
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]
|
||||
|
@ -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
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
```
|
||||
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
|
||||
│ User Input │ │ ai-shell CLI │ │ MCP Server │
|
||||
│ User Input │ │ aishell CLI │ │ MCP Server │
|
||||
│ (Terminal) │────▶│ (Rust) │────▶│ (Python) │
|
||||
└─────────────────┘ └─────────────────┘ └─────────────────┘
|
||||
│ │
|
||||
|
@ -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
|
||||
```
|
||||
|
||||
## 重要な設計思想
|
||||
|
@ -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
|
@ -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" "$@"
|
||||
# Run aishell
|
||||
exec "$CONFIG_DIR/bin/aishell" "$@"
|
@ -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,
|
||||
|
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user