Skip to content
Open
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
4 changes: 0 additions & 4 deletions .arts/settings.json

This file was deleted.

Empty file removed .codeartsdoer/.codebaseignore
Empty file.
69 changes: 69 additions & 0 deletions .codex-lint.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
diff --git a/.arts/settings.json b/.arts/settings.json
deleted file mode 100644
index c2c6386d..00000000
--- a/.arts/settings.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "clawMode.mode": "editor",
- "workbench.activityBar.location": "default"
-}
\ No newline at end of file
diff --git a/.codeartsdoer/.codebaseignore b/.codeartsdoer/.codebaseignore
deleted file mode 100644
index e69de29b..00000000
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 1b54355a..5990c716 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -59,6 +59,7 @@ jobs:
uses: golangci/golangci-lint-action@v6
with:
version: latest
+ only-new-issues: true

- name: Build all packages
run: go build ./...
diff --git a/.gitignore b/.gitignore
index 494ce726..ad768ff4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -44,3 +44,4 @@ benchmarks/latest.txt
# Temporary files
.tmp/
.omx/
+.issue-tmp/
diff --git a/.golangci.yml b/.golangci.yml
index 85e8605d..5424306b 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -42,7 +42,7 @@ linters:

# ========== 最佳实践 ==========
- nolintlint # 🆕 检查 nolint 指令的规范性
- - exportloopref # 🆕 检查循环变量导出问题
+ - copyloopvar # Go 1.22+ 用于检查循环变量复制场景
- prealloc # 🆕 建议预分配切片容量
- unconvert # 🆕 检测不必要的类型转换
- unparam # 🆕 检测未使用的函数参数
diff --git a/config/api.go b/config/api.go
index b554e3ab..9d715ca3 100644
--- a/config/api.go
+++ b/config/api.go
@@ -43,11 +43,11 @@ type ConfigAPIHandler struct {
}

type apiResponse struct {
- Success bool `json:"success"`
- Data any `json:"data,omitempty"`
- Error *apiError `json:"error,omitempty"`
- Timestamp time.Time `json:"timestamp"`
- RequestID string `json:"request_id,omitempty"`
+ Success bool `json:"success"`
+ Data any `json:"data,omitempty"`
+ Error *apiError `json:"error,omitempty"`
+ Timestamp time.Time `json:"timestamp"`
+ RequestID string `json:"request_id,omitempty"`
}

type apiError struct {
82 changes: 82 additions & 0 deletions .github/dev-branch-and-automerge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# `dev` 分支与自动合并配置说明

本仓库已补充 workflow:`.github/workflows/dev-to-master-auto-merge.yml`

目标:

- 日常开发先合入 `dev`
- 推送到 `dev` 后自动创建/更新 `dev -> master` PR
- 当 `master` 分支要求的 CI / 审查条件全部通过后,自动合并到 `master`

## 你还需要在 GitHub 仓库后台手动打开的设置

这些设置**不能完全靠仓库文件本身代替**,需要在 GitHub 仓库设置中开启:

### 1. 打开仓库 Auto-merge

路径:

- `Settings`
- `General`
- `Pull Requests`
- 勾选 `Allow auto-merge`

### 2. 给 `master` 加保护规则

建议:

- Require a pull request before merging
- Require status checks to pass before merging
- Require branches to be up to date before merging
- Require conversation resolution before merging
- Block force pushes
- Block deletions

建议至少把以下检查设为 required:

- `Quality & Tests`
- `Benchmark`
- `Cross Build (linux/amd64)`
- `Cross Build (linux/arm64)`
- `Cross Build (darwin/amd64)`
- `Cross Build (windows/amd64)`
- `Security Scan`

### 3. 给 `dev` 加保护规则

建议:

- 也要求 PR 合并到 `dev`
- 至少要求 `Quality & Tests`
- 禁止 force push
- 禁止删除

## 推荐分支流

```text
feature/* -> dev -> master
```

说明:

- 功能分支先提 PR 到 `dev`
- `dev` 作为集成分支跑 CI/CD
- `dev` 更新后,workflow 自动维护 `dev -> master`
- `master` 只接收通过保护规则的自动合并

## 注意事项

1. 如果仓库还没有远端 `dev` 分支,请先创建并推送:

```bash
git checkout -b dev
git push -u origin dev
```

2. 自动合并是否真的执行,取决于:

- 仓库是否启用 `Allow auto-merge`
- `master` 是否有 required status checks
- `dev -> master` PR 是否满足所有保护规则

3. 当前 workflow 使用 GitHub 自带 `GITHUB_TOKEN` 创建/更新 PR 并开启 auto-merge,不依赖额外密钥。
13 changes: 11 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ env:
# Integration tests in rag/ and llm/ use //go:build integration tags
# and are already excluded by default (go test doesn't include them).
EXCLUDED_PKGS_REGEX: '^github\.com/BaSui01/agentflow/internal/database$'
COVERAGE_EXCLUDED_PKGS_REGEX: '^github\.com/BaSui01/agentflow/(internal/database|examples|scripts|cmd)(/|$)'

jobs:
ci:
Expand All @@ -47,18 +48,26 @@ jobs:
shell: bash
run: |
pkgs=$(go list ./... | grep -Ev "${EXCLUDED_PKGS_REGEX}" | tr '\n' ' ')
coverage_pkgs=$(go list ./... | grep -Ev "${COVERAGE_EXCLUDED_PKGS_REGEX}" | tr '\n' ' ')
if [[ -z "${pkgs}" ]]; then
echo "No packages selected for CI checks"
exit 1
fi
if [[ -z "${coverage_pkgs}" ]]; then
echo "No packages selected for coverage checks"
exit 1
fi

echo "pkgs=${pkgs}" >> "$GITHUB_OUTPUT"
echo "coverage_pkgs=${coverage_pkgs}" >> "$GITHUB_OUTPUT"
echo "Selected package count: $(echo "${pkgs}" | wc -w)"
echo "Selected coverage package count: $(echo "${coverage_pkgs}" | wc -w)"

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: latest
only-new-issues: true

- name: Build all packages
run: go build ./...
Expand Down Expand Up @@ -97,7 +106,7 @@ jobs:
retention-days: 14

- name: Check coverage threshold
run: make coverage-check
run: make coverage-check COVERAGE_PKGS="${{ steps.pkgset.outputs.coverage_pkgs }}"

- name: Check docs API drift
run: make docs-api-drift
Expand Down Expand Up @@ -138,7 +147,7 @@ jobs:
go test -bench=. -benchmem -count=3 -timeout 120s \
./llm/providers/openaicompat/ \
./llm/capabilities/tools/ \
./agent/memorycore/ \
./agent/capabilities/memory/ \
| tee benchmark-current.txt

- name: Compare with baseline (if available)
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@ benchmarks/latest.txt
# Temporary files
.tmp/
.omx/
.issue-tmp/
Loading
Loading