@memo-code/memo 0.5.15 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,12 +1,16 @@
1
1
  <div align="center">
2
2
  <img src="public/logo.svg" width="80" height="80" alt="Memo Logo">
3
3
  <h1>Memo Code</h1>
4
- <p>本地运行的 AI 编程助手,支持多轮对话、工具调用、并发</p>
4
+ <p>A lightweight coding agent that runs in your terminal.</p>
5
5
  </div>
6
6
 
7
+ <p align="center">
8
+ <a href="README.zh.md">Chinese Documentation</a>
9
+ </p>
10
+
7
11
  <p align="center">
8
12
  <a href="public/memo-code-cli-show-01.mp4">
9
- <img src="https://img.shields.io/badge/📹-观看演示视频-1a1a1a?style=for-the-badge" alt="Demo Video">
13
+ <img src="https://img.shields.io/badge/📹-Watch%20Demo%20Video-1a1a1a?style=for-the-badge" alt="Demo Video">
10
14
  </a>
11
15
  </p>
12
16
 
@@ -14,47 +18,49 @@
14
18
 
15
19
  <video src="public/memo-code-cli-show-01.mp4" width="100%"></video>
16
20
 
17
- 基于 Node.js + TypeScript,默认对接 DeepSeek,兼容 OpenAI API。
21
+ Built with Node.js + TypeScript. DeepSeek is the default provider, and OpenAI-compatible APIs are supported.
18
22
 
19
- ## 快速开始
23
+ Memo Code is an open-source coding agent that lives in your terminal, understands repository context, and helps you move faster with natural-language commands.
20
24
 
21
- ### 1. 安装
25
+ ## Quick Start
26
+
27
+ ### 1. Install
22
28
 
23
29
  ```bash
24
30
  npm install -g @memo-code/memo
25
- #
31
+ # or
26
32
  pnpm add -g @memo-code/memo
27
- #
33
+ # or
28
34
  yarn global add @memo-code/memo
29
- #
35
+ # or
30
36
  bun add -g @memo-code/memo
31
37
  ```
32
38
 
33
- ### 2. 配置 API Key
39
+ ### 2. Configure API Key
34
40
 
35
41
  ```bash
36
- export DEEPSEEK_API_KEY=your_key # OPENAI_API_KEY
42
+ export DEEPSEEK_API_KEY=your_key # or OPENAI_API_KEY
37
43
  ```
38
44
 
39
- ### 3. 启动使用
45
+ ### 3. Start
40
46
 
41
47
  ```bash
42
48
  memo
43
- # 首次运行会引导配置 provider/model,并(保存到 ~/.memo/config.toml
49
+ # First run guides provider/model setup and saves config to ~/.memo/config.toml
44
50
  ```
45
51
 
46
- ## 使用方式
52
+ ## Usage
47
53
 
48
- - 交互式:`memo`(默认 TUI,支持多轮、流式、工具可视化、快捷键)。
49
- - 单轮:`memo "你的问题" --once`(纯文本输出,适合脚本)。
50
- - 危险模式:`memo --dangerous` `memo -d`(跳过工具审批,谨慎使用)。
51
- - 查看版本:`memo --version` `memo -v`。
54
+ - Interactive mode: `memo` (default TUI; supports multi-turn chat, streaming, tool visualization, shortcuts).
55
+ - One-shot mode: `memo "your prompt" --once` (plain text output; useful for scripts).
56
+ - Dangerous mode: `memo --dangerous` or `memo -d` (skip tool approvals; use carefully).
57
+ - Version: `memo --version` or `memo -v`.
52
58
 
53
- ## 配置文件
59
+ ## Configuration
54
60
 
55
- 位置:`~/.memo/config.toml`(可通过 `MEMO_HOME` 环境变量修改)
61
+ Location: `~/.memo/config.toml` (can be changed via `MEMO_HOME`).
56
62
 
57
- ### Provider 配置
63
+ ### Provider Configuration
58
64
 
59
65
  ```toml
60
66
  current_provider = "deepseek"
@@ -67,73 +73,73 @@ model = "deepseek-chat"
67
73
  base_url = "https://api.deepseek.com"
68
74
  ```
69
75
 
70
- 支持配置多个 Provider,通过 `current_provider` 切换。
76
+ You can configure multiple providers and switch with `current_provider`.
71
77
 
72
- ### MCP 工具配置
78
+ ### MCP Tool Configuration
73
79
 
74
- 支持本地和远程 MCP 服务器:
80
+ Both local and remote MCP servers are supported:
75
81
 
76
82
  ```toml
77
- # 本地 MCP 服务器
83
+ # Local MCP server
78
84
  [mcp_servers.local_tools]
79
85
  command = "/path/to/mcp-server"
80
86
  args = []
81
87
 
82
- # 远程 HTTP MCP 服务器
88
+ # Remote HTTP MCP server
83
89
  [mcp_servers.remote]
84
90
  type = "streamable_http"
85
91
  url = "https://your-mcp-server.com/mcp"
86
92
  # headers = { Authorization = "Bearer xxx" }
87
93
  ```
88
94
 
89
- 也可以通过 CLI 管理 MCP 配置(对齐 Codex CLI 风格):
95
+ You can also manage MCP configs via CLI (aligned with Codex CLI style):
90
96
 
91
97
  ```bash
92
- # 列出 MCP servers
98
+ # List MCP servers
93
99
  memo mcp list
94
100
 
95
- # 添加本地 MCP serverstdio
101
+ # Add local MCP server (stdio)
96
102
  memo mcp add local_tools -- /path/to/mcp-server --flag
97
103
 
98
- # 添加远程 MCP serverstreamable HTTP
104
+ # Add remote MCP server (streamable HTTP)
99
105
  memo mcp add remote --url https://your-mcp-server.com/mcp --bearer-token-env-var MCP_TOKEN
100
106
 
101
- # 查看/删除
107
+ # Show/remove
102
108
  memo mcp get remote
103
109
  memo mcp remove remote
104
110
  ```
105
111
 
106
- ## 内置工具
112
+ ## Built-in Tools
107
113
 
108
- - `bash`:执行 shell 命令
109
- - `read`:读取文件
110
- - `write`:写入文件
111
- - `edit`:编辑文件
112
- - `glob`:搜索文件(模式匹配)
113
- - `grep`:搜索内容(正则匹配)
114
- - `webfetch`:获取网页
115
- - `save_memory`:保存长期记忆
116
- - `todo`:管理任务列表
114
+ - `bash`: execute shell commands
115
+ - `read`: read files
116
+ - `write`: write files
117
+ - `edit`: edit files
118
+ - `glob`: find files by pattern
119
+ - `grep`: search content by regex
120
+ - `webfetch`: fetch webpages
121
+ - `save_memory`: save long-term memory
122
+ - `todo`: manage a task list
117
123
 
118
- 通过 MCP 协议可扩展更多工具。
124
+ More tools can be added through MCP.
119
125
 
120
- ## 工具审批系统
126
+ ## Tool Approval System
121
127
 
122
- 新增工具审批机制,保护用户免受危险操作影响:
128
+ Memo includes a tool-approval mechanism to reduce risky operations:
123
129
 
124
- - **自动审批**:安全工具(readglobgrep等)自动通过
125
- - **手动审批**:危险工具(bashwriteedit等)需要用户确认
126
- - **审批选项**:
127
- - `once`:仅批准当前操作
128
- - `session`:批准本次会话中的所有同类操作
129
- - `deny`:拒绝操作
130
- - **危险模式**:`--dangerous` 参数跳过所有审批(仅限信任场景)
130
+ - **Auto-approve**: safe tools (`read`, `glob`, `grep`, etc.)
131
+ - **Manual approval**: risky tools (`bash`, `write`, `edit`, etc.)
132
+ - **Approval options**:
133
+ - `once`: approve current operation only
134
+ - `session`: approve all matching operations for this session
135
+ - `deny`: reject operation
136
+ - **Dangerous mode**: `--dangerous` skips all approvals (trusted scenarios only)
131
137
 
132
- ## 会话历史
138
+ ## Session History
133
139
 
134
- 所有会话自动保存到 `~/.memo/sessions/`,按工作目录和日期组织:
140
+ All sessions are saved to `~/.memo/sessions/`, grouped by working directory and date:
135
141
 
136
- ```
142
+ ```text
137
143
  ~/.memo/sessions/
138
144
  ├── workspace-name/
139
145
  │ ├── 2026-02-01_143020_abc123.jsonl
@@ -142,79 +148,79 @@ memo mcp remove remote
142
148
  └── 2026-02-01_160000_xyz789.jsonl
143
149
  ```
144
150
 
145
- JSONL 格式便于分析和调试。
151
+ JSONL format is useful for analysis and debugging.
146
152
 
147
- ## 开发
153
+ ## Development
148
154
 
149
- ### 本地运行
155
+ ### Run Locally
150
156
 
151
157
  ```bash
152
158
  pnpm install
153
159
  pnpm start
154
- #
160
+ # or
155
161
  pnpm start "prompt" --once
156
162
  ```
157
163
 
158
- ### 构建
164
+ ### Build
159
165
 
160
166
  ```bash
161
- pnpm run build # 生成 dist/index.js
167
+ pnpm run build # generates dist/index.js
162
168
  ```
163
169
 
164
- ### 测试
170
+ ### Test
165
171
 
166
172
  ```bash
167
- pnpm test # 全量测试
168
- pnpm test packages/core # 测试 core
169
- pnpm test packages/tools # 测试 tools
173
+ pnpm test # all tests
174
+ pnpm test packages/core # core package
175
+ pnpm test packages/tools # tools package
170
176
  ```
171
177
 
172
- ### 代码格式化
178
+ ### Format
173
179
 
174
180
  ```bash
175
- npm run format # 格式化所有文件
176
- npm run format:check # 检查格式(CI
181
+ npm run format # format all files
182
+ npm run format:check # check format (CI)
177
183
  ```
178
184
 
179
- ## 项目结构
185
+ ## Project Structure
180
186
 
181
- ```
187
+ ```text
182
188
  memo-cli/
183
189
  ├── packages/
184
- │ ├── core/ # 核心逻辑:Session、工具路由、配置
185
- │ ├── tools/ # 内置工具实现
186
- │ └── cli/ # TUI 界面
187
- ├── docs/ # 技术文档
188
- └── dist/ # 构建输出
190
+ │ ├── core/ # core logic: Session, tool routing, config
191
+ │ ├── tools/ # built-in tool implementations
192
+ │ └── cli/ # TUI interface
193
+ ├── docs/ # technical docs
194
+ └── dist/ # build output
189
195
  ```
190
196
 
191
- ## CLI 快捷键与命令
197
+ ## CLI Shortcuts and Commands
192
198
 
193
- - `/help`:显示帮助与快捷键说明。
194
- - `/models`:列出现有 Provider/Model,回车切换;支持直接 `/models deepseek` 精确选择。
195
- - `/context`:弹出 80k/120k/150k/200k 选项并立即设置上限。
196
- - `$ <cmd>`:在当前工作目录本地执行 shell 命令,直接显示输出(`Shell Result`)。
197
- - `resume` 历史:输入 `resume` 查看并加载本目录的历史会话。
198
- - 退出与清屏:`exit` / `/exit`,`Ctrl+L` 新会话,`Esc Esc` 取消运行或清空输入。
199
- - **工具审批**:危险操作会弹出审批对话框,可选择 `once`/`session`/`deny`。
199
+ - `/help`: show help and shortcut guide.
200
+ - `/models`: list available Provider/Model entries and switch with Enter; also supports direct selection like `/models deepseek`.
201
+ - `/context`: open 80k/120k/150k/200k options and apply immediately.
202
+ - `$ <cmd>`: run a local shell command in current cwd and display result directly (`Shell Result`).
203
+ - `resume` history: type `resume` to list and load past sessions for current directory.
204
+ - Exit and clear: `exit` / `/exit`, `Ctrl+L` for new session, `Esc Esc` to cancel current run or clear input.
205
+ - **Tool approval**: risky operations open an approval dialog with `once`/`session`/`deny`.
200
206
 
201
- > 仅当会话包含用户消息时才写入 `sessions/` JSONL 日志,避免空会话文件。
207
+ > Session logs are written only when a session contains user messages, to avoid empty files.
202
208
 
203
- ## 技术栈
209
+ ## Tech Stack
204
210
 
205
211
  - **Runtime**: Node.js 18+
206
- - **语言**: TypeScript
212
+ - **Language**: TypeScript
207
213
  - **UI**: React + Ink
208
214
  - **Protocol**: MCP (Model Context Protocol)
209
- - **Token 计数**: tiktoken
215
+ - **Token counting**: tiktoken
210
216
 
211
- ## 相关文档
217
+ ## Related Docs
212
218
 
213
- - [用户指南](./docs/user/README.md) - 面向使用者的分模块说明
214
- - [Core 架构](./docs/core.md) - 核心实现详解
215
- - [CLI 适配更新](./docs/cli-update.md) - Tool Use API 迁移说明
216
- - [开发指南](./CONTRIBUTING.md) - 贡献指南
217
- - [项目约定](./AGENTS.md) - 代码规范和开发流程
219
+ - [User Guide](./docs/user/README.md) - User-facing docs by module
220
+ - [Core Architecture](./docs/core.md) - Core implementation details
221
+ - [CLI Adaptation History](./docs/cli-update.md) - Historical migration notes (Tool Use API)
222
+ - [Contributing](./CONTRIBUTING.md) - Contribution guide
223
+ - [Project Guidelines](./AGENTS.md) - Coding conventions and development process
218
224
 
219
225
  ## License
220
226
 
package/README.zh.md ADDED
@@ -0,0 +1,223 @@
1
+ <div align="center">
2
+ <img src="public/logo.svg" width="80" height="80" alt="Memo Logo">
3
+ <h1>Memo Code</h1>
4
+ <p>运行在终端里的轻量级编码代理。</p>
5
+ </div>
6
+
7
+ <p align="center">
8
+ <a href="public/memo-code-cli-show-01.mp4">
9
+ <img src="https://img.shields.io/badge/📹-观看演示视频-1a1a1a?style=for-the-badge" alt="Demo Video">
10
+ </a>
11
+ </p>
12
+
13
+ ---
14
+
15
+ <video src="public/memo-code-cli-show-01.mp4" width="100%"></video>
16
+
17
+ 基于 Node.js + TypeScript,默认对接 DeepSeek,兼容 OpenAI API。
18
+
19
+ Memo Code 是一个开源的终端编码代理,能够理解项目上下文,并通过自然语言协助你更快完成编码、排障和日常开发任务。
20
+
21
+ ## 快速开始
22
+
23
+ ### 1. 安装
24
+
25
+ ```bash
26
+ npm install -g @memo-code/memo
27
+ # 或
28
+ pnpm add -g @memo-code/memo
29
+ # 或
30
+ yarn global add @memo-code/memo
31
+ # 或
32
+ bun add -g @memo-code/memo
33
+ ```
34
+
35
+ ### 2. 配置 API Key
36
+
37
+ ```bash
38
+ export DEEPSEEK_API_KEY=your_key # 或 OPENAI_API_KEY
39
+ ```
40
+
41
+ ### 3. 启动使用
42
+
43
+ ```bash
44
+ memo
45
+ # 首次运行会引导配置 provider/model,并(保存到 ~/.memo/config.toml)
46
+ ```
47
+
48
+ ## 使用方式
49
+
50
+ - 交互式:`memo`(默认 TUI,支持多轮、流式、工具可视化、快捷键)。
51
+ - 单轮:`memo "你的问题" --once`(纯文本输出,适合脚本)。
52
+ - 危险模式:`memo --dangerous` 或 `memo -d`(跳过工具审批,谨慎使用)。
53
+ - 查看版本:`memo --version` 或 `memo -v`。
54
+
55
+ ## 配置文件
56
+
57
+ 位置:`~/.memo/config.toml`(可通过 `MEMO_HOME` 环境变量修改)
58
+
59
+ ### Provider 配置
60
+
61
+ ```toml
62
+ current_provider = "deepseek"
63
+ stream_output = false
64
+
65
+ [[providers.deepseek]]
66
+ name = "deepseek"
67
+ env_api_key = "DEEPSEEK_API_KEY"
68
+ model = "deepseek-chat"
69
+ base_url = "https://api.deepseek.com"
70
+ ```
71
+
72
+ 支持配置多个 Provider,通过 `current_provider` 切换。
73
+
74
+ ### MCP 工具配置
75
+
76
+ 支持本地和远程 MCP 服务器:
77
+
78
+ ```toml
79
+ # 本地 MCP 服务器
80
+ [mcp_servers.local_tools]
81
+ command = "/path/to/mcp-server"
82
+ args = []
83
+
84
+ # 远程 HTTP MCP 服务器
85
+ [mcp_servers.remote]
86
+ type = "streamable_http"
87
+ url = "https://your-mcp-server.com/mcp"
88
+ # headers = { Authorization = "Bearer xxx" }
89
+ ```
90
+
91
+ 也可以通过 CLI 管理 MCP 配置(对齐 Codex CLI 风格):
92
+
93
+ ```bash
94
+ # 列出 MCP servers
95
+ memo mcp list
96
+
97
+ # 添加本地 MCP server(stdio)
98
+ memo mcp add local_tools -- /path/to/mcp-server --flag
99
+
100
+ # 添加远程 MCP server(streamable HTTP)
101
+ memo mcp add remote --url https://your-mcp-server.com/mcp --bearer-token-env-var MCP_TOKEN
102
+
103
+ # 查看/删除
104
+ memo mcp get remote
105
+ memo mcp remove remote
106
+ ```
107
+
108
+ ## 内置工具
109
+
110
+ - `bash`:执行 shell 命令
111
+ - `read`:读取文件
112
+ - `write`:写入文件
113
+ - `edit`:编辑文件
114
+ - `glob`:搜索文件(模式匹配)
115
+ - `grep`:搜索内容(正则匹配)
116
+ - `webfetch`:获取网页
117
+ - `save_memory`:保存长期记忆
118
+ - `todo`:管理任务列表
119
+
120
+ 通过 MCP 协议可扩展更多工具。
121
+
122
+ ## 工具审批系统
123
+
124
+ 新增工具审批机制,保护用户免受危险操作影响:
125
+
126
+ - **自动审批**:安全工具(read、glob、grep等)自动通过
127
+ - **手动审批**:危险工具(bash、write、edit等)需要用户确认
128
+ - **审批选项**:
129
+ - `once`:仅批准当前操作
130
+ - `session`:批准本次会话中的所有同类操作
131
+ - `deny`:拒绝操作
132
+ - **危险模式**:`--dangerous` 参数跳过所有审批(仅限信任场景)
133
+
134
+ ## 会话历史
135
+
136
+ 所有会话自动保存到 `~/.memo/sessions/`,按工作目录和日期组织:
137
+
138
+ ```
139
+ ~/.memo/sessions/
140
+ ├── workspace-name/
141
+ │ ├── 2026-02-01_143020_abc123.jsonl
142
+ │ └── 2026-02-01_150315_def456.jsonl
143
+ └── another-project/
144
+ └── 2026-02-01_160000_xyz789.jsonl
145
+ ```
146
+
147
+ JSONL 格式便于分析和调试。
148
+
149
+ ## 开发
150
+
151
+ ### 本地运行
152
+
153
+ ```bash
154
+ pnpm install
155
+ pnpm start
156
+ # 或
157
+ pnpm start "prompt" --once
158
+ ```
159
+
160
+ ### 构建
161
+
162
+ ```bash
163
+ pnpm run build # 生成 dist/index.js
164
+ ```
165
+
166
+ ### 测试
167
+
168
+ ```bash
169
+ pnpm test # 全量测试
170
+ pnpm test packages/core # 测试 core 包
171
+ pnpm test packages/tools # 测试 tools 包
172
+ ```
173
+
174
+ ### 代码格式化
175
+
176
+ ```bash
177
+ npm run format # 格式化所有文件
178
+ npm run format:check # 检查格式(CI)
179
+ ```
180
+
181
+ ## 项目结构
182
+
183
+ ```
184
+ memo-cli/
185
+ ├── packages/
186
+ │ ├── core/ # 核心逻辑:Session、工具路由、配置
187
+ │ ├── tools/ # 内置工具实现
188
+ │ └── cli/ # TUI 界面
189
+ ├── docs/ # 技术文档
190
+ └── dist/ # 构建输出
191
+ ```
192
+
193
+ ## CLI 快捷键与命令
194
+
195
+ - `/help`:显示帮助与快捷键说明。
196
+ - `/models`:列出现有 Provider/Model,回车切换;支持直接 `/models deepseek` 精确选择。
197
+ - `/context`:弹出 80k/120k/150k/200k 选项并立即设置上限。
198
+ - `$ <cmd>`:在当前工作目录本地执行 shell 命令,直接显示输出(`Shell Result`)。
199
+ - `resume` 历史:输入 `resume` 查看并加载本目录的历史会话。
200
+ - 退出与清屏:`exit` / `/exit`,`Ctrl+L` 新会话,`Esc Esc` 取消运行或清空输入。
201
+ - **工具审批**:危险操作会弹出审批对话框,可选择 `once`/`session`/`deny`。
202
+
203
+ > 仅当会话包含用户消息时才写入 `sessions/` JSONL 日志,避免空会话文件。
204
+
205
+ ## 技术栈
206
+
207
+ - **Runtime**: Node.js 18+
208
+ - **语言**: TypeScript
209
+ - **UI**: React + Ink
210
+ - **Protocol**: MCP (Model Context Protocol)
211
+ - **Token 计数**: tiktoken
212
+
213
+ ## 相关文档
214
+
215
+ - [用户指南](./docs/user/README.md) - 面向使用者的分模块说明
216
+ - [Core 架构](./docs/core.md) - 核心实现详解
217
+ - [CLI 适配更新](./docs/cli-update.md) - Tool Use API 迁移说明
218
+ - [开发指南](./CONTRIBUTING.md) - 贡献指南
219
+ - [项目约定](./AGENTS.md) - 代码规范和开发流程
220
+
221
+ ## License
222
+
223
+ MIT