Skip to content
Merged
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
31 changes: 31 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Backend Quality

on:
push:
branches:
- main
pull_request:

jobs:
backend-quality:
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Set up uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true

- name: Install dependencies
run: uv sync --dev

- name: Run backend quality gate
run: make check
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ wheels/

# Virtual environments
.venv
.coverage
.coverage.*
htmlcov/
coverage.xml
26 changes: 24 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: help build-backend build-electron package-dmg clean install-deps
.PHONY: help build-backend build-electron package-dmg clean install-deps lint format format-check test test-cov check

# 项目配置
PROJECT_NAME = AgentForge
Expand Down Expand Up @@ -79,4 +79,26 @@ check-dmg:
ls -lh "$(DMG_OUTPUT)"; \
else \
echo "DMG文件不存在"; \
fi
fi

lint:
@echo "运行 Ruff lint..."
uv run ruff check .

format:
@echo "运行 Ruff format..."
uv run ruff format .

format-check:
@echo "检查代码格式..."
uv run ruff format --check .

test:
@echo "运行 Python 测试..."
uv run pytest

test-cov:
@echo "运行 Python 测试并检查覆盖率..."
uv run pytest --cov --cov-report=term-missing

check: lint format-check test-cov
2 changes: 1 addition & 1 deletion channels/agent_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from __future__ import annotations

import re
from typing import Optional, TYPE_CHECKING
from typing import TYPE_CHECKING, Optional

if TYPE_CHECKING:
from taskboard import TaskDB
Expand Down
5 changes: 3 additions & 2 deletions channels/dir_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

from __future__ import annotations

import json
import os
import re
import json
from typing import Optional, TYPE_CHECKING
from typing import TYPE_CHECKING, Optional

if TYPE_CHECKING:
from taskboard import TaskDB
Expand Down Expand Up @@ -83,6 +83,7 @@ def extract_working_dir_with_claude(prompt: str) -> Optional[str]:

try:
import requests # already in pyproject.toml

resp = requests.post(
"https://api.anthropic.com/v1/messages",
headers={
Expand Down
Loading
Loading