{"id":43991901,"url":"https://github.com/fifsky/aishell","last_synced_at":"2026-02-07T11:04:02.569Z","repository":{"id":335267004,"uuid":"1144987893","full_name":"fifsky/aishell","owner":"fifsky","description":"A command-line AI assistant script that supports context, simple and lightweight","archived":false,"fork":false,"pushed_at":"2026-01-29T10:00:36.000Z","size":12,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-30T00:47:44.760Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fifsky.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-29T09:32:25.000Z","updated_at":"2026-01-29T10:02:53.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/fifsky/aishell","commit_stats":null,"previous_names":["fifsky/aishell"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/fifsky/aishell","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fifsky%2Faishell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fifsky%2Faishell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fifsky%2Faishell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fifsky%2Faishell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fifsky","download_url":"https://codeload.github.com/fifsky/aishell/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fifsky%2Faishell/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29193089,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T07:37:03.739Z","status":"ssl_error","status_checked_at":"2026-02-07T07:37:03.029Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-02-07T11:03:47.733Z","updated_at":"2026-02-07T11:04:02.563Z","avatar_url":"https://github.com/fifsky.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AI Shell 助手 (aishell)\n\n一个基于 AI 的智能终端命令生成工具，能够将自然语言转换为 Shell 命令并辅助执行。\n\n## 功能特性\n\n- 🗣️ **自然语言交互**：直接描述你的需求，自动生成对应的 Shell 命令。\n- 🧠 **智能上下文**：自动记录对话历史，支持多轮对话，能够理解之前的操作结果。\n- 🔄 **执行反馈**：命令执行的输出（标准输出和错误）会自动反馈给 AI，以便进行后续的错误修正或进一步操作。\n- 🛡️ **安全执行**：生成的命令在执行前需要用户确认，防止误操作。\n- 📁 **Session 管理**：支持多会话管理，可在不同项目/任务间切换上下文。\n- 🧹 **一键重置**：支持 `clear` 命令快速清理对话上下文。\n- ⚙️ **可配置**：支持开启/关闭 AI 思考模式 (Thinking Mode)。\n\n## 依赖要求\n\n- `bash`\n- `curl`\n- `jq` (用于处理 JSON 数据)\n- `fzf` (可选，用于 Session 列表选择和删除功能)\n\nmacOS 安装依赖:\n\n```bash\nbrew install jq fzf\n```\n\n## 安装与配置\n\n### 1. 下载与授权\n\n使用 wget 下载脚本到本地（例如 `~/aishell.sh`）：\n\n```bash\nwget -O ~/aishell.sh https://raw.githubusercontent.com/fifsky/aishell/refs/heads/main/aishell.sh\n```\n\n赋予执行权限：\n\n```bash\nchmod +x ~/aishell.sh\n```\n\n### 2. 配置环境变量\n\n在使用之前，你需要配置 API 密钥和接口地址（可选）。\n\n**以 zsh 为例 (macOS/Linux 默认 Shell):**\n\n编辑你的 `~/.zshrc` 文件，添加以下内容：\n\n```bash\n# 必填：配置 API 密钥\nexport AISHELL_API_KEY=\"sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"\n\n# 选填：配置 API 接口地址 (默认为 Moonshot AI 地址)\n# export AISHELL_BASE_URL=\"https://api.moonshot.cn/v1/chat/completions\"\n\n# 选填：配置模型 (默认为 kimi-k2.5)\n# export AISHELL_MODEL=\"kimi-k2.5\"\n\n# 选填：配置上下文保留条数 (默认为 100)\n# export AISHELL_MAX_CONTEXT=100\n\n# 选填：配置别名\nalias ai=\"${HOME}/aishell.sh\"\n```\n\n保存后，重载配置文件使生效：\n\n```bash\nsource ~/.zshrc\n```\n\n### 3. 开始使用\n\n配置完成后，你就可以直接使用 `ai` 命令了。\n\n## 使用指南\n\n### 基础用法\n\n```bash\nai \"查看当前目录下的所有 PDF 文件\"\n```\n\n### 多轮对话示例\n\n```bash\n# 第一步\nai 查找最近修改的日志文件\n\n# 第二步 (AI 会记得上一步的文件)\nai 把它们打包成 tar.gz\n\n# 第三步 (执行出错时 AI 会尝试修复)\nai 解压刚才的包\n```\n\n\u003e 输入的内容包含特殊字符（如空格），请用引号括起来。或者放入文本文件中使用`cat 文件名 | ai`\n\n### Session 管理\n\naishell 支持多会话管理，让你可以在不同的项目或任务之间保持独立的对话上下文。\n\n#### 切换/创建 Session\n\n切换到指定名称的 session（如果不存在会自动创建）：\n\n```bash\nai session myproject\n```\n\n#### 列出所有 Session\n\n查看所有可用的 session 并快速切换（需要安装 fzf）：\n\n```bash\nai list\n```\n\n这将打开一个交互式列表，当前 session 会标有 `*` 号，选择后即可快速切换。\n\n#### 删除 Session\n\n删除不需要的 session（支持多选，需要安装 fzf）：\n\n```bash\nai delete\n```\n\n\u003e **注意**：删除当前正在使用的 session 后，会自动切换到 `default` session。\n\n#### 不同 Session 的使用示例\n\n```bash\n# 在项目 A 的 session 中工作\nai session project-a\nai 查找所有的JavaScript文件\n\n# 切换到项目 B 的 session，完全独立的上下文\nai session project-b\nai 查看当前的Git状态\n\n# 列出所有 session\nai list\n\n# 清理不再需要的 session\nai delete\n```\n\n### 清理上下文\n\n当你想开始一个新的话题时，可以使用 `clear` 命令：\n\n```bash\nai clear\n```\n\n## 高级配置\n\n你可以直接编辑 `aishell.sh` 文件头部变量进行配置：\n\n- **ENABLE_THINKING**: 设置为 `\"true\"` 可开启 AI 的思考过程展示（取决于模型支持）。\n- **MODEL**: 切换使用的模型版本（默认 `kimi-k2.5`）。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffifsky%2Faishell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffifsky%2Faishell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffifsky%2Faishell/lists"}