GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - tolerious/sema-code-cli: A coding agent cli tool

BranchesTags
Open more actions menu

Latest commit

 

History

24 Commits
24 Commits

Folders and files

NameName
Last commit message
Last commit date
bin
bin
 
 
scripts
scripts
 
 
src
src
 
 
.gitignore
.gitignore
 
 
.mcp.json
.mcp.json
 
 
.prettierignore
.prettierignore
 
 
.prettierrc
.prettierrc
 
 
ARCHITECTURE.md
ARCHITECTURE.md
 
 
CLAUDE.md
CLAUDE.md
 
 
README.md
README.md
 
 
UserGuide.md
UserGuide.md
 
 
package.json
package.json
 
 
pnpm-lock.yaml
pnpm-lock.yaml
 
 
tsconfig.json
tsconfig.json
 
 

Repository files navigation

Sema Code CLI

基于 sema-core 的命令行 AI 编程助手。

安装

方式 A:一行脚本(推荐,无需 Node.js)

Linux / macOS:

curl -fsSL https://raw.githubusercontent.com/midea-ai/sema-code-cli/main/scripts/install.sh | bash

Windows CMD:

curl -fsSL https://raw.githubusercontent.com/midea-ai/sema-code-cli/main/scripts/install.cmd -o install.cmd && install.cmd && del install.cmd

安装完成后,在任意项目目录运行:

sema-code

方式 B:手动下载二进制文件(无需 Node.js)

从 Releases 下载对应平台的二进制文件:

平台 文件
macOS Apple Silicon sema-code-macos-arm64
macOS Intel sema-code-macos-x64
Linux x64 sema-code-linux-x64
Windows x64 sema-code-windows-x64
chmod +x sema-code-macos-arm64
./sema-code-macos-arm64

方式 C:npm 全局安装(需要 Node.js >= 18)

npm install -g sema-code-cli
sema-code

使用

基本交互

> 帮我修复 login.ts 中的 bug

● 我来分析一下...
● ViewFile(src/login.ts)
  ...

──────────────────────────────────────────
deepseek-v4-pro · Agent · 3.2k/128k tokens

> _

快捷键

按键 功能
Enter 发送消息
Esc 中断当前处理
↑ / ↓ 浏览输入历史

命令

命令 功能
/model 模型配置
/clear 清空会话
/exit 退出程序

输入 / 时会自动弹出命令补全列表,支持 ↑↓ 选择和 Tab 补全。

权限确认

工具需要权限时内联确认:

● RunShell
  Command: rm -rf node_modules
  ▸ 是否继续?

  (y) 同意本次  (a) 始终允许  (n) 拒绝  (Esc) 取消

模型配置

首次启动时输入 /model 进入模型配置页。内置 DeepSeek V4 和 GLM-4 系列预设,选择模型后只需输入 API Key 即可。配置持久化到 ~/.sema/model.conf。

技术栈

组件 技术
AI 引擎 sema-core
终端 UI Ink (React for terminal)
语言 TypeScript
包管理器 pnpm

本地开发

环境要求

  • Node.js >= 22
  • pnpm >= 10

克隆并启动

git clone https://github.com/midea-ai/sema-code-cli.git
cd sema-code-cli
pnpm install
pnpm dev

pnpm dev 使用 tsx 直接运行 TypeScript 源码,支持热重载。启动后会进入 REPL 交互界面。

常用命令

pnpm dev              # 开发模式(tsx,无需编译)
pnpm build            # TypeScript 编译到 dist/
pnpm start            # 运行编译产物
pnpm tsc --noEmit     # 仅类型检查,不生成文件
pnpm format           # Prettier 格式化
pnpm format:check     # 检查格式是否符合规范

调试技巧

1. 查看 Ink 渲染性能

src/index.ts 中 render() 可临时调整:

render(<App />, {
  incrementalRendering: true,   // 只重绘变化行
  maxFps: 10,                   // 降低帧率观察渲染行为
  debug: true,                  // 每次更新独立输出,方便对比
});

2. 查看 sema-core 日志

临时修改 src/core/bruce.ts 中的 logLevel:

logLevel: 'debug',  // 输出详细引擎日志到 ~/.sema/logs/

3. 重置模型配置

如果模型配置出错导致启动失败,删除配置文件重新开始:

rm ~/.sema/model.conf

4. React DevTools 调试

Ink 支持 React DevTools,可以实时查看组件树、props、state。

# 终端 1:以 DevTools 模式启动 app
pnpm dev:debug

# 终端 2:启动 DevTools 前端
npx react-devtools

DevTools 启动后会自动连接,可以像调试网页 React 应用一样查看和修改组件状态,无需重启。

注意: 调试完成后需手动 Ctrl+C 退出 app。react-devtools-core 已作为 devDependency 安装,仅在 DEV=true 时生效。

5. 单独测试某个组件

import { renderToString } from 'ink';
const output = renderToString(<StatusBar modelName="test" ... />);
console.log(output);

项目结构

详细架构文档见 ARCHITECTURE.md,开发指引见 CLAUDE.md。

发布

npm 发布

pnpm version patch
pnpm build
pnpm publish --access public

独立二进制文件(需要 bun)

# 单个平台(当前机器)
pnpm compile

# 全平台(macOS arm64/x64 + Linux x64 + Windows x64)
pnpm compile:all

编译产物输出到 dist/sema-code,无需 Node.js 即可运行。

License

MIT

About

A coding agent cli tool

Resources

Readme
Activity

Stars

1 star

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.