# LingFrame-AI-CLI **Repository Path**: LingFrame/ling-frame-ai-cli ## Basic Information - **Project Name**: LingFrame-AI-CLI - **Description**: No description available - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 3 - **Forks**: 0 - **Created**: 2026-06-03 - **Last Updated**: 2026-06-04 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # LingFrame AI CLI 基于灵珑框架实现的 AI coding agent,目前支持 DeepSeek、Gemini 配置。 ## 快速开始 ```bash bun install # 绑定数据库,参考下文「数据库配置」 bun run dev:cli bun run dev:server # 如果有 VPN,建议使用如下方式启动 server NO_PROXY=localhost,127.0.0.1,::1 bun run dev:server ``` ## 在任意目录运行 CLI > 下面两种方式都支持 `-C/--cwd` 指定目标项目目录;不传时默认使用当前目录。 ### 方式 A:打包成可执行文件 可执行文件不会自动读取仓库里的 `.env`,需要先配置全局环境(否则会连错地址或在 VPN 下出现 Bad Gateway): ```bash mkdir -p ~/.linglong cp .env ~/.linglong/.env # 至少保留 API_URL=http://127.0.0.1:3000 ``` 构建并安装: ```bash bun run --cwd packages/cli build:exe sudo cp packages/cli/dist/linglong /usr/local/bin/linglong sudo chmod +x /usr/local/bin/linglong hash -r ``` 使用前请在仓库目录启动 API 服务(另开终端): ```bash bun run dev:server ``` 使用 CLI: ```bash # 在目标项目目录直接运行 cd /path/to/other-project && linglong # 或者从任意目录指定目标项目 linglong -C /path/to/other-project ``` `linglong` 会按顺序查找环境文件:`$LINGLONG_ENV_FILE` → `~/.linglong/.env` → 当前目录向上查找 `.env`。并自动为 `localhost` / `127.0.0.1` 设置 `NO_PROXY`,避免 VPN 代理本地请求。 调试加载路径:`LINGLONG_DEBUG=1 linglong` ### 方式 B:开发期 link(全局命令) ```bash # 在本仓库 cd packages/cli bun run build bun link # 在其它项目目录 cd /path/to/other-project bun link @lingframe-ai/cli linglong ``` ## 数据库配置 ### 1. 安装 PostgreSQL(macOS + Homebrew) ```bash brew install postgresql@16 # 将 psql 加入 PATH(Apple Silicon 示例) echo 'export PATH="/opt/homebrew/opt/postgresql@16/bin:$PATH"' >> ~/.zshrc source ~/.zshrc # 启动服务(开机可自动运行) brew services start postgresql@16 ``` ### 2. 初始化项目数据库 ```bash cp .env.example .env # 若尚未配置 bun run db:setup # 创建用户/库 + 同步 Prisma schema bun run db:generate # 修改 schema 后重新生成 client ``` ### 3. 常用命令 | 命令 | 说明 | | -------------------- | -------------------------------------- | | `bun run db:start` | 启动本机 Postgres 服务(Homebrew) | | `bun run db:stop` | 停止本机 Postgres 服务 | | `bun run db:setup` | 创建 `linglong` 用户与库,并 `db push` | | `bun run db:push` | 将 schema 推送到本地库 | | `bun run db:migrate` | 使用 migration 管理 schema | | `bun run db:studio` | 打开 Prisma Studio | `.env` 中的连接串示例: ``` DATABASE_URL=postgresql://linglong:linglong@localhost:5432/linglong ```