Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
9533cea
chore: 迁移项目从pnpm到bun包管理器
Apr 2, 2026
4968015
refactor: 修改package.json中的dev脚本路径
Apr 2, 2026
b7e6a7b
feat(agent): 重构 agent 循环为 AsyncGenerator 模式并实现 drainLoop 工具
Apr 2, 2026
4024f51
feat(上下文管理): 添加上下文压缩和工具结果预算功能
Apr 3, 2026
70c77a2
feat(chat): 添加模型降级和输出恢复功能
Apr 3, 2026
28915fa
feat(agent): 添加 token 预算递减收益检测功能
Apr 3, 2026
6d5407d
feat(loop): 添加模型降级处理逻辑
echoVic Apr 8, 2026
e52dc3a
refactor(loop): 重构事件类型系统并统一事件处理逻辑
echoVic Apr 8, 2026
a83ddee
test: 添加多个单元测试文件
echoVic Apr 8, 2026
d0a4e69
fix(agent): 修复工具执行中的信号处理和恢复计数器问题
echoVic Apr 8, 2026
02ad9d7
refactor(loop): 消除消息双源,统一走 ConversationState
echoVic Apr 9, 2026
cad0a77
fix(loop): 修复 appendBoth 导致消息重复的 bug
echoVic Apr 9, 2026
e26212d
feat(agent): 流式工具安全与 fallback 事务边界 (Phase 1)
echoVic Apr 9, 2026
d9244b4
refactor(streaming): 清理 code review 问题
echoVic Apr 9, 2026
cb13993
refactor(loop): 策略提取与语义 bug 修复 (Phase 2)
echoVic Apr 9, 2026
dacb2bc
fix(completionPolicy): 修复 setTimeout 泄漏并删除不可达类型
echoVic Apr 9, 2026
e6657c4
refactor(agent): 接口分层 — chatStream() 成为唯一事件流入口 (Phase 3)
echoVic Apr 9, 2026
db5ea8b
refactor(Agent): 删除未使用的 drainLoop 导入
echoVic Apr 9, 2026
6fe4799
refactor(consumers): 消费者迁移到 chatStream() 统一事件协议 (Phase 4)
echoVic Apr 9, 2026
99c201a
fix(subagent): 删除 SubagentContext 旧命名回调,完成 onEvent 收敛
echoVic Apr 9, 2026
336a46d
fix(phase4): 修复 code review 发现的两个问题
echoVic Apr 9, 2026
6f48b1f
fix(review): 修复最终 code review 发现的三个问题
echoVic Apr 9, 2026
aeccc85
fix(agent): 事件协议收敛 + 接口定型 + continue 分支状态修复
echoVic Apr 9, 2026
9544bc8
refactor: 删除所有 deprecated 代码
echoVic Apr 9, 2026
07276fa
feat(loop): 确保恢复分支消息的持久化和正确顺序
echoVic Apr 10, 2026
9de54d5
feat: 新增多模态消息处理、错误分类、流式缓冲和slash命令路由功能
echoVic Apr 10, 2026
aafce51
fix(agent/runtime): 修复模型切换后未立即生效的问题
echoVic Apr 10, 2026
80370a4
style: 替换表情符号和箭头为文本标记
echoVic Apr 10, 2026
30e7688
fix(cli): 修复多轮对话中stream_end的finalize问题
echoVic Apr 10, 2026
8cbfe8f
chore: 配置 npm 使用官方注册表
echoVic Apr 11, 2026
4b779c6
feat: 引入统一的 CWD 管理系统
echoVic Apr 11, 2026
56d703a
feat(permission): 增强Bash命令权限检查的语义分析和规范化
echoVic Apr 11, 2026
7711103
feat(prompts): 重构系统提示构建顺序并模块化默认提示
echoVic Apr 11, 2026
98d2730
fix(ui): 修复分支显示和加载文案优先级问题
echoVic Apr 11, 2026
805ef7a
refactor(tools): 移除 displayContent 字段并统一工具输出格式
echoVic Apr 11, 2026
0df82e5
fix(ui): 修复 Enter 键行为,仅用于提交而非接受建议
echoVic Apr 12, 2026
ca2a234
refactor(ui): 简化加载短语列表并更新提示概率
echoVic Apr 12, 2026
ffee334
chore: ignore project-local worktrees
echoVic Apr 12, 2026
150a48f
feat(cli): 支持 Markdown 引用块渲染并改进表格显示
echoVic Apr 12, 2026
6786a77
refactor(ui): 重做确认弹窗信息架构,添加 Diff 展开/折叠
echoVic Apr 12, 2026
deabaee
feat(ui): 改进代码块和确认提示的显示效果
echoVic Apr 12, 2026
d4e5ad3
feat(benchmark): 添加真实仓库基准测试工具和更详细的无头事件
echoVic Apr 12, 2026
618ecae
feat: 实现渐进式工具披露、自动验证传感器和内置验证Agent
echoVic Apr 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 27 additions & 102 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
bun-version: 1.3.11

- name: Verify Bun runtime
run: bun --version
Expand All @@ -33,41 +33,26 @@ jobs:
with:
node-version: "20.x"

- name: Install pnpm
run: npm install -g pnpm@9

- name: Get pnpm store directory
shell: bash
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: pnpm install --frozen-lockfile
run: bun install --frozen-lockfile

- name: Build CLI package
run: pnpm build:cli
run: bun run build:cli

- name: Run CLI type check
run: pnpm type-check
run: bun run type-check

- name: Run web type check
run: pnpm type-check:web
run: bun run type-check:web

- name: Run web session lint
run: pnpm lint:web
run: bun run lint:web

- name: Run web regression tests
run: pnpm test:web
run: bun run test:web

- name: Build all packages
run: pnpm build
run: bun run build

core-headless-gate:
name: Headless Core Gate
Expand All @@ -80,7 +65,7 @@ jobs:
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
bun-version: 1.3.11

- name: Verify Bun runtime
run: bun --version
Expand All @@ -90,29 +75,14 @@ jobs:
with:
node-version: "20.x"

- name: Install pnpm
run: npm install -g pnpm@9

- name: Get pnpm store directory
shell: bash
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: pnpm install --frozen-lockfile
run: bun install --frozen-lockfile

- name: Build CLI package
run: pnpm build:cli
run: bun run build:cli

- name: Run headless core regression suite
run: pnpm test:headless-core
run: bun run test:headless-core

coverage:
name: Test Coverage
Expand All @@ -126,7 +96,7 @@ jobs:
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
bun-version: 1.3.11

- name: Verify Bun runtime
run: bun --version
Expand All @@ -136,29 +106,14 @@ jobs:
with:
node-version: "20.x"

- name: Install pnpm
run: npm install -g pnpm@9

- name: Get pnpm store directory
shell: bash
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: pnpm install --frozen-lockfile
run: bun install --frozen-lockfile

- name: Build CLI package
run: pnpm build:cli
run: bun run build:cli

- name: Run tests with coverage
run: pnpm --filter blade-code test:coverage
run: bun run --filter blade-code test:coverage

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
Expand Down Expand Up @@ -189,7 +144,7 @@ jobs:
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
bun-version: 1.3.11

- name: Verify Bun runtime
run: bun --version
Expand All @@ -199,32 +154,17 @@ jobs:
with:
node-version: "20.x"

- name: Install pnpm
run: npm install -g pnpm@9

- name: Get pnpm store directory
shell: bash
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: pnpm install --frozen-lockfile
run: bun install --frozen-lockfile

- name: Build CLI package
run: pnpm build:cli
run: bun run build:cli

- name: Run security tests
run: pnpm --filter blade-code test:security
run: bun run --filter blade-code test:security

- name: Run npm audit
run: pnpm audit --audit-level=high || true
- name: Run Bun audit
run: bun audit --audit-level=high || true

cross-platform-smoke:
name: Cross Platform Smoke (${{ matrix.os }})
Expand All @@ -240,7 +180,7 @@ jobs:
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
bun-version: 1.3.11

- name: Verify Bun runtime
run: bun --version
Expand All @@ -250,29 +190,14 @@ jobs:
with:
node-version: "20.x"

- name: Install pnpm
run: npm install -g pnpm@9

- name: Get pnpm store directory
shell: bash
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
run: pnpm install --frozen-lockfile
run: bun install --frozen-lockfile

- name: Build all packages
run: pnpm build
run: bun run build

- name: Test CLI help
run: pnpm --filter blade-code start -- --help
run: bun run --filter blade-code start -- --help

- name: Test headless help
run: pnpm --filter blade-code start -- --headless /help
run: bun run --filter blade-code start -- --headless /help
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ node_modules/
dist/
bundle/

# pnpm 相关文件
# 包管理器缓存
.pnpm/
.pnpm-store/

# 锁定文件 (保留 pnpm-lock.yaml,但忽略其他)
# 锁定文件(bun.lock 提交到仓库,忽略其他)
yarn.lock
package-lock.json

Expand Down Expand Up @@ -56,6 +56,7 @@ coverage/

# 临时文件
.tmp/
.worktrees/
*.tmp
*.temp

Expand All @@ -70,6 +71,7 @@ blade-context/

# Local settings
.blade/settings.local.json
.blade/benchmarks/
.claude/settings.local.json

# Monorepo - 各包的构建输出
Expand All @@ -83,3 +85,4 @@ packages/vscode/*.vsix
# Web 构建缓存
packages/web/.vite/
packages/cli/web/.vite/
.gstack/
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
only-built-dependencies=@vscode/ripgrep esbuild node-pty
registry=https://registry.npmjs.org/
28 changes: 14 additions & 14 deletions BLADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ always respond in Chinese

## 项目概述

**Blade Code** 是一个基于 React + Ink 构建的智能 AI 编程助手 CLI 工具,使用 TypeScript 开发。项目采用 **pnpm workspace monorepo** 架构。
**Blade Code** 是一个基于 React + Ink 构建的智能 AI 编程助手 CLI 工具,使用 TypeScript 开发。项目采用 **Bun workspace monorepo** 架构。

- **项目类型**: CLI 工具(TUI 应用)+ Web UI + VSCode 扩展
- **主要语言**: TypeScript
- **运行时**: Node.js >=20.0.0(开发使用 Bun)
- **运行时**: Node.js >=20.0.0(开发使用 Bun 1.3.11
- **UI 框架**: React 19 + Ink(终端 UI)/ React 19 + Vite(Web UI)
- **状态管理**: Zustand
- **配置管理**: 支持 JSON 配置和环境变量插值
- **测试框架**: Vitest
- **代码质量**: Biome(Lint + Format)
- **包管理**: pnpm workspace
- **包管理**: Bun workspaces
- **当前版本**: 0.2.0

## 核心特性
Expand All @@ -32,9 +32,9 @@ always respond in Chinese

### 开发命令
```bash
pnpm dev # 启动 CLI 开发模式(watch)
pnpm dev:serve # 启动 CLI 开发模式 + Web 服务器
pnpm build # 构建 CLI
bun run dev # 启动 CLI 开发模式(watch)
bun run dev:web # 启动 CLI 开发模式 + Web 服务器
bun run build # 构建 CLI
```

### 运行命令
Expand All @@ -47,18 +47,18 @@ blade serve --port 3000 --hostname 0.0.0.0 # 指定端口和主机

### 测试命令
```bash
pnpm test # 运行测试
pnpm test:all # 运行所有测试
pnpm test:unit # 运行单元测试
pnpm test:cli # 运行 CLI 测试
pnpm test:coverage # 带覆盖率测试
bun run test # 运行测试
bun run test:all # 运行所有测试
bun run test:unit # 运行单元测试
bun run test:cli # 运行 CLI 测试
bun run test:coverage # 带覆盖率测试
```

### 代码质量
```bash
pnpm lint # Lint 检查
pnpm lint:fix # Lint 并自动修复
pnpm type-check # 类型检查
bun run lint # Lint 检查
bun run lint:fix # Lint 并自动修复
bun run type-check # 类型检查
```

## 架构概览
Expand Down
20 changes: 13 additions & 7 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ Blade Code is a modern AI-powered coding assistant with CLI + Web UI, built with

```bash
# Development
pnpm dev # Start CLI dev mode (watch)
pnpm dev:serve # Start CLI + Web server
pnpm build # Build CLI
bun run dev # Start CLI dev mode (watch)
bun run dev:web # Start CLI + Web server
bun run build # Build CLI

# Running
blade # Start interactive CLI
blade web # Start Web UI (opens browser)
blade serve # Start headless server

# Testing & Quality
pnpm test:all # Run all tests
pnpm lint # Run linter
pnpm type-check # TypeScript type checking
bun run test:all # Run all tests
bun run lint # Run linter
bun run type-check # TypeScript type checking
```

## Architecture
Expand Down Expand Up @@ -75,12 +75,18 @@ Blade/

- Test framework: Vitest
- Tests location: `packages/cli/tests/`
- Run tests: `pnpm test:all`
- Run tests: `bun run test:all`

## Documentation

- User docs: `docs/`

## gstack

Use the /browse skill from gstack for all web browsing, never use mcp__claude-in-chrome__* tools.

Available skills: /office-hours, /plan-ceo-review, /plan-eng-review, /plan-design-review, /design-consultation, /design-shotgun, /design-html, /review, /ship, /land-and-deploy, /canary, /benchmark, /browse, /connect-chrome, /qa, /qa-only, /design-review, /setup-browser-cookies, /setup-deploy, /retro, /investigate, /document-release, /codex, /cso, /autoplan, /plan-devex-review, /devex-review, /careful, /freeze, /guard, /unfreeze, /gstack-upgrade, /learn.

## More Information

- [README.md](README.md) - Project overview
Expand Down
Loading
Loading