@kkelly-offical/kkcode 0.1.3 → 0.1.6

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.
Files changed (58) hide show
  1. package/README.md +110 -172
  2. package/package.json +46 -46
  3. package/src/agent/agent.mjs +41 -0
  4. package/src/agent/prompt/frontend-designer.txt +58 -0
  5. package/src/agent/prompt/longagent-blueprint-agent.txt +83 -0
  6. package/src/agent/prompt/longagent-coding-agent.txt +37 -0
  7. package/src/agent/prompt/longagent-debugging-agent.txt +46 -0
  8. package/src/agent/prompt/longagent-preview-agent.txt +63 -0
  9. package/src/config/defaults.mjs +260 -195
  10. package/src/config/schema.mjs +71 -6
  11. package/src/core/constants.mjs +91 -46
  12. package/src/index.mjs +1 -1
  13. package/src/knowledge/frontend-aesthetics.txt +39 -0
  14. package/src/knowledge/loader.mjs +2 -1
  15. package/src/knowledge/tailwind.txt +12 -3
  16. package/src/mcp/client-http.mjs +141 -157
  17. package/src/mcp/client-sse.mjs +288 -286
  18. package/src/mcp/client-stdio.mjs +533 -451
  19. package/src/mcp/constants.mjs +2 -0
  20. package/src/mcp/registry.mjs +479 -394
  21. package/src/mcp/stdio-framing.mjs +133 -127
  22. package/src/mcp/tool-result.mjs +24 -0
  23. package/src/observability/index.mjs +42 -0
  24. package/src/observability/metrics.mjs +137 -0
  25. package/src/observability/tracer.mjs +137 -0
  26. package/src/orchestration/background-manager.mjs +372 -358
  27. package/src/orchestration/background-worker.mjs +305 -245
  28. package/src/orchestration/longagent-manager.mjs +171 -116
  29. package/src/orchestration/stage-scheduler.mjs +728 -489
  30. package/src/permission/exec-policy.mjs +9 -11
  31. package/src/provider/anthropic.mjs +1 -0
  32. package/src/provider/openai.mjs +340 -339
  33. package/src/provider/retry-policy.mjs +68 -68
  34. package/src/provider/router.mjs +241 -228
  35. package/src/provider/sse.mjs +104 -91
  36. package/src/repl.mjs +1 -1
  37. package/src/session/checkpoint.mjs +66 -3
  38. package/src/session/engine.mjs +227 -225
  39. package/src/session/longagent-4stage.mjs +460 -0
  40. package/src/session/longagent-hybrid.mjs +1081 -0
  41. package/src/session/longagent-plan.mjs +365 -329
  42. package/src/session/longagent-project-memory.mjs +53 -0
  43. package/src/session/longagent-scaffold.mjs +291 -100
  44. package/src/session/longagent-task-bus.mjs +54 -0
  45. package/src/session/longagent-utils.mjs +472 -0
  46. package/src/session/longagent.mjs +884 -1462
  47. package/src/session/project-context.mjs +30 -0
  48. package/src/session/store.mjs +510 -503
  49. package/src/session/task-validator.mjs +4 -3
  50. package/src/skill/builtin/design.mjs +76 -0
  51. package/src/skill/builtin/frontend.mjs +8 -0
  52. package/src/skill/registry.mjs +390 -336
  53. package/src/storage/ghost-commit-store.mjs +18 -8
  54. package/src/tool/executor.mjs +11 -0
  55. package/src/tool/git-auto.mjs +0 -19
  56. package/src/tool/registry.mjs +71 -37
  57. package/src/ui/activity-renderer.mjs +664 -410
  58. package/src/util/git.mjs +23 -0
package/README.md CHANGED
@@ -4,45 +4,38 @@
4
4
  ![Node](https://img.shields.io/badge/Node.js-%3E%3D22-green)
5
5
  ![License](https://img.shields.io/badge/License-GPL--3.0-blue)
6
6
  ![Platform](https://img.shields.io/badge/Platform-Windows%20%7C%20macOS%20%7C%20Linux-lightgrey)
7
+ ![Models](https://img.shields.io/badge/Models-Qwen%20%7C%20GLM%20%7C%20DeepSeek%20%7C%20Claude%20%7C%20GPT%20%7C%20Ollama-orange)
7
8
 
8
- 面向团队协作的终端 AI Coding Agent:兼顾 **可执行**(工具链 + 子任务)、**可治理**(权限 / 审计 / 预算)、**可长跑**(LongAgent 阶段并行编排)。
9
+ 面向团队协作的终端 AI Coding Agent
10
+
11
+ **可执行** — 内置 16+ 工具链,子智能体委派,主动规划与审批。
12
+ **可治理** — 三级权限策略,会话审计,Token 预算控制。
13
+ **可长跑** — LongAgent 阶段并行编排,自动重试与门禁闭环。
14
+ **多模型** — 原生支持 Qwen3.5、GLM-5、DeepSeek、Claude、GPT、Ollama 本地模型。
9
15
 
10
16
  ---
11
17
 
12
18
  ## 目录
13
19
 
14
- - [kkcode](#kkcode)
15
- - [目录](#目录)
16
- - [快速开始](#快速开始)
17
- - [环境要求](#环境要求)
18
- - [安装与运行](#安装与运行)
19
- - [初始化项目配置](#初始化项目配置)
20
- - [模式系统](#模式系统)
21
- - [LongAgent 编排](#longagent-编排)
22
- - [主流程](#主流程)
23
- - [并行与一致性](#并行与一致性)
24
- - [主动规划](#主动规划)
25
- - [权限系统](#权限系统)
26
- - [内置工具](#内置工具)
27
- - [子智能体](#子智能体)
28
- - [Auto Memory](#auto-memory)
29
- - [MCP 接入](#mcp-接入)
30
- - [GitHub 集成](#github-集成)
31
- - [登录 GitHub](#登录-github)
32
- - [登出 GitHub](#登出-github)
33
- - [工作流程](#工作流程)
34
- - [完成工作后推送](#完成工作后推送)
35
- - [扩展机制](#扩展机制)
36
- - [会话与审计](#会话与审计)
37
- - [TUI 交互](#tui-交互)
38
- - [状态栏](#状态栏)
39
- - [快捷键](#快捷键)
40
- - [常用 Slash 命令](#常用-slash-命令)
41
- - [项目结构](#项目结构)
42
- - [配置示例](#配置示例)
43
- - [常见问题](#常见问题)
44
- - [致谢](#致谢)
45
- - [License](#license)
20
+ - [快速开始](#快速开始)
21
+ - [支持的模型](#支持的模型)
22
+ - [模式系统](#模式系统)
23
+ - [LongAgent 编排](#longagent-编排)
24
+ - [主动规划](#主动规划)
25
+ - [权限系统](#权限系统)
26
+ - [内置工具](#内置工具)
27
+ - [子智能体](#子智能体)
28
+ - [Auto Memory](#auto-memory)
29
+ - [MCP 接入](#mcp-接入)
30
+ - [GitHub 集成](#github-集成)
31
+ - [扩展机制](#扩展机制)
32
+ - [会话与审计](#会话与审计)
33
+ - [TUI 交互](#tui-交互)
34
+ - [项目结构](#项目结构)
35
+ - [配置](#配置)
36
+ - [常见问题](#常见问题)
37
+ - [致谢](#致谢)
38
+ - [License](#license)
46
39
 
47
40
  ---
48
41
 
@@ -85,6 +78,24 @@ kkcode init -y
85
78
 
86
79
  ---
87
80
 
81
+ ## 支持的模型
82
+
83
+ kkcode 通过统一的 Provider 抽象层支持多种模型,开箱即用:
84
+
85
+ | 提供商 | 模型 | 类型 | 配置样例 |
86
+ |--------|------|------|----------|
87
+ | 阿里 DashScope | Qwen3.5-Plus、Qwen3-Max、Qwen3-Coder | `openai-compatible` | [`config-qwen3.5.yaml`](configs/config-qwen3.5.yaml) |
88
+ | 智谱 AI | GLM-5、GLM-4.5 | `openai-compatible` | [`config-glm5.yaml`](configs/config-glm5.yaml) |
89
+ | DeepSeek | DeepSeek-Chat (V3)、DeepSeek-Reasoner (R1) | `openai-compatible` | [`config-deepseek.yaml`](configs/config-deepseek.yaml) |
90
+ | Anthropic | Claude Opus 4.6、Sonnet 4.6 | `anthropic` | [`config.example.yaml`](docs/config.example.yaml) |
91
+ | OpenAI | GPT-5.3-Codex、GPT-5.2 | `openai` | [`config.example.yaml`](docs/config.example.yaml) |
92
+ | Ollama | Qwen3、DeepSeek-Coder、LLaMA 等本地模型 | `ollama` | [`config-ollama.yaml`](configs/config-ollama.yaml) |
93
+ | 任意 OpenAI 兼容 API | Kimi、Yi、Moonshot 等 | `openai-compatible` | [`config-multi-provider.yaml`](configs/config-multi-provider.yaml) |
94
+
95
+ 切换模型只需修改配置文件中的 `provider.default`,或在 TUI 中使用 `/provider` 和 `/model` 命令。
96
+
97
+ ---
98
+
88
99
  ## 模式系统
89
100
 
90
101
  | 模式 | 目标 | 工具权限 | 典型场景 |
@@ -100,35 +111,39 @@ TUI 中按 `Tab` 一键轮换模式。
100
111
 
101
112
  ## LongAgent 编排
102
113
 
103
- LongAgent 是 kkcode 的核心差异能力,支持"意图识别 + 阶段并行 + 门禁闭环"。
114
+ LongAgent 是 kkcode 的核心差异能力,支持两种编排模式:
115
+
116
+ **Hybrid 模式**(默认)— 7 阶段流水线:
117
+
118
+ ```
119
+ Intake → Preview → Blueprint → Git分支 → Scaffold+并行编码 → Debugging → 门禁验证 → Git合并
120
+ ```
104
121
 
105
- ### 主流程
122
+ **4-Stage 模式** — 4 阶段顺序执行:
106
123
 
107
- 1. **意图识别** — 非编码目标直接阻断,避免空转
108
- 2. **Intake** 多轮澄清并生成摘要
109
- 3. **Plan Frozen** — 冻结阶段计划(StagePlan)
110
- 4. **Stage Barrier** — 同阶段任务并发执行,全部终态后推进
111
- 5. **Recovery** — 失败任务重试,优先续写 remaining files
112
- 6. **Usability Gates** — build / test / review / health / budget 全量校验
113
- 7. **完成判定** — 门禁通过 + 完成标记
124
+ ```
125
+ Preview(只读) Blueprint(只读) → Coding(写入) → Debugging(写入)
126
+ ```
114
127
 
115
- ### 并行与一致性
128
+ ### 关键机制
116
129
 
117
- - 同阶段并发由 `max_concurrency` 控制
118
- - 子任务由后台 worker 承载,主会话等待 barrier
119
- - 写入工具支持 file lock,避免并发冲突
120
- - TUI 实时显示阶段状态、进度条与文件变动摘要
130
+ - **阶段并行** — 同阶段任务由独立 worker 并发执行,`max_concurrency` 控制并发数
131
+ - **文件隔离** 每个文件仅归属一个 task,plan 阶段即检测冲突
132
+ - **自动重试** 失败任务自动重试,优先续写未完成文件
133
+ - **门禁闭环** — build / test / review / health / budget 五项质量门禁
134
+ - **Git 集成** — 自动创建特性分支,每阶段提交,完成后合并
135
+ - **防卡死** — 检测探索循环,强制推进到下一阶段
121
136
 
122
137
  ---
123
138
 
124
139
  ## 主动规划
125
140
 
126
- Agent 在执行过程中可**主动进入规划模式**,无需用户手动切换。
141
+ Agent 执行中可主动进入规划模式,无需用户手动切换:
127
142
 
128
143
  1. Agent 遇到复杂任务时调用 `enter_plan`
129
- 2. 在规划模式下分析代码、设计方案(理解 → 设计 → 审查 → 最终计划)
144
+ 2. 在规划模式下分析代码、设计方案
130
145
  3. 调用 `exit_plan` 提交计划,TUI 弹出审批面板
131
- 4. 用户 **Approve****Reject**(可附反馈)
146
+ 4. 用户 Approve 或 Reject(可附反馈)
132
147
  5. 批准后按计划执行,驳回则修订
133
148
 
134
149
  ---
@@ -138,9 +153,11 @@ Agent 在执行过程中可**主动进入规划模式**,无需用户手动切
138
153
  采用 **策略 + 交互审批 + 会话缓存授权** 组合模型。
139
154
 
140
155
  - `permission.default_policy`: `ask | allow | deny`
141
- - `permission.rules[]`: 按工具 / 模式 / 命令前缀匹配细粒度规则
156
+ - `permission.rules[]`: 按工具 / 模式 / 文件模式 / 命令前缀匹配细粒度规则
142
157
  - 审批一次后同会话内同类操作自动放行
143
158
 
159
+ 提供三级权限模板:[严格](configs/permission-strict.yaml) | [标准](configs/permission-standard.yaml) | [宽松](configs/permission-permissive.yaml)
160
+
144
161
  TUI 审批面板:`1` allow once / `2` allow session / `3` deny / `Esc` deny
145
162
 
146
163
  ---
@@ -150,19 +167,17 @@ TUI 审批面板:`1` allow once / `2` allow session / `3` deny / `Esc` deny
150
167
  | 工具 | 说明 |
151
168
  |------|------|
152
169
  | `read` | 读取文件内容(支持 offset/limit 分页) |
153
- | `write` | 原子写文件(支持 overwrite / append / insert 模式) |
170
+ | `write` | 原子写文件(overwrite / append / insert |
154
171
  | `edit` | 事务性字符串替换 + 自动回滚 |
155
172
  | `patch` | 按行号范围替换文件内容 |
156
173
  | `glob` | 按模式搜索文件 |
157
- | `grep` | 按正则搜索文件内容(支持行号、分页) |
174
+ | `grep` | 按正则搜索文件内容 |
158
175
  | `bash` | 执行 shell 命令 |
159
176
  | `task` | 委派子智能体执行子任务 |
160
177
  | `todowrite` | 结构化任务管理 |
161
178
  | `question` | 向用户提问 |
162
- | `enter_plan` | 主动进入规划模式 |
163
- | `exit_plan` | 提交计划等待审批 |
164
- | `webfetch` | 抓取网页内容 |
165
- | `websearch` | Web 搜索 |
179
+ | `enter_plan` / `exit_plan` | 主动规划与审批 |
180
+ | `webfetch` / `websearch` | 网页抓取与搜索 |
166
181
  | `codesearch` | 代码搜索引擎 |
167
182
 
168
183
  写入安全特性:原子写、事务回滚、外部修改检测、读前编辑约束、file lock 串行化。
@@ -218,50 +233,12 @@ kkcode mcp tools # 可用工具列表
218
233
 
219
234
  通过 GitHub Device Flow 实现安全的仓库访问,无需手动配置 Token。
220
235
 
221
- ### 登录 GitHub
222
-
223
- ```bash
224
- kkcode --github
225
- ```
226
-
227
- 执行后:
228
- 1. **自动打开浏览器** — 弹窗授权页面
229
- 2. **自动复制验证码** — 剪贴板已填充设备码,直接粘贴即可
230
- 3. **自动轮询授权状态** — 无需手动操作,等待完成
231
- 4. **增强网络容错** — 支持不稳定网络环境,自动重试
232
-
233
- ### 登出 GitHub
234
-
235
236
  ```bash
236
- kkcode --github logout
237
+ kkcode --github # 登录并选择仓库
238
+ kkcode --github logout # 登出
237
239
  ```
238
240
 
239
- 清除本地存储的 GitHub Token。
240
-
241
- ### 工作流程
242
-
243
- ```bash
244
- kkcode --github # 启动 GitHub 登录流程
245
- # 选择仓库 → 选择分支 → 选择本地/云端操作模式
246
- # 进入 REPL 开始编码
247
- # 退出 REPL 后自动询问是否推送更改到云端
248
- ```
249
-
250
- **本地/云端操作选项:**
251
-
252
- | 选项 | 说明 |
253
- |------|------|
254
- | **使用本地仓库** | 直接使用本地已有代码,不拉取更新 |
255
- | **同步云端代码** | 执行 `git pull` 拉取最新代码 |
256
- | **强制重新克隆** | 删除本地仓库,重新完整克隆 |
257
-
258
- ### 完成工作后推送
259
-
260
- 退出 REPL 时自动询问是否推送更改:
261
-
262
- ```
263
- 🚀 检测到本地更改,是否推送至云端?(y/N)
264
- ```
241
+ 工作流程:登录 选择仓库/分支 → 选择本地或云端模式 → 进入 REPL → 退出时询问是否推送。
265
242
 
266
243
  ---
267
244
 
@@ -290,7 +267,6 @@ kkcode --github # 启动 GitHub 登录流程
290
267
  ```bash
291
268
  kkcode doctor --json # 完整诊断
292
269
  kkcode session list # 会话列表
293
- kkcode session fsck # 一致性检查
294
270
  kkcode session gc # 过期清理
295
271
  kkcode usage show # 用量统计
296
272
  kkcode longagent status # LongAgent 状态
@@ -304,9 +280,6 @@ kkcode longagent status # LongAgent 状态
304
280
 
305
281
  底部实时显示:`MODE` `MODEL` `TOKENS` `COST` `CONTEXT` `MEM` `PERMISSION` `LONG`
306
282
 
307
- - **CONTEXT** 85%+ 红色告警
308
- - **COST** 含缓存节省额(如 `↓$0.03`)
309
-
310
283
  ### 快捷键
311
284
 
312
285
  | 按键 | 功能 |
@@ -314,10 +287,8 @@ kkcode longagent status # LongAgent 状态
314
287
  | `Enter` | 发送 |
315
288
  | `Ctrl+J` | 换行 |
316
289
  | `Tab` | 模式轮换 |
317
- | `/paste` | 粘贴剪贴板图片 |
318
- | `Ctrl+Up/Down` | 滚动日志区 |
319
- | `Ctrl+Home/End` | 跳转日志首尾 |
320
290
  | `Up/Down` | 输入历史 |
291
+ | `Ctrl+Up/Down` | 滚动日志区 |
321
292
  | `Esc` | 清空输入 |
322
293
  | `Ctrl+L` | 清空活动区 |
323
294
  | `Ctrl+C` | 退出 |
@@ -336,99 +307,66 @@ kkcode longagent status # LongAgent 状态
336
307
  kkcode/
337
308
  ├── src/
338
309
  │ ├── index.mjs # CLI 入口
339
- │ ├── repl.mjs # TUI 主循环(输入/渲染/键盘处理)
340
- │ ├── runtime.mjs # 运行时初始化
341
- │ ├── context.mjs # 全局上下文构建
310
+ │ ├── repl.mjs # TUI 主循环
342
311
  │ ├── core/ # 核心类型、常量、事件总线
343
312
  │ ├── config/ # 配置加载、Schema 校验、默认值
344
- │ ├── session/ # 会话引擎、消息循环、系统提示词
345
- │ │ ├── loop.mjs # Agent 主循环(流式处理/自动续写)
346
- │ │ ├── engine.mjs # 会话引擎
347
- │ │ ├── longagent.mjs # LongAgent 编排调度
348
- │ │ ├── longagent-plan.mjs # 阶段计划生成与冻结
349
- │ │ ├── compaction.mjs # 上下文压缩
350
- │ │ ├── instinct-manager.mjs # Instinct 自动学习
351
- │ │ └── prompt/ # 各 Provider 系统提示词模板
313
+ │ ├── session/ # 会话引擎、消息循环、LongAgent 编排
352
314
  │ ├── tool/ # 工具注册、执行、事务管理
353
- │ │ ├── registry.mjs # 内置工具定义(read/write/edit/patch/...)
354
- │ │ ├── edit-transaction.mjs # 编辑事务与原子写入
355
- │ │ ├── task-tool.mjs # task 子任务委派
356
- │ │ ├── image-util.mjs # 图片处理与剪贴板读取
357
- │ │ └── prompt/ # 工具使用提示词
358
315
  │ ├── agent/ # 子智能体(explore/reviewer/researcher)
359
- │ ├── provider/ # 多 Provider 适配(Anthropic/OpenAI/Ollama/...)
360
- │ ├── permission/ # 权限引擎与工作区信任
316
+ │ ├── provider/ # 多 Provider 适配
317
+ │ ├── permission/ # 权限引擎
361
318
  │ ├── mcp/ # MCP 客户端(stdio/sse/http)
362
- │ ├── skill/ # 技能注册与生成
363
- │ ├── command/ # 自定义命令加载
364
- │ ├── commands/ # CLI 子命令(doctor/init/theme/...)
365
319
  │ ├── orchestration/ # 后台任务管理与并行 worker
366
- │ ├── plugin/ # Hook 事件总线
367
- │ ├── ui/ # Dashboard 渲染、活动日志
368
- │ ├── theme/ # 主题系统、状态栏、颜色
320
+ │ ├── observability/ # 可观测性(Metrics/Tracer)
321
+ │ ├── ui/ # Dashboard 渲染
369
322
  │ ├── storage/ # 会话/任务持久化
370
- │ ├── usage/ # Token 计量与预算控制
371
- ├── review/ # Diff 审查工作流
372
- ├── rules/ # 规则文件加载
373
- ├── knowledge/ # 知识库
374
- │ └── util/ # 通用工具函数(git/markdown/...)
375
- ├── templates/ # 模板文件(主题/定价/Hook 示例)
376
- ├── test/ # 单元测试与 E2E 测试
377
- ├── kkcode.config.yaml # 项目默认配置
378
- ├── package.json # Node.js 包定义
323
+ │ ├── usage/ # Token 计量与预算
324
+ └── util/ # 通用工具函数
325
+ ├── configs/ # 配置样例与权限模板
326
+ ├── test/ # 单元测试与集成测试
327
+ ├── package.json
379
328
  ├── LICENSE # GPL-3.0
380
- └── SECURITY.md # 安全政策
329
+ └── NOTICE.md # 第三方致谢与声明
381
330
  ```
382
331
 
383
332
  ---
384
333
 
385
- ## 配置示例
386
-
387
- ```yaml
388
- provider:
389
- default: anthropic
390
- anthropic:
391
- type: anthropic
392
- base_url: https://api.anthropic.com/v1
393
- api_key_env: ANTHROPIC_API_KEY
394
- default_model: claude-sonnet-4-20250514
395
- thinking:
396
- type: enabled
397
- budget_tokens: 10000
398
-
399
- agent:
400
- default_mode: agent
401
- max_steps: 8
402
- longagent:
403
- parallel:
404
- enabled: true
405
- max_concurrency: 3
406
-
407
- permission:
408
- default_policy: ask
409
-
410
- usage:
411
- budget:
412
- strategy: warn
413
- ```
334
+ ## 配置
335
+
336
+ 完整配置参考:[`docs/config.example.yaml`](docs/config.example.yaml)
414
337
 
415
- 完整配置参考见 [NOTICE.md](NOTICE.md)。
338
+ ### 配置样例(configs/ 目录)
339
+
340
+ | 文件 | 说明 |
341
+ |------|------|
342
+ | [`config-qwen3.5.yaml`](configs/config-qwen3.5.yaml) | 通义千问 Qwen3.5 系列 |
343
+ | [`config-qwen3.yaml`](configs/config-qwen3.yaml) | 通义千问 Qwen3 系列 |
344
+ | [`config-glm5.yaml`](configs/config-glm5.yaml) | 智谱 GLM-5 / GLM-4.5 |
345
+ | [`config-deepseek.yaml`](configs/config-deepseek.yaml) | DeepSeek V3 / R1 |
346
+ | [`config-ollama.yaml`](configs/config-ollama.yaml) | 本地 Ollama |
347
+ | [`config-multi-provider.yaml`](configs/config-multi-provider.yaml) | 多 Provider 组合 |
348
+ | [`permission-strict.yaml`](configs/permission-strict.yaml) | 严格权限(生产环境) |
349
+ | [`permission-standard.yaml`](configs/permission-standard.yaml) | 标准权限(日常开发) |
350
+ | [`permission-permissive.yaml`](configs/permission-permissive.yaml) | 宽松权限(个人/CI) |
416
351
 
417
352
  ---
418
353
 
419
354
  ## 常见问题
420
355
 
421
356
  **Q: LongAgent 为什么拒绝"你好"?**
422
- LongAgent 是执行型编排器,非编码目标会被意图识别拦截。
357
+ LongAgent 是执行型编排器,非编码目标会被意图识别拦截。请使用 `ask` 模式进行对话。
423
358
 
424
359
  **Q: enter_plan 和 /plan 有什么区别?**
425
360
  `/plan` 是用户手动切换模式。`enter_plan` 是 agent 执行中主动进入规划,审批通过后继续执行。
426
361
 
362
+ **Q: 如何切换模型?**
363
+ TUI 中使用 `/provider` 切换提供商,`/model` 切换模型。或修改配置文件中的 `provider.default`。
364
+
427
365
  **Q: Auto Memory 会无限增长吗?**
428
366
  注入系统提示时限制 200 行。Agent 会保持精简并删除过时条目。
429
367
 
430
- **Q: 大文件创建被截断怎么办?**
431
- 使用 `write(mode="append")` 分段追加创建,或用 `patch` 按行号范围修改。
368
+ **Q: 支持哪些国产模型?**
369
+ 原生支持通义千问 Qwen3.5/3 系列、智谱 GLM-5/4.5、DeepSeek V3/R1,以及任何 OpenAI 兼容 API。
432
370
 
433
371
  ---
434
372
 
package/package.json CHANGED
@@ -1,46 +1,46 @@
1
- {
2
- "name": "@kkelly-offical/kkcode",
3
- "version": "0.1.3",
4
- "description": "Team-first terminal AI coding agent CLI with LongAgent orchestration, GitHub integration and themed UX.",
5
- "type": "module",
6
- "packageManager": "pnpm@10.5.2",
7
- "license": "GPL-3.0",
8
- "author": "kkelly-offical",
9
- "repository": {
10
- "type": "git",
11
- "url": "https://github.com/kkelly-offical/kkcode.git"
12
- },
13
- "homepage": "https://github.com/kkelly-offical/kkcode",
14
- "bugs": {
15
- "url": "https://github.com/kkelly-offical/kkcode/issues"
16
- },
17
- "keywords": [
18
- "ai",
19
- "coding-agent",
20
- "cli",
21
- "terminal",
22
- "github",
23
- "longagent",
24
- "code-review",
25
- "mcp"
26
- ],
27
- "bin": {
28
- "kkcode": "./src/index.mjs"
29
- },
30
- "files": [
31
- "src/",
32
- "LICENSE"
33
- ],
34
- "engines": {
35
- "node": ">=22"
36
- },
37
- "scripts": {
38
- "start": "node ./src/index.mjs",
39
- "test": "node --test",
40
- "test:e2e": "node --test test/e2e/"
41
- },
42
- "dependencies": {
43
- "commander": "^13.1.0",
44
- "yaml": "^2.8.1"
45
- }
46
- }
1
+ {
2
+ "name": "@kkelly-offical/kkcode",
3
+ "version": "0.1.6",
4
+ "description": "Team-first terminal AI coding agent CLI with LongAgent orchestration, GitHub integration and themed UX.",
5
+ "type": "module",
6
+ "packageManager": "pnpm@10.5.2",
7
+ "license": "GPL-3.0",
8
+ "author": "kkelly-offical",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/kkelly-offical/kkcode.git"
12
+ },
13
+ "homepage": "https://github.com/kkelly-offical/kkcode",
14
+ "bugs": {
15
+ "url": "https://github.com/kkelly-offical/kkcode/issues"
16
+ },
17
+ "keywords": [
18
+ "ai",
19
+ "coding-agent",
20
+ "cli",
21
+ "terminal",
22
+ "github",
23
+ "longagent",
24
+ "code-review",
25
+ "mcp"
26
+ ],
27
+ "bin": {
28
+ "kkcode": "./src/index.mjs"
29
+ },
30
+ "files": [
31
+ "src/",
32
+ "LICENSE"
33
+ ],
34
+ "engines": {
35
+ "node": ">=22"
36
+ },
37
+ "scripts": {
38
+ "start": "node ./src/index.mjs",
39
+ "test": "node --test",
40
+ "test:e2e": "node --test test/e2e/"
41
+ },
42
+ "dependencies": {
43
+ "commander": "^13.1.0",
44
+ "yaml": "^2.8.2"
45
+ }
46
+ }
@@ -151,6 +151,14 @@ defineAgent({
151
151
  tools: ["read", "write", "edit", "bash", "glob", "grep", "list"]
152
152
  })
153
153
 
154
+ defineAgent({
155
+ name: "frontend-designer",
156
+ description: "Frontend design specialist. Creates polished, distinctive UIs with strong aesthetics — typography, color, motion, layout. Avoids generic AI-style designs. Reads project design system (Tailwind, CSS vars, component libraries) and produces production-grade frontend code.",
157
+ mode: "subagent",
158
+ permission: "full",
159
+ tools: ["read", "write", "edit", "bash", "glob", "grep", "list"]
160
+ })
161
+
154
162
  defineAgent({
155
163
  name: "compaction",
156
164
  description: "Conversation summarizer for context compression",
@@ -168,3 +176,36 @@ defineAgent({
168
176
  tools: [],
169
177
  hidden: true
170
178
  })
179
+
180
+ // 4-Stage LongAgent agents
181
+ defineAgent({
182
+ name: "preview-agent",
183
+ description: "4-Stage LongAgent: Stage 1 - Previewing Agent. Explores codebase, extracts requirements, no editing allowed.",
184
+ mode: "subagent",
185
+ permission: "readonly",
186
+ tools: ["read", "glob", "grep", "list", "bash", "question", "todowrite"]
187
+ })
188
+
189
+ defineAgent({
190
+ name: "blueprint-agent",
191
+ description: "4-Stage LongAgent: Stage 2 - Blueprint Agent. Creates detailed implementation plan, function designs, architecture.",
192
+ mode: "subagent",
193
+ permission: "readonly",
194
+ tools: ["read", "glob", "grep", "list", "bash", "question", "todowrite"]
195
+ })
196
+
197
+ defineAgent({
198
+ name: "coding-agent",
199
+ description: "4-Stage LongAgent: Stage 3 - Coding Agent. Implements code strictly according to blueprint.",
200
+ mode: "subagent",
201
+ permission: "full",
202
+ tools: null
203
+ })
204
+
205
+ defineAgent({
206
+ name: "debugging-agent",
207
+ description: "4-Stage LongAgent: Stage 4 - Debugging Agent. Verifies implementation, runs tests, finds and fixes bugs.",
208
+ mode: "subagent",
209
+ permission: "full",
210
+ tools: null
211
+ })
@@ -0,0 +1,58 @@
1
+ You are a FRONTEND DESIGN specialist. You create polished, distinctive, production-grade user interfaces.
2
+
3
+ ## Core Principle
4
+
5
+ You produce frontends that look professionally designed — NOT generic AI output. Every design decision must be intentional and contextual.
6
+
7
+ ## Design Rules
8
+
9
+ ### Typography
10
+ - NEVER use: Inter, Roboto, Open Sans, Lato, Arial, system-ui as primary font
11
+ - Impact choices: JetBrains Mono, Fira Code, Space Grotesk (code/tech), Playfair Display, Crimson Pro (editorial), Clash Display, Satoshi, Cabinet Grotesk (startup), IBM Plex, Source Sans 3 (technical)
12
+ - Use extreme weight contrast: 100/200 vs 800/900, 3x+ size jumps between heading and body
13
+ - Pick ONE distinctive font, use it decisively. Load from Google Fonts or bundled.
14
+
15
+ ### Color & Theme
16
+ - Commit to a cohesive palette. Use CSS variables for ALL colors.
17
+ - Dominant color with sharp accent outperforms timid, evenly-distributed palettes.
18
+ - Draw inspiration from: IDE themes (Dracula, Nord, Catppuccin), cultural aesthetics (Japanese minimalism, Bauhaus, Swiss design), nature palettes.
19
+ - AVOID: purple-gradient-on-white, blue-button-gray-card, generic SaaS palettes.
20
+
21
+ ### Motion & Interaction
22
+ - Use animations for page load (staggered reveals with animation-delay), hover states, and transitions.
23
+ - CSS-only for HTML; Motion/Framer Motion for React; GSAP for complex sequences.
24
+ - Focus on ONE high-impact moment per page rather than animating everything.
25
+ - Micro-interactions: button press feedback, input focus glow, card hover lift.
26
+
27
+ ### Layout & Spacing
28
+ - Use CSS Grid for page layout, Flexbox for component internals.
29
+ - Generous whitespace — when in doubt, add more padding.
30
+ - Consistent spacing scale (4px base: 4, 8, 12, 16, 24, 32, 48, 64, 96).
31
+ - Break out of the box: overlapping elements, asymmetric grids, full-bleed sections.
32
+
33
+ ### Backgrounds & Depth
34
+ - Create atmosphere: layered CSS gradients, subtle geometric patterns, contextual effects.
35
+ - Use backdrop-filter for glass effects, box-shadow for elevation hierarchy.
36
+ - Noise textures, grain overlays, or mesh gradients for premium feel.
37
+
38
+ ## Anti-Patterns (NEVER do these)
39
+ - Cookie-cutter card grids with rounded corners and drop shadows
40
+ - Generic hero section with centered text and gradient background
41
+ - Overuse of border-radius: 9999px on everything
42
+ - Gray placeholder text that looks like wireframe
43
+ - Identical spacing everywhere (no visual rhythm)
44
+ - Stock-photo-style placeholder images
45
+
46
+ ## Workflow
47
+ 1. READ the project's existing design system first (tailwind.config, CSS variables, component library)
48
+ 2. RESPECT existing conventions — extend, don't replace
49
+ 3. If no design system exists, establish one: define CSS variables for colors, spacing, typography
50
+ 4. Build mobile-first, then enhance for larger screens
51
+ 5. Test: does it look like a human designer made it? If not, iterate.
52
+
53
+ ## Tool Usage
54
+ - USE `read` to examine existing styles, configs, and components before writing
55
+ - USE `edit` for modifying existing files (preferred)
56
+ - USE `write` for new component files
57
+ - USE `bash` to check if fonts/deps are available, run dev server
58
+ - USE `grep`/`glob` to find existing style patterns, color usage, component conventions