Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
940c454
test: add Prisma migration integration tests for TaxCode engine
cb8010d6 May 5, 2026
94097b7
ci(deploy): 完善部署流程 — 全自动部署、GHCR权限、镜像tag、回滚策略、环境变量完整性
cb8010d6 May 5, 2026
c8eba25
feat(purchase/inventory): add PurchaseOrder, GoodsReceipt, StockPicki…
cb8010d6 May 5, 2026
e62e6ae
docs: update outdated documentation to match code facts
cb8010d6 May 5, 2026
a427d24
feat(metadata): register PurchaseOrder and PurchaseOrderLine DynamicV…
cb8010d6 May 5, 2026
39797c2
test(web): add smoke tests for login, DynamicView, and order detail t…
cb8010d6 May 5, 2026
3e33f8c
feat(tax): TaxService refactor — TaxCode 收口、销售/采购税区分、价税快照、禁止过账改历史
cb8010d6 May 5, 2026
e2208c1
feat(orders): add shipment & stock posting display in sale order detail
cb8010d6 May 5, 2026
c1263cf
docs(arch): deliver architecture documentation suite
cb8010d6 May 5, 2026
aedb5e9
fix(deploy): fix CI/CD deploy failure from test(web) commit 7826a64
cb8010d6 May 5, 2026
a3b27ab
merge-purchase-with-taxcode-schema
cb8010d6 May 5, 2026
7785eea
feat: add purchase order receiving execution module with scan support
cb8010d6 May 5, 2026
33487fb
feat(e2e): add Playwright E2E test suite covering full ERP business c…
cb8010d6 May 5, 2026
9fe1354
feat(purchase-orders): add purchase order CRUD + submit/confirm workflow
cb8010d6 May 5, 2026
3b76489
feat(inventory): add StockPicking-based sales shipment with idempoten…
cb8010d6 May 5, 2026
dd6c7c4
feat(finance): add VendorBill module (PurchaseInvoice / AP)
cb8010d6 May 5, 2026
4fcedff
feat(finance): implement three-way matching for PO/GR/VendorBill
cb8010d6 May 5, 2026
19f6c50
feat(finance): enhance voucher posting with line-level account mapping
cb8010d6 May 5, 2026
1d10ad3
chore: establish validated project baseline
cb8010d6 May 5, 2026
4cc31d5
fix(ci): sync root lockfile (#7)
cb8010d6 May 6, 2026
8e8ebcb
docs(runbooks): add module handoff guides (#6)
cb8010d6 May 6, 2026
b1add4c
test(api): harden purchase receiving flow (#8)
cb8010d6 May 6, 2026
ec87a15
docs: require bilingual ai reviews (#10)
cb8010d6 May 6, 2026
e6ac103
test(api): tighten finance accounting assertions (#11)
cb8010d6 May 6, 2026
f97f8a0
test(api): harden inventory picking workflow (#12)
cb8010d6 May 6, 2026
24d1f4a
fix(web): reduce dashboard lint warnings (#9)
cb8010d6 May 6, 2026
3dff0fc
fix(ci): skip commitlint for release PRs
cb8010d6 May 6, 2026
9cdfce3
fix(dev): stabilize local develop baseline
cb8010d6 May 6, 2026
a90d4da
fix(api): add purchaseOrder metadata and fix settings page field refe…
cb8010d6 May 6, 2026
43fe678
Merge branch 'agent/api/dynamic-purchase-order-fix' into develop
cb8010d6 May 6, 2026
c20fb59
style(api): fix prettier formatting for purchaseOrder kanban column
cb8010d6 May 6, 2026
43a3b78
refactor(api): replace unsafe Chat2SQL with safe Prisma-based query s…
cb8010d6 May 6, 2026
74891be
Merge branch 'agent/api/chat2sql-safe-readonly' into develop
cb8010d6 May 6, 2026
08a20a1
docs: add security runbook covering Chat2SQL, JWT, CORS/CSP, tenant i…
cb8010d6 May 7, 2026
2ae7c8e
Merge branch 'agent/docs/security-runbook' into develop
cb8010d6 May 7, 2026
20bf2ad
docs: add Float money field audit for Decimal migration
cb8010d6 May 7, 2026
4e444b2
Merge branch 'agent/db/money-decimal-audit' into develop
cb8010d6 May 7, 2026
0df740b
feat(web): add orders, production, and finance to sidebar navigation
cb8010d6 May 7, 2026
b81f8e4
Merge branch 'agent/web/module-navigation-completion' into develop
cb8010d6 May 7, 2026
92ef8ae
feat(web): improve DynamicView error/loading UX with retry and spinner
cb8010d6 May 7, 2026
5e2821a
Merge branch 'agent/web/settings-operational-polish' into develop
cb8010d6 May 7, 2026
3a76e07
test(web): update DynamicView loading text to match updated UX
cb8010d6 May 7, 2026
1150c53
docs: add local business test guide for onboarding and QA
cb8010d6 May 7, 2026
8903fdf
Merge branch 'agent/docs/local-business-test-guide' into develop
cb8010d6 May 7, 2026
9f57001
feat(api): implement refresh token with rotation and reuse detection
cb8010d6 May 7, 2026
fe90a40
Merge branch 'agent/api/auth-refresh-token' into develop
cb8010d6 May 7, 2026
a6d74ca
refactor(db): migrate P0 money fields from Float to Decimal(19,4)
cb8010d6 May 7, 2026
7ce95b2
Merge branch 'agent/db/money-decimal-migration' into develop
cb8010d6 May 7, 2026
9d4b43a
style(web): fix lint warnings in FormEngine, SaleOrderDrawer, api.test
cb8010d6 May 7, 2026
53d2458
Merge branch 'agent/test/remove-web-lint-warnings' into develop
cb8010d6 May 7, 2026
1b81c8f
docs: add npm workspaces migration assessment
cb8010d6 May 7, 2026
b8a1e42
Merge branch 'agent/tooling/workspaces-design' into develop
cb8010d6 May 7, 2026
d2e42ac
test(e2e): add refresh token tests to auth E2E suite
cb8010d6 May 7, 2026
6cdd73c
Merge branch 'agent/test/e2e-auth-refresh-token' into develop
cb8010d6 May 7, 2026
0e87922
test(e2e): rewrite purchase flow to cover PO create/query/submit/confirm
cb8010d6 May 7, 2026
a783860
Merge branch 'agent/test/purchase-e2e' into develop
cb8010d6 May 7, 2026
62abb35
fix(web): set turbopack.root to suppress Next.js multi-lockfile warning
cb8010d6 May 7, 2026
7f34fa5
Merge branch 'agent/ci/next-root-warning' into develop
cb8010d6 May 7, 2026
9904ec2
fix(ts): add ignoreDeprecations to suppress TS 6.0 deprecation warnings
cb8010d6 May 7, 2026
3415fcb
Merge branch 'agent/ci/tsconfig-deprecation-fix' into develop
cb8010d6 May 7, 2026
1856a1e
feat(api): add journal reversal, trial balance, PO cancel and securit…
cb8010d6 May 8, 2026
e492713
fix(deps): resolve remaining security vulnerabilities in api and web …
cb8010d6 May 8, 2026
740e63b
feat(api): implement fine-grained RBAC with PermissionsGuard
cb8010d6 May 8, 2026
9830965
feat(web): support custom actions and subtable editing in dynamic view
cb8010d6 May 8, 2026
fc53233
fix(api): fix prettier linting issues from previous PR
cb8010d6 May 8, 2026
5f96ef1
feat(web): implement RBAC context and conditional UI rendering
cb8010d6 May 8, 2026
74df4ac
ci: fix GitHub Actions workflows and Next.js turbopack root warning
cb8010d6 May 8, 2026
e676d2b
feat(web): implement procurement and finance UI
cb8010d6 May 8, 2026
5e860d7
fix(api): fix prettier linting issues in metadata service
cb8010d6 May 8, 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
64 changes: 64 additions & 0 deletions .clinerules
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# OneERP Agent Rules Adapter

This file mirrors the generic rules in `AGENTS.md` for tools that read repository rule files automatically. Do not put tool-specific policy here unless absolutely required.

## Fixed Context

Do not rediscover the whole repository for every task. Start from:

- `AGENTS.md`
- `docs/README.md`
- `docs/architecture/ARCHITECTURE.md`
- `docs/architecture/DEVELOPMENT_WORKFLOW.md`
- `docs/architecture/STANDARDS.md`
- `docs/architecture/QUALITY_GATES.md`

## Multi-Agent Task Policy

Use one card per module boundary. Each card must declare:

- goal
- scope
- forbidden files
- required reading
- acceptance command
- changed files
- residual risk

## Conflict Policy

Never assign two agents to edit these files at the same time:

- `apps/api/prisma/schema.prisma`
- `apps/api/src/app.module.ts`
- `apps/web/src/lib/ui-schema.ts`
- `apps/api/src/core/**`
- `apps/web/src/components/core/**`
- `package-lock.json`

## Branch Policy

- Daily work: `agent/<scope>/<task>` from `develop`
- Integration: PR into `develop`
- Release: PR from `develop` into `main`
- Do not push directly to `main`

## Validation Policy

Before opening a PR, run the narrowest relevant test plus the full gate:

```bash
npm run validate
```

When CI fails, classify the failure first:

- dependency/install
- Prisma/migration
- TypeScript
- ESLint
- unit test
- build
- Docker/deploy

Fix only the first real root cause.
4 changes: 3 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,10 @@ apps/desktop
# Test files
**/test
**/__tests__
**/*.spec.ts
**/*.test.ts
**/*.test.tsx
**/*.spec.ts
**/*.spec.tsx

# Logs
*.log
Expand Down
21 changes: 21 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,24 @@ OPENAI_MODEL=gpt-4o-mini
# 生产环境请根据实际部署地址配置,例如:
# NEXT_PUBLIC_API_BASE_URL=https://api.example.com/api
# NEXT_PUBLIC_API_BASE_URL=/api/proxy (搭配 Next.js rewrites 反向代理)

# ============================================================
# 生产环境专用变量 (仅 docker-compose.prod.yml 使用)
# ============================================================
# 以下变量仅在生产部署时需要,在 .env 中按需配置
#
# ---- Docker 镜像 ----
# IMAGE_OWNER — 必填! GitHub 用户名或组织名,用于拉取 GHCR 镜像
# IMAGE_TAG — 镜像标签,默认 latest;回滚时指定 commit SHA
# REGISTRY — 镜像仓库地址,默认 ghcr.io
# IMAGE_OWNER=
# IMAGE_TAG=latest
# REGISTRY=ghcr.io
#
# ---- CORS ----
# CORS_ORIGINS — API 的 CORS 白名单 (逗号分隔),生产环境务必包含前端域名
# CORS_ORIGINS=https://your-domain.com
#
# ---- Nginx (可选) ----
# HTTP_PORT=80
# HTTPS_PORT=443
21 changes: 13 additions & 8 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@

## 必读文档

- `AGENTS.md`
- `docs/README.md`
- `docs/architecture/ARCHITECTURE.md`
- `docs/architecture/DEVELOPMENT_WORKFLOW.md`
- `docs/architecture/STANDARDS.md`
- `docs/architecture/QUALITY_GATES.md`
- `docs/plans/PROJECT_PLAN_AND_STATUS.md`
- `docs/plans/EXECUTION_PLAN.md`
- `docs/plans/CORE_MODULES_DEV_PLAN.md`

## 后端开发规则
Expand Down Expand Up @@ -54,18 +58,19 @@

## 提交前检查

在仓库根目录执行:
在仓库根目录优先执行:

```bash
npm run lint
npm run test
npm run validate
```

如果某个子应用未配置测试,至少确保可构建:
定位问题时可拆分执行:

```bash
cd apps/api && npm run build
cd ../web && npm run build
npm run typecheck
npm run lint
npm run test
npm run build
```

## PR 要求
Expand All @@ -74,4 +79,4 @@ cd ../web && npm run build
2. 列出数据库变更和回滚方式(若有)。
3. 提供接口变更说明(若有)。
4. 前端改动附截图(若有)。
5. 必须通过 CI。
5. 必须通过 CI。
27 changes: 27 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## Summary / 摘要

### 中文
-

### English
-

## Validation / 验证

### 中文
- [ ] 已运行相关本地验证:
- [ ] 如未运行,请说明原因:

### English
- [ ] Relevant local validation was run:
- [ ] If not run, explain why:

## Review Notes / Review 备注

### 中文
- 主要风险:
- 需要 reviewer 重点查看:

### English
- Main risks:
- Areas needing reviewer attention:
5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,8 @@ jobs:
run: npm ci
working-directory: apps/web

- name: Run Prisma migrations
run: npx prisma migrate deploy --schema=./prisma/schema.prisma
working-directory: apps/api
- name: Validate Prisma schema
run: npm --prefix apps/api run prisma:validate

# Policy: ``npm run validate`` runs format -> lint -> typecheck -> test -> build.
# The lint step must NOT use --fix in CI; developers use ``npm run lint:fix`` locally.
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: CodeQL

on:
pull_request:
branches: [main, develop]
push:
branches: [main, develop]
schedule:
- cron: "24 18 * * 0"

jobs:
analyze:
name: Analyze JavaScript and TypeScript
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

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

- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
languages: javascript-typescript
build-mode: none

- name: Perform CodeQL analysis
uses: github/codeql-action/analyze@v4
90 changes: 56 additions & 34 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ on:
required: false
default: "true"
type: boolean
image_tag:
description: "镜像标签 (留空=latest, 填 commit SHA=回滚到指定版本)"
required: false
default: ""
type: string

env:
REGISTRY: ghcr.io
Expand All @@ -23,6 +28,8 @@ env:
jobs:
# ---- Build & Push API Docker Image ----
build-api:
# 手动触发且未勾选 deploy_api 时跳过
if: ${{ github.event_name != 'workflow_dispatch' || inputs.deploy_api }}
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down Expand Up @@ -65,6 +72,8 @@ jobs:

# ---- Build & Push Web Docker Image ----
build-web:
# 手动触发且未勾选 deploy_web 时跳过
if: ${{ github.event_name != 'workflow_dispatch' || inputs.deploy_web }}
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down Expand Up @@ -105,11 +114,12 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max

# ---- Deploy to Server (placeholder — customize for your infra) ----
# ---- Deploy to Production Server ----
deploy:
needs: [build-api, build-web]
# 仅 main 分支 push 或手动触发时执行部署
if: ${{ always() && (github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch') && !failure() && !cancelled() && (needs.build-api.result == 'success' || needs.build-web.result == 'success') }}
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'

environment:
name: production
Expand All @@ -126,36 +136,48 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# ---- Option A: Deploy via SSH (uncomment and configure) ----
# - name: Deploy to server via SSH
# uses: appleboy/ssh-action@v1
# with:
# host: ${{ secrets.DEPLOY_HOST }}
# username: ${{ secrets.DEPLOY_USER }}
# key: ${{ secrets.DEPLOY_SSH_KEY }}
# script: |
# cd /opt/oneerp
# docker compose pull
# docker compose up -d --remove-orphans
# docker image prune -f

# ---- Option B: Deploy via Docker Compose on self-hosted runner ----
# - name: Deploy with Docker Compose
# run: |
# docker compose -f docker-compose.prod.yml pull
# docker compose -f docker-compose.prod.yml up -d --remove-orphans
# docker image prune -f

- name: Deployment placeholder
- name: Determine image tag
id: tag
run: |
echo "::notice::Deploy step is configured as a placeholder."
echo "To enable automatic deployment, uncomment one of the options above."
echo ""
echo "Required secrets for SSH deployment:"
echo " - DEPLOY_HOST: Server IP or hostname"
echo " - DEPLOY_USER: SSH username"
echo " - DEPLOY_SSH_KEY: SSH private key"
echo ""
echo "Published images:"
echo " - ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}-api:latest"
echo " - ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}-web:latest"
TAG="${{ inputs.image_tag }}"
if [ -z "$TAG" ]; then
TAG="latest"
fi
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "::notice::Deploying images with tag: $TAG"

- name: Deploy to server via SSH
uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_SSH_KEY }}
script: |
cd /opt/oneerp
echo "=== Pulling images (tag: ${{ steps.tag.outputs.tag }}) ==="
IMAGE_TAG=${{ steps.tag.outputs.tag }} docker compose -f docker-compose.prod.yml pull
echo "=== Starting services ==="
IMAGE_TAG=${{ steps.tag.outputs.tag }} docker compose -f docker-compose.prod.yml up -d --remove-orphans
echo "=== Waiting for health checks ==="
sleep 15
IMAGE_TAG=${{ steps.tag.outputs.tag }} docker compose -f docker-compose.prod.yml ps
echo "=== Pruning old images ==="
docker image prune -f

- name: Verify deployment
uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_SSH_KEY }}
script: |
cd /opt/oneerp
echo "=== Checking container health ==="
docker compose -f docker-compose.prod.yml ps --format "table {{.Name}}\t{{.Status}}"
# 检查 API 是否可访问
if curl -sf http://localhost:${API_PORT:-8000}/api/docs > /dev/null 2>&1; then
echo "✅ API health check passed"
else
echo "❌ API health check failed"
exit 1
fi
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,9 @@ __pycache__/


.git.backup-*

# Playwright
test-results/
playwright-report/
blob-report/
e2e-dist/
Loading
Loading