@kkelly-offical/kkcode 0.1.2 → 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 +120 -178
  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
@@ -1,47 +1,41 @@
1
1
  # kkcode
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/@kkelly-offical/kkcode)](https://www.npmjs.com/package/@kkelly-offical/kkcode)
3
4
  ![Node](https://img.shields.io/badge/Node.js-%3E%3D22-green)
4
5
  ![License](https://img.shields.io/badge/License-GPL--3.0-blue)
5
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)
6
8
 
7
- 面向团队协作的终端 AI Coding Agent:兼顾 **可执行**(工具链 + 子任务)、**可治理**(权限 / 审计 / 预算)、**可长跑**(LongAgent 阶段并行编排)。
9
+ 面向团队协作的终端 AI Coding Agent
10
+
11
+ **可执行** — 内置 16+ 工具链,子智能体委派,主动规划与审批。
12
+ **可治理** — 三级权限策略,会话审计,Token 预算控制。
13
+ **可长跑** — LongAgent 阶段并行编排,自动重试与门禁闭环。
14
+ **多模型** — 原生支持 Qwen3.5、GLM-5、DeepSeek、Claude、GPT、Ollama 本地模型。
8
15
 
9
16
  ---
10
17
 
11
18
  ## 目录
12
19
 
13
- - [kkcode](#kkcode)
14
- - [目录](#目录)
15
- - [快速开始](#快速开始)
16
- - [环境要求](#环境要求)
17
- - [安装与运行](#安装与运行)
18
- - [初始化项目配置](#初始化项目配置)
19
- - [模式系统](#模式系统)
20
- - [LongAgent 编排](#longagent-编排)
21
- - [主流程](#主流程)
22
- - [并行与一致性](#并行与一致性)
23
- - [主动规划](#主动规划)
24
- - [权限系统](#权限系统)
25
- - [内置工具](#内置工具)
26
- - [子智能体](#子智能体)
27
- - [Auto Memory](#auto-memory)
28
- - [MCP 接入](#mcp-接入)
29
- - [GitHub 集成](#github-集成)
30
- - [登录 GitHub](#登录-github)
31
- - [登出 GitHub](#登出-github)
32
- - [工作流程](#工作流程)
33
- - [完成工作后推送](#完成工作后推送)
34
- - [扩展机制](#扩展机制)
35
- - [会话与审计](#会话与审计)
36
- - [TUI 交互](#tui-交互)
37
- - [状态栏](#状态栏)
38
- - [快捷键](#快捷键)
39
- - [常用 Slash 命令](#常用-slash-命令)
40
- - [项目结构](#项目结构)
41
- - [配置示例](#配置示例)
42
- - [常见问题](#常见问题)
43
- - [致谢](#致谢)
44
- - [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)
45
39
 
46
40
  ---
47
41
 
@@ -55,17 +49,20 @@
55
49
 
56
50
  ### 安装与运行
57
51
 
52
+ **从 npm 安装(推荐):**
53
+
58
54
  ```bash
59
- cd kkcode
60
- npm install
61
- npm run start
55
+ npm install -g @kkelly-offical/kkcode
56
+ kkcode
62
57
  ```
63
58
 
64
- 全局链接(开发常用):
59
+ **从源码运行(开发用):**
65
60
 
66
61
  ```bash
67
- npm link
68
- kkcode
62
+ git clone https://github.com/kkelly-offical/kkcode.git
63
+ cd kkcode
64
+ npm install
65
+ npm run start
69
66
  ```
70
67
 
71
68
  ### 初始化项目配置
@@ -81,6 +78,24 @@ kkcode init -y
81
78
 
82
79
  ---
83
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
+
84
99
  ## 模式系统
85
100
 
86
101
  | 模式 | 目标 | 工具权限 | 典型场景 |
@@ -96,35 +111,39 @@ TUI 中按 `Tab` 一键轮换模式。
96
111
 
97
112
  ## LongAgent 编排
98
113
 
99
- LongAgent 是 kkcode 的核心差异能力,支持"意图识别 + 阶段并行 + 门禁闭环"。
114
+ LongAgent 是 kkcode 的核心差异能力,支持两种编排模式:
115
+
116
+ **Hybrid 模式**(默认)— 7 阶段流水线:
117
+
118
+ ```
119
+ Intake → Preview → Blueprint → Git分支 → Scaffold+并行编码 → Debugging → 门禁验证 → Git合并
120
+ ```
100
121
 
101
- ### 主流程
122
+ **4-Stage 模式** — 4 阶段顺序执行:
102
123
 
103
- 1. **意图识别** — 非编码目标直接阻断,避免空转
104
- 2. **Intake** 多轮澄清并生成摘要
105
- 3. **Plan Frozen** — 冻结阶段计划(StagePlan)
106
- 4. **Stage Barrier** — 同阶段任务并发执行,全部终态后推进
107
- 5. **Recovery** — 失败任务重试,优先续写 remaining files
108
- 6. **Usability Gates** — build / test / review / health / budget 全量校验
109
- 7. **完成判定** — 门禁通过 + 完成标记
124
+ ```
125
+ Preview(只读) Blueprint(只读) → Coding(写入) → Debugging(写入)
126
+ ```
110
127
 
111
- ### 并行与一致性
128
+ ### 关键机制
112
129
 
113
- - 同阶段并发由 `max_concurrency` 控制
114
- - 子任务由后台 worker 承载,主会话等待 barrier
115
- - 写入工具支持 file lock,避免并发冲突
116
- - TUI 实时显示阶段状态、进度条与文件变动摘要
130
+ - **阶段并行** — 同阶段任务由独立 worker 并发执行,`max_concurrency` 控制并发数
131
+ - **文件隔离** 每个文件仅归属一个 task,plan 阶段即检测冲突
132
+ - **自动重试** 失败任务自动重试,优先续写未完成文件
133
+ - **门禁闭环** — build / test / review / health / budget 五项质量门禁
134
+ - **Git 集成** — 自动创建特性分支,每阶段提交,完成后合并
135
+ - **防卡死** — 检测探索循环,强制推进到下一阶段
117
136
 
118
137
  ---
119
138
 
120
139
  ## 主动规划
121
140
 
122
- Agent 在执行过程中可**主动进入规划模式**,无需用户手动切换。
141
+ Agent 执行中可主动进入规划模式,无需用户手动切换:
123
142
 
124
143
  1. Agent 遇到复杂任务时调用 `enter_plan`
125
- 2. 在规划模式下分析代码、设计方案(理解 → 设计 → 审查 → 最终计划)
144
+ 2. 在规划模式下分析代码、设计方案
126
145
  3. 调用 `exit_plan` 提交计划,TUI 弹出审批面板
127
- 4. 用户 **Approve****Reject**(可附反馈)
146
+ 4. 用户 Approve 或 Reject(可附反馈)
128
147
  5. 批准后按计划执行,驳回则修订
129
148
 
130
149
  ---
@@ -134,9 +153,11 @@ Agent 在执行过程中可**主动进入规划模式**,无需用户手动切
134
153
  采用 **策略 + 交互审批 + 会话缓存授权** 组合模型。
135
154
 
136
155
  - `permission.default_policy`: `ask | allow | deny`
137
- - `permission.rules[]`: 按工具 / 模式 / 命令前缀匹配细粒度规则
156
+ - `permission.rules[]`: 按工具 / 模式 / 文件模式 / 命令前缀匹配细粒度规则
138
157
  - 审批一次后同会话内同类操作自动放行
139
158
 
159
+ 提供三级权限模板:[严格](configs/permission-strict.yaml) | [标准](configs/permission-standard.yaml) | [宽松](configs/permission-permissive.yaml)
160
+
140
161
  TUI 审批面板:`1` allow once / `2` allow session / `3` deny / `Esc` deny
141
162
 
142
163
  ---
@@ -146,19 +167,17 @@ TUI 审批面板:`1` allow once / `2` allow session / `3` deny / `Esc` deny
146
167
  | 工具 | 说明 |
147
168
  |------|------|
148
169
  | `read` | 读取文件内容(支持 offset/limit 分页) |
149
- | `write` | 原子写文件(支持 overwrite / append / insert 模式) |
170
+ | `write` | 原子写文件(overwrite / append / insert |
150
171
  | `edit` | 事务性字符串替换 + 自动回滚 |
151
172
  | `patch` | 按行号范围替换文件内容 |
152
173
  | `glob` | 按模式搜索文件 |
153
- | `grep` | 按正则搜索文件内容(支持行号、分页) |
174
+ | `grep` | 按正则搜索文件内容 |
154
175
  | `bash` | 执行 shell 命令 |
155
176
  | `task` | 委派子智能体执行子任务 |
156
177
  | `todowrite` | 结构化任务管理 |
157
178
  | `question` | 向用户提问 |
158
- | `enter_plan` | 主动进入规划模式 |
159
- | `exit_plan` | 提交计划等待审批 |
160
- | `webfetch` | 抓取网页内容 |
161
- | `websearch` | Web 搜索 |
179
+ | `enter_plan` / `exit_plan` | 主动规划与审批 |
180
+ | `webfetch` / `websearch` | 网页抓取与搜索 |
162
181
  | `codesearch` | 代码搜索引擎 |
163
182
 
164
183
  写入安全特性:原子写、事务回滚、外部修改检测、读前编辑约束、file lock 串行化。
@@ -214,50 +233,12 @@ kkcode mcp tools # 可用工具列表
214
233
 
215
234
  通过 GitHub Device Flow 实现安全的仓库访问,无需手动配置 Token。
216
235
 
217
- ### 登录 GitHub
218
-
219
236
  ```bash
220
- kkcode --github
237
+ kkcode --github # 登录并选择仓库
238
+ kkcode --github logout # 登出
221
239
  ```
222
240
 
223
- 执行后:
224
- 1. **自动打开浏览器** — 弹窗授权页面
225
- 2. **自动复制验证码** — 剪贴板已填充设备码,直接粘贴即可
226
- 3. **自动轮询授权状态** — 无需手动操作,等待完成
227
- 4. **增强网络容错** — 支持不稳定网络环境,自动重试
228
-
229
- ### 登出 GitHub
230
-
231
- ```bash
232
- kkcode --github logout
233
- ```
234
-
235
- 清除本地存储的 GitHub Token。
236
-
237
- ### 工作流程
238
-
239
- ```bash
240
- kkcode --github # 启动 GitHub 登录流程
241
- # 选择仓库 → 选择分支 → 选择本地/云端操作模式
242
- # 进入 REPL 开始编码
243
- # 退出 REPL 后自动询问是否推送更改到云端
244
- ```
245
-
246
- **本地/云端操作选项:**
247
-
248
- | 选项 | 说明 |
249
- |------|------|
250
- | **使用本地仓库** | 直接使用本地已有代码,不拉取更新 |
251
- | **同步云端代码** | 执行 `git pull` 拉取最新代码 |
252
- | **强制重新克隆** | 删除本地仓库,重新完整克隆 |
253
-
254
- ### 完成工作后推送
255
-
256
- 退出 REPL 时自动询问是否推送更改:
257
-
258
- ```
259
- 🚀 检测到本地更改,是否推送至云端?(y/N)
260
- ```
241
+ 工作流程:登录 → 选择仓库/分支 → 选择本地或云端模式 → 进入 REPL → 退出时询问是否推送。
261
242
 
262
243
  ---
263
244
 
@@ -286,7 +267,6 @@ kkcode --github # 启动 GitHub 登录流程
286
267
  ```bash
287
268
  kkcode doctor --json # 完整诊断
288
269
  kkcode session list # 会话列表
289
- kkcode session fsck # 一致性检查
290
270
  kkcode session gc # 过期清理
291
271
  kkcode usage show # 用量统计
292
272
  kkcode longagent status # LongAgent 状态
@@ -300,9 +280,6 @@ kkcode longagent status # LongAgent 状态
300
280
 
301
281
  底部实时显示:`MODE` `MODEL` `TOKENS` `COST` `CONTEXT` `MEM` `PERMISSION` `LONG`
302
282
 
303
- - **CONTEXT** 85%+ 红色告警
304
- - **COST** 含缓存节省额(如 `↓$0.03`)
305
-
306
283
  ### 快捷键
307
284
 
308
285
  | 按键 | 功能 |
@@ -310,10 +287,8 @@ kkcode longagent status # LongAgent 状态
310
287
  | `Enter` | 发送 |
311
288
  | `Ctrl+J` | 换行 |
312
289
  | `Tab` | 模式轮换 |
313
- | `/paste` | 粘贴剪贴板图片 |
314
- | `Ctrl+Up/Down` | 滚动日志区 |
315
- | `Ctrl+Home/End` | 跳转日志首尾 |
316
290
  | `Up/Down` | 输入历史 |
291
+ | `Ctrl+Up/Down` | 滚动日志区 |
317
292
  | `Esc` | 清空输入 |
318
293
  | `Ctrl+L` | 清空活动区 |
319
294
  | `Ctrl+C` | 退出 |
@@ -332,99 +307,66 @@ kkcode longagent status # LongAgent 状态
332
307
  kkcode/
333
308
  ├── src/
334
309
  │ ├── index.mjs # CLI 入口
335
- │ ├── repl.mjs # TUI 主循环(输入/渲染/键盘处理)
336
- │ ├── runtime.mjs # 运行时初始化
337
- │ ├── context.mjs # 全局上下文构建
310
+ │ ├── repl.mjs # TUI 主循环
338
311
  │ ├── core/ # 核心类型、常量、事件总线
339
312
  │ ├── config/ # 配置加载、Schema 校验、默认值
340
- │ ├── session/ # 会话引擎、消息循环、系统提示词
341
- │ │ ├── loop.mjs # Agent 主循环(流式处理/自动续写)
342
- │ │ ├── engine.mjs # 会话引擎
343
- │ │ ├── longagent.mjs # LongAgent 编排调度
344
- │ │ ├── longagent-plan.mjs # 阶段计划生成与冻结
345
- │ │ ├── compaction.mjs # 上下文压缩
346
- │ │ ├── instinct-manager.mjs # Instinct 自动学习
347
- │ │ └── prompt/ # 各 Provider 系统提示词模板
313
+ │ ├── session/ # 会话引擎、消息循环、LongAgent 编排
348
314
  │ ├── tool/ # 工具注册、执行、事务管理
349
- │ │ ├── registry.mjs # 内置工具定义(read/write/edit/patch/...)
350
- │ │ ├── edit-transaction.mjs # 编辑事务与原子写入
351
- │ │ ├── task-tool.mjs # task 子任务委派
352
- │ │ ├── image-util.mjs # 图片处理与剪贴板读取
353
- │ │ └── prompt/ # 工具使用提示词
354
315
  │ ├── agent/ # 子智能体(explore/reviewer/researcher)
355
- │ ├── provider/ # 多 Provider 适配(Anthropic/OpenAI/Ollama/...)
356
- │ ├── permission/ # 权限引擎与工作区信任
316
+ │ ├── provider/ # 多 Provider 适配
317
+ │ ├── permission/ # 权限引擎
357
318
  │ ├── mcp/ # MCP 客户端(stdio/sse/http)
358
- │ ├── skill/ # 技能注册与生成
359
- │ ├── command/ # 自定义命令加载
360
- │ ├── commands/ # CLI 子命令(doctor/init/theme/...)
361
319
  │ ├── orchestration/ # 后台任务管理与并行 worker
362
- │ ├── plugin/ # Hook 事件总线
363
- │ ├── ui/ # Dashboard 渲染、活动日志
364
- │ ├── theme/ # 主题系统、状态栏、颜色
320
+ │ ├── observability/ # 可观测性(Metrics/Tracer)
321
+ │ ├── ui/ # Dashboard 渲染
365
322
  │ ├── storage/ # 会话/任务持久化
366
- │ ├── usage/ # Token 计量与预算控制
367
- ├── review/ # Diff 审查工作流
368
- ├── rules/ # 规则文件加载
369
- ├── knowledge/ # 知识库
370
- │ └── util/ # 通用工具函数(git/markdown/...)
371
- ├── templates/ # 模板文件(主题/定价/Hook 示例)
372
- ├── test/ # 单元测试与 E2E 测试
373
- ├── kkcode.config.yaml # 项目默认配置
374
- ├── package.json # Node.js 包定义
323
+ │ ├── usage/ # Token 计量与预算
324
+ └── util/ # 通用工具函数
325
+ ├── configs/ # 配置样例与权限模板
326
+ ├── test/ # 单元测试与集成测试
327
+ ├── package.json
375
328
  ├── LICENSE # GPL-3.0
376
- └── SECURITY.md # 安全政策
329
+ └── NOTICE.md # 第三方致谢与声明
377
330
  ```
378
331
 
379
332
  ---
380
333
 
381
- ## 配置示例
382
-
383
- ```yaml
384
- provider:
385
- default: anthropic
386
- anthropic:
387
- type: anthropic
388
- base_url: https://api.anthropic.com/v1
389
- api_key_env: ANTHROPIC_API_KEY
390
- default_model: claude-sonnet-4-20250514
391
- thinking:
392
- type: enabled
393
- budget_tokens: 10000
394
-
395
- agent:
396
- default_mode: agent
397
- max_steps: 8
398
- longagent:
399
- parallel:
400
- enabled: true
401
- max_concurrency: 3
402
-
403
- permission:
404
- default_policy: ask
405
-
406
- usage:
407
- budget:
408
- strategy: warn
409
- ```
334
+ ## 配置
335
+
336
+ 完整配置参考:[`docs/config.example.yaml`](docs/config.example.yaml)
410
337
 
411
- 完整配置参考见 [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) |
412
351
 
413
352
  ---
414
353
 
415
354
  ## 常见问题
416
355
 
417
356
  **Q: LongAgent 为什么拒绝"你好"?**
418
- LongAgent 是执行型编排器,非编码目标会被意图识别拦截。
357
+ LongAgent 是执行型编排器,非编码目标会被意图识别拦截。请使用 `ask` 模式进行对话。
419
358
 
420
359
  **Q: enter_plan 和 /plan 有什么区别?**
421
360
  `/plan` 是用户手动切换模式。`enter_plan` 是 agent 执行中主动进入规划,审批通过后继续执行。
422
361
 
362
+ **Q: 如何切换模型?**
363
+ TUI 中使用 `/provider` 切换提供商,`/model` 切换模型。或修改配置文件中的 `provider.default`。
364
+
423
365
  **Q: Auto Memory 会无限增长吗?**
424
366
  注入系统提示时限制 200 行。Agent 会保持精简并删除过时条目。
425
367
 
426
- **Q: 大文件创建被截断怎么办?**
427
- 使用 `write(mode="append")` 分段追加创建,或用 `patch` 按行号范围修改。
368
+ **Q: 支持哪些国产模型?**
369
+ 原生支持通义千问 Qwen3.5/3 系列、智谱 GLM-5/4.5、DeepSeek V3/R1,以及任何 OpenAI 兼容 API。
428
370
 
429
371
  ---
430
372
 
package/package.json CHANGED
@@ -1,46 +1,46 @@
1
- {
2
- "name": "@kkelly-offical/kkcode",
3
- "version": "0.1.2",
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": "Apache-2.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