@memo-code/memo 0.5.15 → 0.6.3

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,51 +18,52 @@
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, tool visualization, shortcuts).
55
+ - Plain mode (non-TTY): `echo "your prompt" | memo` (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"
61
- stream_output = false
62
67
 
63
68
  [[providers.deepseek]]
64
69
  name = "deepseek"
@@ -67,154 +72,151 @@ model = "deepseek-chat"
67
72
  base_url = "https://api.deepseek.com"
68
73
  ```
69
74
 
70
- 支持配置多个 Provider,通过 `current_provider` 切换。
75
+ You can configure multiple providers and switch with `current_provider`.
71
76
 
72
- ### MCP 工具配置
77
+ ### MCP Tool Configuration
73
78
 
74
- 支持本地和远程 MCP 服务器:
79
+ Both local and remote MCP servers are supported:
75
80
 
76
81
  ```toml
77
- # 本地 MCP 服务器
82
+ # Local MCP server
78
83
  [mcp_servers.local_tools]
79
84
  command = "/path/to/mcp-server"
80
85
  args = []
81
86
 
82
- # 远程 HTTP MCP 服务器
87
+ # Remote HTTP MCP server
83
88
  [mcp_servers.remote]
84
89
  type = "streamable_http"
85
90
  url = "https://your-mcp-server.com/mcp"
86
91
  # headers = { Authorization = "Bearer xxx" }
87
92
  ```
88
93
 
89
- 也可以通过 CLI 管理 MCP 配置(对齐 Codex CLI 风格):
94
+ You can also manage MCP configs via CLI (aligned with Codex CLI style):
90
95
 
91
96
  ```bash
92
- # 列出 MCP servers
97
+ # List MCP servers
93
98
  memo mcp list
94
99
 
95
- # 添加本地 MCP serverstdio
100
+ # Add local MCP server (stdio)
96
101
  memo mcp add local_tools -- /path/to/mcp-server --flag
97
102
 
98
- # 添加远程 MCP serverstreamable HTTP
103
+ # Add remote MCP server (streamable HTTP)
99
104
  memo mcp add remote --url https://your-mcp-server.com/mcp --bearer-token-env-var MCP_TOKEN
100
105
 
101
- # 查看/删除
106
+ # Show/remove
102
107
  memo mcp get remote
103
108
  memo mcp remove remote
104
109
  ```
105
110
 
106
- ## 内置工具
111
+ ## Built-in Tools
107
112
 
108
- - `bash`:执行 shell 命令
109
- - `read`:读取文件
110
- - `write`:写入文件
111
- - `edit`:编辑文件
112
- - `glob`:搜索文件(模式匹配)
113
- - `grep`:搜索内容(正则匹配)
114
- - `webfetch`:获取网页
115
- - `save_memory`:保存长期记忆
116
- - `todo`:管理任务列表
113
+ - `exec_command` / `write_stdin`: execute shell commands (default shell family)
114
+ - `shell` / `shell_command`: compatibility shell variants (feature/env controlled)
115
+ - `apply_patch`: structured file edits
116
+ - `read_file` / `list_dir` / `grep_files`: file read and retrieval
117
+ - `list_mcp_resources` / `list_mcp_resource_templates` / `read_mcp_resource`: MCP resource access
118
+ - `update_plan`: structured task plan updates
119
+ - `webfetch`: fetch webpages
120
+ - `get_memory`: read memory payload from `~/.memo/Agents.md` (or `MEMO_HOME`)
117
121
 
118
- 通过 MCP 协议可扩展更多工具。
122
+ More tools can be added through MCP.
119
123
 
120
- ## 工具审批系统
124
+ ## Tool Approval System
121
125
 
122
- 新增工具审批机制,保护用户免受危险操作影响:
126
+ Memo includes a tool-approval mechanism to reduce risky operations:
123
127
 
124
- - **自动审批**:安全工具(read、glob、grep等)自动通过
125
- - **手动审批**:危险工具(bash、write、edit等)需要用户确认
126
- - **审批选项**:
127
- - `once`:仅批准当前操作
128
- - `session`:批准本次会话中的所有同类操作
129
- - `deny`:拒绝操作
130
- - **危险模式**:`--dangerous` 参数跳过所有审批(仅限信任场景)
128
+ - **Auto-approve**: safe read tools (`read_file`, `list_dir`, `grep_files`, `webfetch`, `get_memory`, etc.)
129
+ - **Manual approval**: risky tools (`apply_patch`, `exec_command`, etc.)
130
+ - **Approval options**:
131
+ - `once`: approve current operation only
132
+ - `session`: approve all matching operations for this session
133
+ - `deny`: reject operation
134
+ - **Dangerous mode**: `--dangerous` skips all approvals (trusted scenarios only)
131
135
 
132
- ## 会话历史
136
+ ## Session History
133
137
 
134
- 所有会话自动保存到 `~/.memo/sessions/`,按工作目录和日期组织:
138
+ All sessions are saved to `~/.memo/sessions/`, grouped by date:
135
139
 
136
- ```
140
+ ```text
137
141
  ~/.memo/sessions/
138
- ├── workspace-name/
139
- │ ├── 2026-02-01_143020_abc123.jsonl
140
- └── 2026-02-01_150315_def456.jsonl
141
- └── another-project/
142
- └── 2026-02-01_160000_xyz789.jsonl
142
+ └── 2026/
143
+ └── 02/
144
+ └── 08/
145
+ ├── rollout-2026-02-08T02-21-18-abc123.jsonl
146
+ └── rollout-2026-02-08T02-42-09-def456.jsonl
143
147
  ```
144
148
 
145
- JSONL 格式便于分析和调试。
149
+ JSONL format is useful for analysis and debugging.
146
150
 
147
- ## 开发
151
+ ## Development
148
152
 
149
- ### 本地运行
153
+ ### Run Locally
150
154
 
151
155
  ```bash
152
156
  pnpm install
153
157
  pnpm start
154
- # 或
155
- pnpm start "prompt" --once
156
158
  ```
157
159
 
158
- ### 构建
160
+ ### Build
159
161
 
160
162
  ```bash
161
- pnpm run build # 生成 dist/index.js
163
+ pnpm run build # generates dist/index.js
162
164
  ```
163
165
 
164
- ### 测试
166
+ ### Test
165
167
 
166
168
  ```bash
167
- pnpm test # 全量测试
168
- pnpm test packages/core # 测试 core
169
- pnpm test packages/tools # 测试 tools
169
+ pnpm test # all tests
170
+ pnpm test packages/core # core package
171
+ pnpm test packages/tools # tools package
170
172
  ```
171
173
 
172
- ### 代码格式化
174
+ ### Format
173
175
 
174
176
  ```bash
175
- npm run format # 格式化所有文件
176
- npm run format:check # 检查格式(CI
177
+ npm run format # format all files
178
+ npm run format:check # check format (CI)
177
179
  ```
178
180
 
179
- ## 项目结构
181
+ ## Project Structure
180
182
 
181
- ```
183
+ ```text
182
184
  memo-cli/
183
185
  ├── packages/
184
- │ ├── core/ # 核心逻辑:Session、工具路由、配置
185
- │ ├── tools/ # 内置工具实现
186
- │ └── cli/ # TUI 界面
187
- ├── docs/ # 技术文档
188
- └── dist/ # 构建输出
186
+ │ ├── core/ # core logic: Session, tool routing, config
187
+ │ ├── tools/ # built-in tool implementations
188
+ │ └── cli/ # TUI interface
189
+ ├── docs/ # technical docs
190
+ └── dist/ # build output
189
191
  ```
190
192
 
191
- ## CLI 快捷键与命令
193
+ ## CLI Shortcuts and Commands
192
194
 
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`。
195
+ - `/help`: show help and shortcut guide.
196
+ - `/models`: list available Provider/Model entries and switch with Enter; also supports direct selection like `/models deepseek`.
197
+ - `/context`: open 80k/120k/150k/200k options and apply immediately.
198
+ - `$ <cmd>`: run a local shell command in current cwd and display result directly (`Shell Result`).
199
+ - `resume` history: type `resume` to list and load past sessions for current directory.
200
+ - Exit and clear: `exit` / `/exit`, `Ctrl+L` for new session, `Esc Esc` to cancel current run or clear input.
201
+ - **Tool approval**: risky operations open an approval dialog with `once`/`session`/`deny`.
200
202
 
201
- > 仅当会话包含用户消息时才写入 `sessions/` JSONL 日志,避免空会话文件。
203
+ > Session logs are written only when a session contains user messages, to avoid empty files.
202
204
 
203
- ## 技术栈
205
+ ## Tech Stack
204
206
 
205
207
  - **Runtime**: Node.js 18+
206
- - **语言**: TypeScript
208
+ - **Language**: TypeScript
207
209
  - **UI**: React + Ink
208
210
  - **Protocol**: MCP (Model Context Protocol)
209
- - **Token 计数**: tiktoken
211
+ - **Token counting**: tiktoken
210
212
 
211
- ## 相关文档
213
+ ## Related Docs
212
214
 
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) - 代码规范和开发流程
215
+ - [User Guide](./docs/user/README.md) - User-facing docs by module
216
+ - [Core Architecture](./docs/core.md) - Core implementation details
217
+ - [CLI Adaptation History](./docs/cli-update.md) - Historical migration notes (Tool Use API)
218
+ - [Contributing](./CONTRIBUTING.md) - Contribution guide
219
+ - [Project Guidelines](./AGENTS.md) - Coding conventions and development process
218
220
 
219
221
  ## License
220
222
 
package/README.zh.md ADDED
@@ -0,0 +1,220 @@
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
+ - 非交互纯文本模式(非 TTY):`echo "你的问题" | memo`(适合脚本)。
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
+
64
+ [[providers.deepseek]]
65
+ name = "deepseek"
66
+ env_api_key = "DEEPSEEK_API_KEY"
67
+ model = "deepseek-chat"
68
+ base_url = "https://api.deepseek.com"
69
+ ```
70
+
71
+ 支持配置多个 Provider,通过 `current_provider` 切换。
72
+
73
+ ### MCP 工具配置
74
+
75
+ 支持本地和远程 MCP 服务器:
76
+
77
+ ```toml
78
+ # 本地 MCP 服务器
79
+ [mcp_servers.local_tools]
80
+ command = "/path/to/mcp-server"
81
+ args = []
82
+
83
+ # 远程 HTTP MCP 服务器
84
+ [mcp_servers.remote]
85
+ type = "streamable_http"
86
+ url = "https://your-mcp-server.com/mcp"
87
+ # headers = { Authorization = "Bearer xxx" }
88
+ ```
89
+
90
+ 也可以通过 CLI 管理 MCP 配置(对齐 Codex CLI 风格):
91
+
92
+ ```bash
93
+ # 列出 MCP servers
94
+ memo mcp list
95
+
96
+ # 添加本地 MCP server(stdio)
97
+ memo mcp add local_tools -- /path/to/mcp-server --flag
98
+
99
+ # 添加远程 MCP server(streamable HTTP)
100
+ memo mcp add remote --url https://your-mcp-server.com/mcp --bearer-token-env-var MCP_TOKEN
101
+
102
+ # 查看/删除
103
+ memo mcp get remote
104
+ memo mcp remove remote
105
+ ```
106
+
107
+ ## 内置工具
108
+
109
+ - `bash`:执行 shell 命令
110
+ - `read`:读取文件
111
+ - `write`:写入文件
112
+ - `edit`:编辑文件
113
+ - `glob`:搜索文件(模式匹配)
114
+ - `grep`:搜索内容(正则匹配)
115
+ - `webfetch`:获取网页
116
+ - `save_memory`:保存长期记忆
117
+ - `todo`:管理任务列表
118
+
119
+ 通过 MCP 协议可扩展更多工具。
120
+
121
+ ## 工具审批系统
122
+
123
+ 新增工具审批机制,保护用户免受危险操作影响:
124
+
125
+ - **自动审批**:安全工具(read、glob、grep等)自动通过
126
+ - **手动审批**:危险工具(bash、write、edit等)需要用户确认
127
+ - **审批选项**:
128
+ - `once`:仅批准当前操作
129
+ - `session`:批准本次会话中的所有同类操作
130
+ - `deny`:拒绝操作
131
+ - **危险模式**:`--dangerous` 参数跳过所有审批(仅限信任场景)
132
+
133
+ ## 会话历史
134
+
135
+ 所有会话自动保存到 `~/.memo/sessions/`,按日期分层组织:
136
+
137
+ ```
138
+ ~/.memo/sessions/
139
+ └── 2026/
140
+ └── 02/
141
+ └── 08/
142
+ ├── rollout-2026-02-08T02-21-18-abc123.jsonl
143
+ └── rollout-2026-02-08T02-42-09-def456.jsonl
144
+ ```
145
+
146
+ JSONL 格式便于分析和调试。
147
+
148
+ ## 开发
149
+
150
+ ### 本地运行
151
+
152
+ ```bash
153
+ pnpm install
154
+ pnpm start
155
+ ```
156
+
157
+ ### 构建
158
+
159
+ ```bash
160
+ pnpm run build # 生成 dist/index.js
161
+ ```
162
+
163
+ ### 测试
164
+
165
+ ```bash
166
+ pnpm test # 全量测试
167
+ pnpm test packages/core # 测试 core 包
168
+ pnpm test packages/tools # 测试 tools 包
169
+ ```
170
+
171
+ ### 代码格式化
172
+
173
+ ```bash
174
+ npm run format # 格式化所有文件
175
+ npm run format:check # 检查格式(CI)
176
+ ```
177
+
178
+ ## 项目结构
179
+
180
+ ```
181
+ memo-cli/
182
+ ├── packages/
183
+ │ ├── core/ # 核心逻辑:Session、工具路由、配置
184
+ │ ├── tools/ # 内置工具实现
185
+ │ └── cli/ # TUI 界面
186
+ ├── docs/ # 技术文档
187
+ └── dist/ # 构建输出
188
+ ```
189
+
190
+ ## CLI 快捷键与命令
191
+
192
+ - `/help`:显示帮助与快捷键说明。
193
+ - `/models`:列出现有 Provider/Model,回车切换;支持直接 `/models deepseek` 精确选择。
194
+ - `/context`:弹出 80k/120k/150k/200k 选项并立即设置上限。
195
+ - `$ <cmd>`:在当前工作目录本地执行 shell 命令,直接显示输出(`Shell Result`)。
196
+ - `resume` 历史:输入 `resume` 查看并加载本目录的历史会话。
197
+ - 退出与清屏:`exit` / `/exit`,`Ctrl+L` 新会话,`Esc Esc` 取消运行或清空输入。
198
+ - **工具审批**:危险操作会弹出审批对话框,可选择 `once`/`session`/`deny`。
199
+
200
+ > 仅当会话包含用户消息时才写入 `sessions/` JSONL 日志,避免空会话文件。
201
+
202
+ ## 技术栈
203
+
204
+ - **Runtime**: Node.js 18+
205
+ - **语言**: TypeScript
206
+ - **UI**: React + Ink
207
+ - **Protocol**: MCP (Model Context Protocol)
208
+ - **Token 计数**: tiktoken
209
+
210
+ ## 相关文档
211
+
212
+ - [用户指南](./docs/user/README.md) - 面向使用者的分模块说明
213
+ - [Core 架构](./docs/core.md) - 核心实现详解
214
+ - [CLI 适配更新](./docs/cli-update.md) - Tool Use API 迁移说明
215
+ - [开发指南](./CONTRIBUTING.md) - 贡献指南
216
+ - [项目约定](./AGENTS.md) - 代码规范和开发流程
217
+
218
+ ## License
219
+
220
+ MIT