
Product
Introducing Repository Access Permissions and Custom Roles
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.
AI coding agent CLI and terminal coding assistant with an interactive TUI (beta channel)
你的终端 AI 伙伴。在命令行里聊聊天、跑任务、让工作流自动化一点。
dimcode 是一个 AI coding agent CLI,提供交互式 TUI 界面和一次性任务执行模式。
# beta channel(当前推荐)
npm i -g dimcode@beta
# 或者用 bun / pnpm
bun add -g dimcode@beta
pnpm add -g dimcode@beta
安装完成后会得到两个等价命令:dim 和 dimcode。
dim --version
安装时 npm 会根据当前平台自动拉取对应的二进制子包(
dimcode-darwin-arm64、dimcode-linux-x64等),不需要手动选择。
| 平台 | 子包 |
|---|---|
| macOS (Apple Silicon) | dimcode-darwin-arm64 |
| macOS (Intel) | dimcode-darwin-x64 |
| Linux (x64) | dimcode-linux-x64 |
| Linux (ARM64) | dimcode-linux-arm64 |
| Windows (x64) | dimcode-windows-x64 |
# 启动交互式界面,和 AI 聊聊天
dim
# 一次性执行,不用进界面
dim exec "把 auth 模块重构为 JWT 方案"
# 查看版本
dim --version
# 查看帮助
dim --help
第一次启动会引导你连接一个模型提供商(OpenAI、Anthropic 或自定义 endpoint)。
| 命令 | 说明 |
|---|---|
dim | 启动交互式 TUI 界面(默认) |
dim exec "<提示词>" | 在后台执行单条提示,不用进界面 |
dim session list | 列出已保存的会话 |
dim session rm <id> | 删除指定会话 |
dim provider list | 查看已配置的模型提供商 |
dim provider add <id> --api-key <密钥> | 添加提供商(如 openai) |
dim provider switch <id> | 切换当前使用的提供商 |
dim provider refresh-models | 从提供商刷新模型列表 |
dim mcp list | 查看 MCP 服务器列表 |
dim auth login | 登录云端功能 |
dim upgrade | 检查更新 |
dim --help | 显示帮助信息 |
dim --version | 显示版本号 |
直接运行 dim 就进终端交互界面了,长这样:
┌────────────────────────────────────────────────────────────────────────────┐
│ 会话标题 ~/workspace/repo 12 条消息 | 42k | vdev │
├────────────────────────────────────────────────────────────────────────────┤
│ │
│ 对话记录 │
│ - 用户消息 │
│ - 助手回复 │
│ - 工具调用 │
│ - 思考过程 │
│ │
├────────────────────────────────────────────────────────────────────────────┤
│ ┌────────────────────────────────────────────────────────────────────────┐ │
│ │ 输入问题... │ │
│ │ 代理模式 就绪 42% 上下文 ■ 模型名称 │ │
│ └────────────────────────────────────────────────────────────────────────┘ │
├────────────────────────────────────────────────────────────────────────────┤
│ 拖拽选择文本 清空输入 Tab: 切换模式 Ctrl+P: 命令面板 │
└────────────────────────────────────────────────────────────────────────────┘
界面分四块:
| 按键 | 做什么 |
|---|---|
Enter | 发送消息 |
Shift+Enter / Ctrl+J | 输入换行 |
Tab | 切换「代理模式」/「计划模式」 |
Ctrl+P | 打开命令面板 |
Cmd+T(Mac)/ Ctrl+T(其他) | 打开时间线 |
Cmd+N(Mac)/ Ctrl+N(其他) | 新建会话 / 回首页 |
/ | 打开命令面板并过滤 |
@ | 打开技能引用面板 |
Esc | 打断正在跑的 AI 任务 |
Ctrl+C | 关弹窗 → 清空输入 → 退出确认 |
Ctrl+V | 粘贴剪贴板图片 |
↑ / ↓ | 翻输入历史(单行时) |
在输入框里打 / 就能打开命令面板:
| 命令 | 干嘛的 |
|---|---|
/new | 开一个新会话 |
/timeline | 看看这个会话的时间线 |
/skills | 浏览可用的技能 |
/resume | 打开之前保存的会话 |
/compact | 压缩一下上下文,省点 Token |
/approvals | 调整工具授权设置 |
/connect | 连接模型提供商 |
/models | 换个模型用 |
/mcp | 管理 MCP 服务器 |
/plugins | 看看装了哪些插件 |
/theme | 换个主题 |
/settings | 打开设置 |
/language | 切换界面语言 |
/exit | 退出 |
AI 干活的时候可能会弹窗问你:
Y 允许一次,N 拒绝Ctrl+C 时弹出来,防止手滑关掉所有配置保存在 ~/.dimcode/ 目录下(SQLite 数据库 + JSON 文件)。
# OpenAI
dim provider add openai --api-key sk-xxxxxxxx
# 自定义本地模型
dim provider add mylocal --base-url http://127.0.0.1:11434 --model llama3
# 切换当前使用的提供商
dim provider switch openai
# 刷新模型列表
dim provider refresh-models openai
| 变量 | 说明 |
|---|---|
DIMCODE_LOG | 开启诊断日志,记录到 ~/.dimcode/logs/ |
DIMCODE_DEBUG | 打印 wrapper 启动调试信息(定位平台二进制问题) |
DIMCODE_BIN_PATH | 指定自定义二进制路径(开发/调试用) |
NO_COLOR | 禁用彩色输出 |
HTTPS_PROXY | 设置 HTTPS 代理 |
适合脚本和自动化场景:
# 单条提示直接执行
dim exec "写一个按列排序 CSV 的 Python 脚本"
| 状态码 | 含义 |
|---|---|
0 | 执行成功 |
1 | 运行时错误 |
2 | 参数错误 |
3 | 认证失败 |
# 升级到最新 beta
npm i -g dimcode@beta
# 卸载
npm uninstall -g dimcode
Q: 安装后提示找不到平台二进制?
可能是 npm 跳过了 optionalDependencies。先用 debug 模式确认:
DIMCODE_DEBUG=1 dim --version
然后重装一次:
npm uninstall -g dimcode && npm i -g dimcode@beta
Q: 启动后显示空白或乱码?
确保终端支持 256 色:
export TERM=xterm-256color
Q: 如何中断正在执行的任务?
按 Esc 键即可中断当前 AI 的执行回合。
Q: 图片怎么发送给 AI?
直接 Ctrl+V 粘贴剪贴板中的图片,或在输入框中粘贴图片路径。
Q: 会话数据存在哪里?
所有本地数据放在 ~/.dimcode/v2/,会话存在其中的 SQLite 数据库 dimcode.sqlite 里(表:sessions、session_states、session_relations、session_blobs),不会上传到云端。
目录布局大致是:
~/.dimcode/v2/
├── config.json 全局配置
├── providers.json 模型提供商
├── auth.json 登录态
├── mcp.json MCP 服务器
├── dimcode.sqlite 会话 / 消息 / 状态
├── dimcode.sqlite-wal
├── dimcode.sqlite-shm
├── data/ blob 数据
└── logs/ 诊断日志
Q: 如何删除单个会话?
dim session list # 找到要删的 id
dim session rm <id>
Q: 如何清空所有历史会话?
最稳的做法是删 SQLite 数据库文件(保留 config.json、providers.json 等配置):
rm -f ~/.dimcode/v2/dimcode.sqlite \
~/.dimcode/v2/dimcode.sqlite-wal \
~/.dimcode/v2/dimcode.sqlite-shm
如果想彻底重置(含配置、登录态、MCP 列表),删整个 v2 目录:
rm -rf ~/.dimcode/v2
注意:
~/.dimcode/下的其它目录(sessions/、dimcode/等)是早期版本残留,对 v2 没有作用。
见仓库根目录 LICENSE 文件。
FAQs
AI coding agent CLI and terminal coding assistant with an interactive TUI (beta channel)
The npm package dimcode receives a total of 4,336 weekly downloads. As such, dimcode popularity was classified as popular.
We found that dimcode demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.