Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
99 changes: 99 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Build

on:
push:
branches: [main, dev]
tags: ['v*']
pull_request:
branches: [main, dev]
workflow_dispatch:

jobs:
# 多平台二进制构建
build-binary:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# Linux builds
- os: ubuntu-latest
target: linux-x64
artifact: memo-linux-x64
- os: ubuntu-latest
target: linux-arm64
artifact: memo-linux-arm64

# macOS builds
- os: macos-latest
target: darwin-x64
artifact: memo-darwin-x64
- os: macos-latest
target: darwin-arm64
artifact: memo-darwin-arm64

# Windows build
- os: windows-latest
target: windows-x64
artifact: memo-windows-x64.exe

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Bun
uses: oven-sh/setup-bun@v1

- name: Install ripgrep (Linux)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y ripgrep

- name: Install ripgrep (macOS)
if: runner.os == 'macOS'
run: brew install ripgrep

- name: Install ripgrep (Windows)
if: runner.os == 'Windows'
run: choco install ripgrep -y

- name: Install dependencies
run: bun install

- name: Build binary (Unix)
if: runner.os != 'Windows'
run: bun build packages/cli/src/index.tsx --target=bun --compile --outfile=${{ matrix.artifact }}

- name: Build binary (Windows)
if: runner.os == 'Windows'
run: bun build packages/cli/src/index.tsx --target=bun --compile --outfile=${{ matrix.artifact }}

- name: Test binary (Unix)
if: runner.os != 'Windows'
run: ./${{ matrix.artifact }} --help

- name: Test binary (Windows)
if: runner.os == 'Windows'
run: .\${{ matrix.artifact }} --help

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: ${{ matrix.artifact }}
retention-days: 7

# 汇总构建结果
build-summary:
name: Build Summary
runs-on: ubuntu-latest
needs: build-binary
if: always()
steps:
- name: Check build status
run: |
echo "All builds completed"
if [ "${{ needs.build-binary.result }}" != "success" ]; then
echo "Some builds failed"
exit 1
fi
13 changes: 6 additions & 7 deletions .github/workflows/ci.yml → .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
name: CI
name: Lint

on:
push:
branches: ['**']
pull_request:
branches: ['**']
workflow_dispatch:

jobs:
test:
lint:
name: Code Quality Check
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -16,11 +18,8 @@ jobs:
- name: Setup Bun
uses: oven-sh/setup-bun@v1

- name: Install ripgrep (for grep tool)
run: sudo apt-get update && sudo apt-get install -y ripgrep

- name: Install dependencies
run: bun install

- name: Run tests
run: bun test
- name: Check code formatting
run: bun run format:check
69 changes: 69 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Test

on:
push:
branches: ['**']
pull_request:
branches: ['**']
workflow_dispatch:

jobs:
# 测试各个包 (Linux only, 快速反馈)
test-packages:
name: Test @memo/${{ matrix.package }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
package: [core, tools, cli]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Bun
uses: oven-sh/setup-bun@v1

- name: Install ripgrep
run: sudo apt-get update && sudo apt-get install -y ripgrep

- name: Install dependencies
run: bun install

- name: Run tests
run: bun run test:${{ matrix.package }}

# 多平台集成测试
test-integration:
name: Integration (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Bun
uses: oven-sh/setup-bun@v1

- name: Install ripgrep (Linux)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y ripgrep

- name: Install ripgrep (macOS)
if: runner.os == 'macOS'
run: brew install ripgrep

- name: Install ripgrep (Windows)
if: runner.os == 'Windows'
run: choco install ripgrep -y

- name: Install dependencies
run: bun install

- name: Run all tests
run: bun run test:all

- name: Test build
run: bun run build
6 changes: 3 additions & 3 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ memo-cli 是基于 Bun + TypeScript 的终端 ReAct Agent(monorepo 结构,~2
- 基于 MCP 协议,Zod 验证输入
- 统一导出为 `TOOLKIT`

- **packages/ui** (~170 行):CLI 交互层(REPL + `--once` 模式)
- **packages/cli** (~170 行):CLI 交互层(REPL + `--once` 模式)

- **docs/**:架构文档(core.md、config-storage.md、tools/\*.md)

Expand Down Expand Up @@ -105,7 +105,7 @@ bun run format # 代码格式化
bun run format:check # 检查格式

# 调试
bun run packages/ui/src/index.tsx "问题"
bun run packages/cli/src/index.tsx "问题"
```

**环境变量**:
Expand Down Expand Up @@ -168,7 +168,7 @@ main() → parseArgs() → ensureProviderConfig()

## 关键文件

- `packages/ui/src/index.tsx` - 入口
- `packages/cli/src/index.tsx` - 入口
- `packages/core/src/runtime/session.ts` - ReAct 核心
- `packages/core/src/utils/utils.ts` - JSON 解析
- `packages/core/src/config/config.ts` - 配置管理
Expand Down
6 changes: 3 additions & 3 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/future-plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ memo-cli 是一个基于 Bun + TypeScript 的 ReAct Agent CLI 工具,具有以

- `packages/core`:配置、运行时(Session/Turn)、LLM 适配、工具集装配
- `packages/tools`:内置工具实现与测试
- `packages/ui`:CLI 入口,组装 Core + Tools
- `packages/cli`:CLI 入口,组装 Core + Tools
- `docs/`:架构与设计文档

## 2. 市场竞品对比
Expand Down
4 changes: 2 additions & 2 deletions docs/multi-turn.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## 背景与痛点

- 当前 `packages/ui/src/index.tsx` 只接受一次问题,调用 `runAgent` 后直接退出,无法继续追问或补充上下文。
- 当前 `packages/cli/src/index.tsx` 只接受一次问题,调用 `runAgent` 后直接退出,无法继续追问或补充上下文。
- 日志仅有 `history.xml`(旧方案)时无法按消息维度索引/分析;现统一写 JSONL。
- 缺少 Session/Turn 概念,无法区分同一进程内的多轮、或复盘某一轮的工具轨迹。

Expand All @@ -31,7 +31,7 @@
## 运行模式与 CLI 行为

- **交互模式(默认)**:
- `bun start` 或 `bun run packages/ui/src/index.tsx` 启动 Session,打印 `sessionId`。
- `bun start` 或 `bun run packages/cli/src/index.tsx` 启动 Session,打印 `sessionId`。
- 可选第一个问题来自 argv,其余问题从 stdin 读取;支持 `/exit`、`/help` 之类的指令退出或查看状态。
- 每个 Turn 结束后继续等待输入,直到用户退出或遇到致命错误。
- **一次性模式(`--once`)**:
Expand Down
13 changes: 9 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@
"type": "module",
"private": true,
"scripts": {
"start": "bun run packages/ui/src/index.tsx",
"build": "bun build packages/ui/src/index.tsx --target bun --outdir dist --minify",
"build:binary": "bun build packages/ui/src/index.tsx --target=bun --compile --outfile=memo",
"start": "bun run packages/cli/src/index.tsx",
"build": "bun build packages/cli/src/index.tsx --target bun --outdir dist --minify",
"build:binary": "bun build packages/cli/src/index.tsx --target=bun --compile --outfile=memo",
"format": "bunx prettier --write .",
"format:check": "bunx prettier --check ."
"format:check": "bunx prettier --check .",
"test": "bun test",
"test:core": "cd packages/core && bun test",
"test:tools": "cd packages/tools && bun test",
"test:cli": "cd packages/cli && bun test",
"test:all": "bun run test:core && bun run test:tools && bun run test:cli"
},
"workspaces": [
"packages/*"
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/package.json → packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@memo/ui",
"name": "@memo/cli",
"type": "module",
"module": "src/index.tsx",
"private": true,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading