nexforge-cli 0.1.0__tar.gz
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.
- nexforge_cli-0.1.0/.gitignore +29 -0
- nexforge_cli-0.1.0/= +0 -0
- nexforge_cli-0.1.0/PKG-INFO +168 -0
- nexforge_cli-0.1.0/PyPI-Recovery-Codes-NexTech_2026-2026-07-11T08_45_53.599616.txt +8 -0
- nexforge_cli-0.1.0/README.md +129 -0
- nexforge_cli-0.1.0/assets/icons/agent.svg +13 -0
- nexforge_cli-0.1.0/assets/icons/cost.svg +5 -0
- nexforge_cli-0.1.0/assets/icons/edit.svg +4 -0
- nexforge_cli-0.1.0/assets/icons/err.svg +5 -0
- nexforge_cli-0.1.0/assets/icons/file.svg +5 -0
- nexforge_cli-0.1.0/assets/icons/model.svg +7 -0
- nexforge_cli-0.1.0/assets/icons/ok.svg +4 -0
- nexforge_cli-0.1.0/assets/icons/read.svg +8 -0
- nexforge_cli-0.1.0/assets/icons/running.svg +5 -0
- nexforge_cli-0.1.0/assets/icons/search.svg +5 -0
- nexforge_cli-0.1.0/assets/icons/shell.svg +5 -0
- nexforge_cli-0.1.0/assets/icons/thinking.svg +5 -0
- nexforge_cli-0.1.0/assets/icons/web.svg +6 -0
- nexforge_cli-0.1.0/assets/icons/write.svg +4 -0
- nexforge_cli-0.1.0/config.example.toml +42 -0
- nexforge_cli-0.1.0/devlog/2026-07-07.md +359 -0
- nexforge_cli-0.1.0/doc//344/274/232/350/257/235/347/256/241/347/220/206.md +54 -0
- nexforge_cli-0.1.0/doc//345/221/275/344/273/244/344/270/216/345/277/253/346/215/267/351/224/256.md +46 -0
- nexforge_cli-0.1.0/doc//345/256/211/350/243/205/344/270/216/351/205/215/347/275/256.md +109 -0
- nexforge_cli-0.1.0/doc//345/267/245/345/205/267/345/217/202/350/200/203.md +61 -0
- nexforge_cli-0.1.0/doc//346/200/273/350/247/210.md +37 -0
- nexforge_cli-0.1.0/doc//346/235/203/351/231/220/347/263/273/347/273/237.md +53 -0
- nexforge_cli-0.1.0/doc//350/256/241/345/210/222/346/250/241/345/274/217.md +49 -0
- nexforge_cli-0.1.0/doc//351/253/230/347/272/247/345/212/237/350/203/275.md +78 -0
- nexforge_cli-0.1.0/pyproject.toml +57 -0
- nexforge_cli-0.1.0/scripts/publish.sh +36 -0
- nexforge_cli-0.1.0/scripts/smoke_provider.py +56 -0
- nexforge_cli-0.1.0/scripts/smoke_tui.py +45 -0
- nexforge_cli-0.1.0/src/nexforge/__init__.py +7 -0
- nexforge_cli-0.1.0/src/nexforge/__main__.py +6 -0
- nexforge_cli-0.1.0/src/nexforge/app.py +38 -0
- nexforge_cli-0.1.0/src/nexforge/cli.py +159 -0
- nexforge_cli-0.1.0/src/nexforge/config.py +192 -0
- nexforge_cli-0.1.0/src/nexforge/core/__init__.py +1 -0
- nexforge_cli-0.1.0/src/nexforge/core/agent.py +244 -0
- nexforge_cli-0.1.0/src/nexforge/core/jobs.py +97 -0
- nexforge_cli-0.1.0/src/nexforge/core/permissions.py +73 -0
- nexforge_cli-0.1.0/src/nexforge/core/router.py +62 -0
- nexforge_cli-0.1.0/src/nexforge/core/session.py +55 -0
- nexforge_cli-0.1.0/src/nexforge/core/types.py +103 -0
- nexforge_cli-0.1.0/src/nexforge/icons.py +173 -0
- nexforge_cli-0.1.0/src/nexforge/mcp/__init__.py +168 -0
- nexforge_cli-0.1.0/src/nexforge/provider/__init__.py +1 -0
- nexforge_cli-0.1.0/src/nexforge/provider/balance.py +37 -0
- nexforge_cli-0.1.0/src/nexforge/provider/deepseek.py +204 -0
- nexforge_cli-0.1.0/src/nexforge/skills/loader.py +102 -0
- nexforge_cli-0.1.0/src/nexforge/store/__init__.py +1 -0
- nexforge_cli-0.1.0/src/nexforge/store/plan_store.py +112 -0
- nexforge_cli-0.1.0/src/nexforge/store/session_store.py +206 -0
- nexforge_cli-0.1.0/src/nexforge/theme.tcss +128 -0
- nexforge_cli-0.1.0/src/nexforge/tools/__init__.py +6 -0
- nexforge_cli-0.1.0/src/nexforge/tools/_paths.py +22 -0
- nexforge_cli-0.1.0/src/nexforge/tools/background.py +111 -0
- nexforge_cli-0.1.0/src/nexforge/tools/base.py +56 -0
- nexforge_cli-0.1.0/src/nexforge/tools/edit_file.py +73 -0
- nexforge_cli-0.1.0/src/nexforge/tools/fs_ops.py +125 -0
- nexforge_cli-0.1.0/src/nexforge/tools/git.py +89 -0
- nexforge_cli-0.1.0/src/nexforge/tools/list_dir.py +49 -0
- nexforge_cli-0.1.0/src/nexforge/tools/multi_edit.py +84 -0
- nexforge_cli-0.1.0/src/nexforge/tools/read_file.py +51 -0
- nexforge_cli-0.1.0/src/nexforge/tools/registry.py +94 -0
- nexforge_cli-0.1.0/src/nexforge/tools/search_content.py +90 -0
- nexforge_cli-0.1.0/src/nexforge/tools/search_files.py +48 -0
- nexforge_cli-0.1.0/src/nexforge/tools/shell.py +60 -0
- nexforge_cli-0.1.0/src/nexforge/tools/web.py +40 -0
- nexforge_cli-0.1.0/src/nexforge/tools/write_file.py +40 -0
- nexforge_cli-0.1.0/src/nexforge/ui/__init__.py +1 -0
- nexforge_cli-0.1.0/src/nexforge/ui/screens/__init__.py +1 -0
- nexforge_cli-0.1.0/src/nexforge/ui/screens/chat.py +825 -0
- nexforge_cli-0.1.0/src/nexforge/ui/widgets/__init__.py +1 -0
- nexforge_cli-0.1.0/src/nexforge/ui/widgets/apikey_modal.py +65 -0
- nexforge_cli-0.1.0/src/nexforge/ui/widgets/banner.py +18 -0
- nexforge_cli-0.1.0/src/nexforge/ui/widgets/confirm_modal.py +58 -0
- nexforge_cli-0.1.0/src/nexforge/ui/widgets/diff_modal.py +67 -0
- nexforge_cli-0.1.0/src/nexforge/ui/widgets/messages.py +132 -0
- nexforge_cli-0.1.0/src/nexforge/ui/widgets/mode_warning.py +57 -0
- nexforge_cli-0.1.0/src/nexforge/ui/widgets/multiline_modal.py +59 -0
- nexforge_cli-0.1.0/src/nexforge/ui/widgets/multiline_prompt.py +25 -0
- nexforge_cli-0.1.0/src/nexforge/ui/widgets/plan_sidebar.py +89 -0
- nexforge_cli-0.1.0/src/nexforge/ui/widgets/sidebar.py +99 -0
- nexforge_cli-0.1.0/src/nexforge/ui/widgets/statusbar.py +70 -0
- nexforge_cli-0.1.0/src/nexforge/web/__init__.py +0 -0
- nexforge_cli-0.1.0/src/nexforge/web/server.py +177 -0
- nexforge_cli-0.1.0/src/nexforge/web/static/index.html +123 -0
- nexforge_cli-0.1.0/tests/test_approval.py +59 -0
- nexforge_cli-0.1.0/tests/test_config.py +84 -0
- nexforge_cli-0.1.0/tests/test_icons.py +59 -0
- nexforge_cli-0.1.0/tests/test_m2_tools.py +107 -0
- nexforge_cli-0.1.0/tests/test_sidebar.py +39 -0
- nexforge_cli-0.1.0/tests/test_sidebar_actions.py +49 -0
- nexforge_cli-0.1.0/tests/test_tools.py +76 -0
- nexforge_cli-0.1.0/tests/test_tui.py +50 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.egg-info/
|
|
5
|
+
build/
|
|
6
|
+
dist/
|
|
7
|
+
.eggs/
|
|
8
|
+
|
|
9
|
+
# venv
|
|
10
|
+
.venv/
|
|
11
|
+
venv/
|
|
12
|
+
env/
|
|
13
|
+
|
|
14
|
+
# 测试 / 缓存
|
|
15
|
+
.pytest_cache/
|
|
16
|
+
.mypy_cache/
|
|
17
|
+
.ruff_cache/
|
|
18
|
+
|
|
19
|
+
# 会话与本地配置(不入库)
|
|
20
|
+
.nexforge/
|
|
21
|
+
*.jsonl
|
|
22
|
+
|
|
23
|
+
# 生成的图标位图
|
|
24
|
+
assets/icons/*.png
|
|
25
|
+
|
|
26
|
+
# IDE / OS
|
|
27
|
+
.idea/
|
|
28
|
+
.vscode/
|
|
29
|
+
.DS_Store
|
nexforge_cli-0.1.0/=
ADDED
|
File without changes
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nexforge-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: NexForgeCLI — 一个面向 DeepSeek V4 的终端智能体(TUI + CLI 双模式)
|
|
5
|
+
Project-URL: Homepage, https://gitee.com/Lighthorn/nexforgecli
|
|
6
|
+
Author: NexForge
|
|
7
|
+
License: MIT
|
|
8
|
+
Keywords: agent,cli,deepseek,textual,tui
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Environment :: Console
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
20
|
+
Classifier: Topic :: Terminals
|
|
21
|
+
Requires-Python: >=3.11
|
|
22
|
+
Requires-Dist: httpx>=0.27
|
|
23
|
+
Requires-Dist: openai>=1.40
|
|
24
|
+
Requires-Dist: pydantic>=2.6
|
|
25
|
+
Requires-Dist: rich>=13.7
|
|
26
|
+
Requires-Dist: textual>=0.60
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: build>=1.2; extra == 'dev'
|
|
29
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
|
|
30
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
31
|
+
Requires-Dist: twine>=5.0; extra == 'dev'
|
|
32
|
+
Provides-Extra: images
|
|
33
|
+
Requires-Dist: cairosvg>=2.7; extra == 'images'
|
|
34
|
+
Requires-Dist: pillow>=10.0; extra == 'images'
|
|
35
|
+
Requires-Dist: term-image>=0.7; extra == 'images'
|
|
36
|
+
Provides-Extra: mcp
|
|
37
|
+
Requires-Dist: mcp>=1.0; extra == 'mcp'
|
|
38
|
+
Description-Content-Type: text/markdown
|
|
39
|
+
|
|
40
|
+
<div align="center">
|
|
41
|
+
|
|
42
|
+
# ◆ NexForgeCLI
|
|
43
|
+
|
|
44
|
+
**面向 DeepSeek V4 的终端智能体 · TUI + CLI 双模式**
|
|
45
|
+
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
NexForgeCLI 是一个运行在终端里的智能体助手,专为 **DeepSeek V4**(`deepseek-v4-flash` / `deepseek-v4-pro`)打造。既能作为全屏 TUI 交互式对话/编码,也能作为 one-shot 命令行工具嵌进脚本和管道。
|
|
49
|
+
|
|
50
|
+
> 状态:**M1 走通骨架**(真实 API 接入 + Textual TUI + 核心工具循环)。M2+ 见下方路线图。
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## ✨ 特性
|
|
55
|
+
|
|
56
|
+
- **DeepSeek V4 原生接入** —— flash / pro 双模型,思考模式(`reasoning_content` 独立面板)、上下文缓存计费、真实用量与费用统计。
|
|
57
|
+
- **三档模型选择** —— `flash`(快)、`pro`(强)、`auto`(客户端智能路由:默认 flash,命中信号自动升 pro + 思考)。
|
|
58
|
+
- **智能体循环** —— 函数调用(function calling),自动读写文件、执行命令,直到任务完成。
|
|
59
|
+
- **美化 TUI** —— Textual 驱动:品牌横幅、流式 Markdown、可折叠思考面板、工具调用卡片、状态栏(档位/上下文/费用)。
|
|
60
|
+
- **SVG 图标系统** —— 以 SVG 为唯一源,按终端能力分级渲染(Kitty/iTerm2/Sixel 真图 → Nerd/Unicode 字形 → ASCII 兜底)。
|
|
61
|
+
- **双运行模式** —— 全屏交互 or 管道式 one-shot,同一套核心。
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## 📦 安装
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# 一键安装(推荐)
|
|
69
|
+
pip install git+https://gitee.com/Lighthorn/nexforgecli.git
|
|
70
|
+
|
|
71
|
+
# 或本地开发安装
|
|
72
|
+
git clone https://gitee.com/Lighthorn/nexforgecli.git
|
|
73
|
+
cd NexForgeCLI && pip install -e .
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
设置 API Key:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
export DEEPSEEK_API_KEY="sk-..." # Windows: setx DEEPSEEK_API_KEY sk-...
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## 🚀 使用
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# 全屏 TUI(默认)
|
|
88
|
+
nexforge
|
|
89
|
+
|
|
90
|
+
# one-shot:回答后退出
|
|
91
|
+
nexforge -p "这个项目是做什么的?"
|
|
92
|
+
|
|
93
|
+
# 管道输入
|
|
94
|
+
git diff | nexforge -p "帮我写一条 commit message"
|
|
95
|
+
|
|
96
|
+
# 指定档位 / 关思考
|
|
97
|
+
nexforge --model pro
|
|
98
|
+
nexforge --no-think -p "列出当前目录"
|
|
99
|
+
|
|
100
|
+
# 查看当前配置
|
|
101
|
+
nexforge --config
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### TUI 内斜杠命令
|
|
105
|
+
|
|
106
|
+
| 命令 | 作用 |
|
|
107
|
+
|---|---|
|
|
108
|
+
| `/help` | 帮助 |
|
|
109
|
+
| `/model flash\|pro\|auto` | 切换模型档位 |
|
|
110
|
+
| `/think on\|off` | 开关思考模式 |
|
|
111
|
+
| `/cost` | 累计费用 |
|
|
112
|
+
| `/clear` | 清空会话 |
|
|
113
|
+
| `/quit` | 退出 |
|
|
114
|
+
|
|
115
|
+
快捷键:`Ctrl+C` 退出 · `Ctrl+L` 清屏
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## ⚙️ 配置
|
|
120
|
+
|
|
121
|
+
默认值内置(真实 V4 参数),可在 `~/.nexforge/config.toml` 覆盖。参考 [`config.example.toml`](config.example.toml)。
|
|
122
|
+
|
|
123
|
+
| 档位 | 模型 | 说明 |
|
|
124
|
+
|---|---|---|
|
|
125
|
+
| `flash` | deepseek-v4-flash | 低延迟低成本 |
|
|
126
|
+
| `pro` | deepseek-v4-pro | 复杂推理/大重构 |
|
|
127
|
+
| `auto` | 客户端路由 | 默认 flash,命中关键词/大上下文/多次失败 → 升 pro |
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## 🧱 架构
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
cli.py ─┬─ app.py (Textual TUI) ── ui/ (screens, widgets)
|
|
135
|
+
└─ core/agent.py (AgentLoop 事件流)
|
|
136
|
+
├─ provider/deepseek.py (V4 流式/思考/工具/缓存)
|
|
137
|
+
├─ core/router.py (auto 路由)
|
|
138
|
+
├─ core/session.py (消息 + reasoning 回传规则)
|
|
139
|
+
└─ tools/ (read/list/edit/shell + Registry)
|
|
140
|
+
icons.py + assets/icons/*.svg (图标能力分级)
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## 🗺️ 路线图
|
|
146
|
+
|
|
147
|
+
- [x] **M1 骨架** —— 真 V4 接入、TUI、核心工具循环、双模式
|
|
148
|
+
- [ ] **M2 工具齐全 + 通用 skill** —— 完整工具集、审批门 diff、MCP 客户端、SKILL.md 技能加载
|
|
149
|
+
- [ ] **M3 美化** —— 图标真图渲染、diff 视图、主题切换
|
|
150
|
+
- [ ] **M4 实用化** —— 会话持久化/恢复、上下文压缩、费用总账、`nexforge login`
|
|
151
|
+
- [ ] **M5 发布** —— PyInstaller 单文件 + pipx + brew/scoop、PyPI
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## 🧪 开发
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
pip install -e ".[dev]"
|
|
159
|
+
python -m pytest -q # 单元测试(不触网)
|
|
160
|
+
python scripts/smoke_provider.py flash think # 真实 API 冒烟
|
|
161
|
+
python scripts/smoke_tui.py # TUI 端到端冒烟
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## 📄 License
|
|
167
|
+
|
|
168
|
+
MIT
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# ◆ NexForgeCLI
|
|
4
|
+
|
|
5
|
+
**面向 DeepSeek V4 的终端智能体 · TUI + CLI 双模式**
|
|
6
|
+
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
NexForgeCLI 是一个运行在终端里的智能体助手,专为 **DeepSeek V4**(`deepseek-v4-flash` / `deepseek-v4-pro`)打造。既能作为全屏 TUI 交互式对话/编码,也能作为 one-shot 命令行工具嵌进脚本和管道。
|
|
10
|
+
|
|
11
|
+
> 状态:**M1 走通骨架**(真实 API 接入 + Textual TUI + 核心工具循环)。M2+ 见下方路线图。
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## ✨ 特性
|
|
16
|
+
|
|
17
|
+
- **DeepSeek V4 原生接入** —— flash / pro 双模型,思考模式(`reasoning_content` 独立面板)、上下文缓存计费、真实用量与费用统计。
|
|
18
|
+
- **三档模型选择** —— `flash`(快)、`pro`(强)、`auto`(客户端智能路由:默认 flash,命中信号自动升 pro + 思考)。
|
|
19
|
+
- **智能体循环** —— 函数调用(function calling),自动读写文件、执行命令,直到任务完成。
|
|
20
|
+
- **美化 TUI** —— Textual 驱动:品牌横幅、流式 Markdown、可折叠思考面板、工具调用卡片、状态栏(档位/上下文/费用)。
|
|
21
|
+
- **SVG 图标系统** —— 以 SVG 为唯一源,按终端能力分级渲染(Kitty/iTerm2/Sixel 真图 → Nerd/Unicode 字形 → ASCII 兜底)。
|
|
22
|
+
- **双运行模式** —— 全屏交互 or 管道式 one-shot,同一套核心。
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## 📦 安装
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# 一键安装(推荐)
|
|
30
|
+
pip install git+https://gitee.com/Lighthorn/nexforgecli.git
|
|
31
|
+
|
|
32
|
+
# 或本地开发安装
|
|
33
|
+
git clone https://gitee.com/Lighthorn/nexforgecli.git
|
|
34
|
+
cd NexForgeCLI && pip install -e .
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
设置 API Key:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
export DEEPSEEK_API_KEY="sk-..." # Windows: setx DEEPSEEK_API_KEY sk-...
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 🚀 使用
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# 全屏 TUI(默认)
|
|
49
|
+
nexforge
|
|
50
|
+
|
|
51
|
+
# one-shot:回答后退出
|
|
52
|
+
nexforge -p "这个项目是做什么的?"
|
|
53
|
+
|
|
54
|
+
# 管道输入
|
|
55
|
+
git diff | nexforge -p "帮我写一条 commit message"
|
|
56
|
+
|
|
57
|
+
# 指定档位 / 关思考
|
|
58
|
+
nexforge --model pro
|
|
59
|
+
nexforge --no-think -p "列出当前目录"
|
|
60
|
+
|
|
61
|
+
# 查看当前配置
|
|
62
|
+
nexforge --config
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### TUI 内斜杠命令
|
|
66
|
+
|
|
67
|
+
| 命令 | 作用 |
|
|
68
|
+
|---|---|
|
|
69
|
+
| `/help` | 帮助 |
|
|
70
|
+
| `/model flash\|pro\|auto` | 切换模型档位 |
|
|
71
|
+
| `/think on\|off` | 开关思考模式 |
|
|
72
|
+
| `/cost` | 累计费用 |
|
|
73
|
+
| `/clear` | 清空会话 |
|
|
74
|
+
| `/quit` | 退出 |
|
|
75
|
+
|
|
76
|
+
快捷键:`Ctrl+C` 退出 · `Ctrl+L` 清屏
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## ⚙️ 配置
|
|
81
|
+
|
|
82
|
+
默认值内置(真实 V4 参数),可在 `~/.nexforge/config.toml` 覆盖。参考 [`config.example.toml`](config.example.toml)。
|
|
83
|
+
|
|
84
|
+
| 档位 | 模型 | 说明 |
|
|
85
|
+
|---|---|---|
|
|
86
|
+
| `flash` | deepseek-v4-flash | 低延迟低成本 |
|
|
87
|
+
| `pro` | deepseek-v4-pro | 复杂推理/大重构 |
|
|
88
|
+
| `auto` | 客户端路由 | 默认 flash,命中关键词/大上下文/多次失败 → 升 pro |
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## 🧱 架构
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
cli.py ─┬─ app.py (Textual TUI) ── ui/ (screens, widgets)
|
|
96
|
+
└─ core/agent.py (AgentLoop 事件流)
|
|
97
|
+
├─ provider/deepseek.py (V4 流式/思考/工具/缓存)
|
|
98
|
+
├─ core/router.py (auto 路由)
|
|
99
|
+
├─ core/session.py (消息 + reasoning 回传规则)
|
|
100
|
+
└─ tools/ (read/list/edit/shell + Registry)
|
|
101
|
+
icons.py + assets/icons/*.svg (图标能力分级)
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## 🗺️ 路线图
|
|
107
|
+
|
|
108
|
+
- [x] **M1 骨架** —— 真 V4 接入、TUI、核心工具循环、双模式
|
|
109
|
+
- [ ] **M2 工具齐全 + 通用 skill** —— 完整工具集、审批门 diff、MCP 客户端、SKILL.md 技能加载
|
|
110
|
+
- [ ] **M3 美化** —— 图标真图渲染、diff 视图、主题切换
|
|
111
|
+
- [ ] **M4 实用化** —— 会话持久化/恢复、上下文压缩、费用总账、`nexforge login`
|
|
112
|
+
- [ ] **M5 发布** —— PyInstaller 单文件 + pipx + brew/scoop、PyPI
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## 🧪 开发
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
pip install -e ".[dev]"
|
|
120
|
+
python -m pytest -q # 单元测试(不触网)
|
|
121
|
+
python scripts/smoke_provider.py flash think # 真实 API 冒烟
|
|
122
|
+
python scripts/smoke_tui.py # TUI 端到端冒烟
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## 📄 License
|
|
128
|
+
|
|
129
|
+
MIT
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" fill="none">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="nf" x1="0" y1="0" x2="32" y2="32" gradientUnits="userSpaceOnUse">
|
|
4
|
+
<stop stop-color="#6D5EF5"/>
|
|
5
|
+
<stop offset="1" stop-color="#22D3EE"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
</defs>
|
|
8
|
+
<!-- NexForge 铁砧 / 分叉标记 -->
|
|
9
|
+
<path d="M16 3 4 9v8c0 6.5 5.1 10.7 12 12 6.9-1.3 12-5.5 12-12V9L16 3z"
|
|
10
|
+
stroke="url(#nf)" stroke-width="2" stroke-linejoin="round"/>
|
|
11
|
+
<path d="M11 15h10M16 11v10M11 15l-2 3M21 15l2 3" stroke="url(#nf)"
|
|
12
|
+
stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
13
|
+
</svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#6D5EF5" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
2
|
+
<!-- file / generic document -->
|
|
3
|
+
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>
|
|
4
|
+
<polyline points="14,2 14,8 20,8"/>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#6D5EF5" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
2
|
+
<!-- model / diamond with AI dots -->
|
|
3
|
+
<rect x="4" y="4" width="16" height="16" rx="2" transform="rotate(45 12 12)"/>
|
|
4
|
+
<circle cx="10" cy="10" r="1.5" fill="#22D3EE" stroke="none"/>
|
|
5
|
+
<circle cx="14" cy="10" r="1.5" fill="#22D3EE" stroke="none"/>
|
|
6
|
+
<circle cx="12" cy="14" r="1.5" fill="#22D3EE" stroke="none"/>
|
|
7
|
+
</svg>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#6D5EF5" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
2
|
+
<!-- read_file / document -->
|
|
3
|
+
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>
|
|
4
|
+
<polyline points="14,2 14,8 20,8"/>
|
|
5
|
+
<line x1="16" y1="13" x2="8" y2="13"/>
|
|
6
|
+
<line x1="16" y1="17" x2="8" y2="17"/>
|
|
7
|
+
<polyline points="10,9 9,9 8,9"/>
|
|
8
|
+
</svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#6D5EF5" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
2
|
+
<!-- running / spinner dot + arc -->
|
|
3
|
+
<circle cx="12" cy="12" r="10"/>
|
|
4
|
+
<path stroke="#22D3EE" d="M12 2a10 10 0 0 1 10 10"/>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#6D5EF5" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
2
|
+
<!-- search / magnifying glass -->
|
|
3
|
+
<circle cx="11" cy="11" r="8"/>
|
|
4
|
+
<line x1="21" y1="21" x2="16.65" y2="16.65"/>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#6D5EF5" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
2
|
+
<!-- shell / terminal / >_ -->
|
|
3
|
+
<polyline points="4,17 10,11 4,5"/>
|
|
4
|
+
<line x1="12" y1="19" x2="20" y2="19"/>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#6D5EF5" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
2
|
+
<!-- thinking / brain -->
|
|
3
|
+
<path d="M12 2a5 5 0 0 0-5 5c0 1.2.4 2.3 1 3.2L5 21h14l-3-10.8a5 5 0 0 0-4-8.2z"/>
|
|
4
|
+
<path d="M9 13h6M10 17h4" stroke="#22D3EE"/>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#22D3EE" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
2
|
+
<!-- web / globe -->
|
|
3
|
+
<circle cx="12" cy="12" r="10"/>
|
|
4
|
+
<line x1="2" y1="12" x2="22" y2="12"/>
|
|
5
|
+
<path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/>
|
|
6
|
+
</svg>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# NexForgeCLI 配置示例。
|
|
2
|
+
# 复制到 ~/.nexforge/config.toml 后按需修改;所有字段都有内置默认值,可只写要覆盖的项。
|
|
3
|
+
# DeepSeek V4 参数已核实自 api-docs.deepseek.com(2026-04)。
|
|
4
|
+
|
|
5
|
+
[provider]
|
|
6
|
+
base_url = "https://api.deepseek.com" # OpenAI 格式;Anthropic 格式加 /anthropic
|
|
7
|
+
api_key_env = "DEEPSEEK_API_KEY" # 优先从此环境变量读 key
|
|
8
|
+
# api_key = "sk-..." # 次选:直接写这里(不建议入库)
|
|
9
|
+
timeout = 120.0
|
|
10
|
+
max_retries = 2
|
|
11
|
+
|
|
12
|
+
[models]
|
|
13
|
+
flash = "deepseek-v4-flash"
|
|
14
|
+
pro = "deepseek-v4-pro"
|
|
15
|
+
default_tier = "auto" # flash | pro | auto
|
|
16
|
+
thinking = true # 思考模式,默认开
|
|
17
|
+
reasoning_effort = "high" # high | max
|
|
18
|
+
max_output_tokens = 8192 # 上限 384K
|
|
19
|
+
|
|
20
|
+
# 定价(每百万 token,USD)—— 已核实
|
|
21
|
+
[models.pricing.flash]
|
|
22
|
+
input_cache_hit = 0.0028
|
|
23
|
+
input_cache_miss = 0.14
|
|
24
|
+
output = 0.28
|
|
25
|
+
|
|
26
|
+
[models.pricing.pro]
|
|
27
|
+
input_cache_hit = 0.003625
|
|
28
|
+
input_cache_miss = 0.435
|
|
29
|
+
output = 0.87
|
|
30
|
+
|
|
31
|
+
[router] # auto 档位的客户端路由
|
|
32
|
+
entry = "flash" # auto 默认从 flash 起步
|
|
33
|
+
escalate_to = "pro"
|
|
34
|
+
escalate_on_tool_failures = 2
|
|
35
|
+
escalate_context_tokens = 200000
|
|
36
|
+
|
|
37
|
+
[ui]
|
|
38
|
+
theme = "dark" # dark | light
|
|
39
|
+
show_thinking = true
|
|
40
|
+
icons = "auto" # auto | image | glyph | ascii
|
|
41
|
+
accent = "#6D5EF5"
|
|
42
|
+
accent2 = "#22D3EE"
|