Files
ai-shell/使用示例.md
zackeryyy wang 644071850a Initial commit: AI Shell v0.1.0
- AI-powered shell command generator using DeepSeek V3
- Support for natural language to shell command conversion
- Secure configuration management with .env files
- Package structure with uv tool installation support
- Chinese and English language support
- Configuration validation and error handling
2025-07-12 22:06:15 +08:00

3.4 KiB
Raw Blame History

AI Shell 使用示例

🚀 基本使用流程

示例 1查看当前日期按 Enter 执行)

$ uv run python ai.py "show current date"

(AI Thinking): To display the current date, the `date` command is the most straightforward and commonly used tool in Unix-like systems.

(AI Answer): date
Execute? [Y/n]: ⏎  # 直接按 Enter 键
2025年 7月12日 星期六 16时08分00秒 CST

示例 2危险命令输入 n 取消)

$ uv run python ai.py "remove all files"

(AI Thinking): To remove all files in the current directory, we can use the `rm` command. However, we need to be cautious because this action is irreversible.

(AI Answer): rm -rf *
Execute? [Y/n]: n  # 输入 n 取消执行

示例 3中文命令按 Enter 执行)

$ uv run python ai.py "显示当前目录下的文件"

(AI Thinking): 用户想要显示当前目录下的文件。最常用和直接的命令是 `ls`,它会列出当前目录中的所有文件和文件夹。

(AI Answer): ls
Execute? [Y/n]: ⏎  # 直接按 Enter 键
README.md    ai.py    pyproject.toml    uv.lock    uv.toml

📋 交互选项说明

执行命令的方式:

  • 直接按 Enter: 执行命令(默认选择)
  • 输入 y 或 yes: 执行命令
  • 输入 n 或 no: 取消执行

提示符说明:

  • Execute? [Y/n]:
    • [Y/n] 表示默认选择是 Y执行
    • 大写的 Y 表示这是默认选项
    • 直接按 Enter 等同于选择 Y

🎯 使用技巧

1. 快速执行常用命令

对于安全的查看类命令,可以直接按 Enter 快速执行:

uv run python ai.py "list files"          # Enter 执行
uv run python ai.py "show disk usage"     # Enter 执行
uv run python ai.py "current directory"   # Enter 执行

2. 谨慎处理危险命令

对于可能造成数据丢失的命令,建议仔细检查后再决定:

uv run python ai.py "delete old logs"     # 检查命令后再决定
uv run python ai.py "format disk"         # 输入 n 取消
uv run python ai.py "remove directory"    # 仔细确认

3. 中英文混合使用

# 英文命令
uv run python ai.py "find Python files"

# 中文命令  
uv run python ai.py "查找Python文件"

# 混合使用
uv run python ai.py "find all .py files in current directory"

🔧 常用命令示例

文件操作

uv run python ai.py "create a backup directory"
uv run python ai.py "copy all text files to backup"
uv run python ai.py "find files larger than 100MB"

系统信息

uv run python ai.py "show system information"
uv run python ai.py "check memory usage"
uv run python ai.py "list running processes"

网络相关

uv run python ai.py "check network connectivity"
uv run python ai.py "show network interfaces"
uv run python ai.py "test connection to google.com"

开发相关

uv run python ai.py "find all Python files"
uv run python ai.py "count lines of code"
uv run python ai.py "start a simple HTTP server"

⚠️ 安全提醒

  1. 仔细阅读 AI 生成的命令:在执行前确保理解命令的作用
  2. 危险命令要谨慎:涉及删除、格式化等操作时要特别小心
  3. 测试环境优先:在重要系统上使用前,建议先在测试环境验证
  4. 备份重要数据:执行可能影响数据的命令前,确保有备份

💡 提示:现在直接按 Enter 键就能执行命令,让您的工作流程更加流畅!