Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
193 commits
Select commit Hold shift + click to select a range
195b5f6
feat(ops): add one-command production deployment
cb8010d6 May 12, 2026
2dbea32
Localize production docs for Chinese-first bilingual support
cb8010d6 May 12, 2026
f55a7a9
feat: implement trial balance view and enhance production-readiness (…
cb8010d6 May 14, 2026
eca8062
chore: save current state with prod start script and i18n fixes befor…
cb8010d6 May 15, 2026
8d1cacb
feat: complete shipment and async form refactors
cb8010d6 May 15, 2026
2f5f65b
feat: harden production readiness foundation
cb8010d6 May 19, 2026
01f2084
fix: enforce inventory transaction company relation
cb8010d6 May 19, 2026
9d68a2d
fix: reject forged tenant company ids
cb8010d6 May 19, 2026
c1ebe4e
Fix production readiness review findings
cb8010d6 May 20, 2026
9ef3f31
Add correction wizard for dynamic views
cb8010d6 May 23, 2026
c1cb910
Add procurement receipt and payable flow
cb8010d6 May 24, 2026
6b02f09
Post manufacturing inventory from work reports
cb8010d6 May 24, 2026
8aa1758
Add finance DLQ exception center
cb8010d6 May 24, 2026
3be637f
Use snapshots for inventory realtime ledger
cb8010d6 May 24, 2026
63c03aa
Add trusted AI preview and Chat2SQL exports
cb8010d6 May 24, 2026
1565d69
Complete manufacturing workbench and nested BOM issue
cb8010d6 May 24, 2026
ec19057
feat: 完善财务关账与核心ERP流程
cb8010d6 Jun 4, 2026
8d6ba80
feat: 增加银行流水对账工作台
cb8010d6 Jun 4, 2026
b943bde
feat: 增加银行对账匹配候选
cb8010d6 Jun 4, 2026
307da5a
feat: 增加银行流水自动匹配
cb8010d6 Jun 4, 2026
1506cef
feat: 增加应付付款工作台
cb8010d6 Jun 4, 2026
fd5ab2c
feat: 增加期间损益表
cb8010d6 Jun 8, 2026
9f76285
feat: 增加资产负债表
cb8010d6 Jun 8, 2026
aa62640
feat: 增加现金流量表
cb8010d6 Jun 8, 2026
4c7311f
feat: 增加总账明细账
cb8010d6 Jun 8, 2026
e58e1dd
feat: 增加客户对账单
cb8010d6 Jun 8, 2026
4fcf872
feat: 增加供应商对账单
cb8010d6 Jun 8, 2026
1b84325
feat: 增加库存补货建议
cb8010d6 Jun 8, 2026
5caae6b
feat: 增加生产物料可用性分析
cb8010d6 Jun 8, 2026
aec8d65
feat: 打通生产缺料采购闭环
cb8010d6 Jun 9, 2026
eb702f4
feat: 生产缺料考虑在途采购
cb8010d6 Jun 9, 2026
1045ccc
feat: 展示生产在途采购来源
cb8010d6 Jun 9, 2026
314651e
feat: 增加订单交付可承诺分析
cb8010d6 Jun 9, 2026
b13ee7d
feat: 订单列表展示交付风险
cb8010d6 Jun 9, 2026
f616ede
feat: 适配移动端订单工作台
cb8010d6 Jun 9, 2026
460424e
feat: 适配移动端财务导航
cb8010d6 Jun 9, 2026
f1b5598
feat: 适配移动端采购记录
cb8010d6 Jun 9, 2026
d862ec8
chore: 强化部署环境变量门禁
cb8010d6 Jun 9, 2026
6b1e852
chore: 修复生产依赖高危漏洞
cb8010d6 Jun 9, 2026
0640c17
ci: 落实生产镜像部署链路
cb8010d6 Jun 10, 2026
7fe96e9
chore: 清理临时修复脚本
cb8010d6 Jun 10, 2026
7f0d6f4
docs: 增加英文 README 入口
cb8010d6 Jun 10, 2026
5954b02
docs: 移除 README 占位门面
cb8010d6 Jun 10, 2026
b4030e7
chore: 强化环境变量模板
cb8010d6 Jun 11, 2026
244debe
docs: 补充 AI Provider 配置说明
cb8010d6 Jun 11, 2026
2f4c460
feat: 优化设置页移动端适配
cb8010d6 Jun 11, 2026
7a9f5f4
feat: 优化销售页移动端订单列表
cb8010d6 Jun 11, 2026
02b67c2
feat: 优化销售订单抽屉移动端明细
cb8010d6 Jun 11, 2026
dba72f5
fix: 增加生产配置启动校验
cb8010d6 Jun 11, 2026
5710589
fix: 加固 AI SQL 只读查询校验
cb8010d6 Jun 11, 2026
0bfc907
fix: 加固认证会话与 CSRF 流程
cb8010d6 Jun 12, 2026
b7133d7
fix: 增加上传文件硬限制
cb8010d6 Jun 12, 2026
f5e268e
fix: 增加关键业务索引
cb8010d6 Jun 12, 2026
6e57c92
fix: 加固简易部署 Compose 配置
cb8010d6 Jun 12, 2026
bbf5a18
fix: 使用非 root 用户运行容器
cb8010d6 Jun 12, 2026
c9985dd
perf: 优化仪表盘和试算平衡查询
cb8010d6 Jun 12, 2026
18e4248
refactor: 抽取财务报表服务
cb8010d6 Jun 12, 2026
fe59156
refactor: 统一后端金额四舍五入工具
cb8010d6 Jun 13, 2026
27c6043
refactor: 统一前端金额四舍五入工具
cb8010d6 Jun 17, 2026
9253f44
refactor: 统一验收脚本金额四舍五入命名
cb8010d6 Jun 17, 2026
52daab3
feat: 添加请求ID和结构化JSON日志
cb8010d6 Jun 17, 2026
6ede7d8
feat: 添加 Prometheus 指标和健康检查端点
cb8010d6 Jun 17, 2026
65366b1
feat: 添加备份脚本 AES-256 加密支持
cb8010d6 Jun 17, 2026
5bd978c
feat: 审计日志写入失败时自动入队 DLQ 重试
cb8010d6 Jun 17, 2026
c8aaa6f
fix: 修复 review 发现的安全和架构问题
cb8010d6 Jun 17, 2026
9f35341
fix: 修正 observability 和备份基础设施缺陷
cb8010d6 Jun 17, 2026
dbc4903
refactor: 抽取库存只读查询服务
cb8010d6 Jun 17, 2026
87a92a8
refactor: extract SupplierStatementService
cb8010d6 Jun 18, 2026
76ca102
refactor: extract finance statement services
cb8010d6 Jun 19, 2026
da7b632
refactor: extract FinanceQueryService
cb8010d6 Jun 19, 2026
3943047
refactor: extract PurchaseQueryService
cb8010d6 Jun 19, 2026
21c5039
refactor: extract purchase order read model
cb8010d6 Jun 19, 2026
2f16410
docs: document service extraction boundaries
cb8010d6 Jun 19, 2026
d75ef2e
refactor: remove dead service code
cb8010d6 Jun 19, 2026
0db3499
docs: update service extraction boundary record
cb8010d6 Jun 19, 2026
42eec1c
refactor: 统一财务和库存共享类型
cb8010d6 Jun 30, 2026
430f02b
fix: 标记库存审批兼容端点废弃
cb8010d6 Jun 30, 2026
cdcce4d
docs: 补充后续重构风险分析
cb8010d6 Jun 30, 2026
315aaac
fix: 加固生产依赖漏洞
cb8010d6 Jun 30, 2026
0e96d98
ci: 改为校验 PR 标题
cb8010d6 Jul 2, 2026
34485cc
fix: 修复 CodeQL 安全告警
cb8010d6 Jul 2, 2026
5ff79e3
fix: 收紧 AI base URL 白名单
cb8010d6 Jul 2, 2026
482fb41
chore: 增加剩余风险审计脚本
cb8010d6 Jul 2, 2026
98f4bb4
fix: 使用安全随机生成临时凭据
cb8010d6 Jul 2, 2026
4acc0e2
chore: 增加 enum 脏数据扫描 SQL 生成器
cb8010d6 Jul 3, 2026
2b160e7
fix: 缓解业务编号时间戳碰撞风险
cb8010d6 Jul 3, 2026
7a71b53
fix: 通过事件队列发布业务事件
cb8010d6 Jul 3, 2026
76c18ba
chore: 增加 enum 脏数据报告脚本
cb8010d6 Jul 3, 2026
13711ce
fix: 通过事件队列发布 workflow 事件
cb8010d6 Jul 3, 2026
dcee0f6
ci: 增加发布风险预检
cb8010d6 Jul 3, 2026
62a8a6a
ci: 支持指定部署镜像标签
cb8010d6 Jul 3, 2026
c5676d8
ci: 增加 Compose 配置校验
cb8010d6 Jul 3, 2026
f62f7be
chore: 固定 MinIO 运行时镜像
cb8010d6 Jul 3, 2026
e3a8ec1
ci: 防止 Compose latest 镜像回归
cb8010d6 Jul 3, 2026
741c9e4
ci: 增加依赖安全审计门禁
cb8010d6 Jul 3, 2026
b15bc66
ci: 为部署流程增加发布前门禁
cb8010d6 Jul 4, 2026
8834282
docs: 更新服务拆分边界记录
cb8010d6 Jul 4, 2026
023b07d
ci: 部署前执行完整验证门禁
cb8010d6 Jul 4, 2026
b6ebebb
fix: 收紧生产配置审计
cb8010d6 Jul 4, 2026
3c0ce6b
ci: 部署前审计远端生产配置
cb8010d6 Jul 4, 2026
e3a9b29
ci: 部署后执行远端健康检查
cb8010d6 Jul 4, 2026
20088b4
fix: 强化部署健康检查状态判定
cb8010d6 Jul 4, 2026
762ca1b
ci: 校验部署变量格式
cb8010d6 Jul 4, 2026
3741950
ci: 串行化部署工作流
cb8010d6 Jul 4, 2026
a73c0cc
docs: 增加项目图谱与上下文摘要
cb8010d6 Jul 4, 2026
cbef953
docs: 记录 Graphify 图谱生成状态
cb8010d6 Jul 4, 2026
0d09d9a
docs: 整理代理上下文入口
cb8010d6 Jul 4, 2026
e170095
fix: require explicit partial shipments
cb8010d6 Jul 10, 2026
4c82341
feat: add low-memory UAT deployment profile
cb8010d6 Jul 10, 2026
7561e9c
docs: record phase one and UAT evidence
cb8010d6 Jul 10, 2026
ad24a94
chore: exclude binary assets from graphify
cb8010d6 Jul 10, 2026
65b165a
docs: define phase two presales boundaries
cb8010d6 Jul 10, 2026
d0ee161
feat: add customer requirement tracer
cb8010d6 Jul 11, 2026
499f466
docs: record requirement tracer UAT
cb8010d6 Jul 11, 2026
f2bebdc
fix: allow local Prisma validation without database url
cb8010d6 Jul 11, 2026
a625b9f
docs: explain database-free local validation
cb8010d6 Jul 11, 2026
8d4aec2
feat: add quote version one tracer
cb8010d6 Jul 11, 2026
0068d60
docs: record quote version one tracer
cb8010d6 Jul 11, 2026
bb4eb1c
test: cover quote v1 in business acceptance
cb8010d6 Jul 11, 2026
d7069ea
docs: record quote v1 remote UAT
cb8010d6 Jul 11, 2026
fc32bcc
feat: add quote creation to requirement workbench
cb8010d6 Jul 11, 2026
e00cce9
docs: record quote workbench UAT
cb8010d6 Jul 11, 2026
bd7871d
feat: add quote version lifecycle commands
cb8010d6 Jul 11, 2026
09e0702
test: add quote lifecycle acceptance
cb8010d6 Jul 11, 2026
6c70f89
docs: record quote lifecycle UAT
cb8010d6 Jul 11, 2026
73091da
feat: add quote lifecycle actions to workbench
cb8010d6 Jul 11, 2026
cff7384
docs: record quote lifecycle workbench deployment
cb8010d6 Jul 11, 2026
bf99726
feat: add contract version one tracer
cb8010d6 Jul 11, 2026
184a4a5
feat: register contracts from accepted quotes
cb8010d6 Jul 11, 2026
86eaafb
test: extend quote acceptance through contract
cb8010d6 Jul 11, 2026
d90aaf0
docs: record contract workbench UAT
cb8010d6 Jul 11, 2026
f88dcc1
feat: add staged contract approval
cb8010d6 Jul 11, 2026
98d9eb1
feat: add contract signing and activation
cb8010d6 Jul 11, 2026
7af2613
docs: record contract signing UAT
cb8010d6 Jul 11, 2026
55f9f52
feat: convert contracts into order batches
cb8010d6 Jul 12, 2026
42a3886
docs: record contract order batch UAT
cb8010d6 Jul 12, 2026
b7aeff0
feat: add controlled engineering documents
cb8010d6 Jul 12, 2026
9be1232
docs: record engineering document UAT
cb8010d6 Jul 12, 2026
1574aab
feat: pin engineering revisions to work orders
cb8010d6 Jul 12, 2026
aed5d96
docs: record work order revision UAT
cb8010d6 Jul 12, 2026
1bf81bc
feat: add controlled engineering change orders
cb8010d6 Jul 12, 2026
242e6e6
docs: record engineering change order UAT
cb8010d6 Jul 12, 2026
975883a
feat: make production reporting atomic and idempotent
cb8010d6 Jul 12, 2026
e2a61ba
docs: record atomic production reporting UAT
cb8010d6 Jul 12, 2026
0d8d96e
feat: add reversible production reporting
cb8010d6 Jul 12, 2026
11c8450
docs: record production report reversal UAT
cb8010d6 Jul 12, 2026
351ab57
fix: make inventory reversals atomic
cb8010d6 Jul 12, 2026
52c5c50
test: add atomic inventory reversal acceptance
cb8010d6 Jul 12, 2026
8f74fd6
docs: record atomic inventory reversal UAT
cb8010d6 Jul 12, 2026
18f981b
docs: record atomic inventory reversal boundary
cb8010d6 Jul 12, 2026
1c000e7
fix: make default sales shipments atomic
cb8010d6 Jul 12, 2026
b66bb11
docs: record atomic sales shipment UAT
cb8010d6 Jul 12, 2026
b13d122
feat: add controlled sales shipment workbench
cb8010d6 Jul 12, 2026
9436165
docs: record sales shipment workbench UAT
cb8010d6 Jul 12, 2026
17d63d4
refactor: type order timeline events
cb8010d6 Jul 12, 2026
c123bfd
refactor: standardize web API errors
cb8010d6 Jul 12, 2026
1abcd53
docs: record remote shipment workbench UAT
cb8010d6 Jul 12, 2026
d1c4824
refactor: stabilize web workspace effects
cb8010d6 Jul 12, 2026
57e7df1
docs: record web workspace stability UAT
cb8010d6 Jul 12, 2026
e08da07
fix: route sales shipping through inventory posting
cb8010d6 Jul 13, 2026
173463b
docs: record shipment bypass UAT
cb8010d6 Jul 13, 2026
2f2f8f7
refactor: stabilize sales order drawer data
cb8010d6 Jul 13, 2026
aa16fed
docs: record sales drawer stability UAT
cb8010d6 Jul 13, 2026
7688f9f
docs: normalize UAT evidence formatting
cb8010d6 Jul 13, 2026
8dbfac5
refactor: isolate data grid compiler boundary
cb8010d6 Jul 13, 2026
5ca0a55
docs: record data grid compiler UAT
cb8010d6 Jul 13, 2026
14c4bcf
test: type shared web and auth fixtures
cb8010d6 Jul 13, 2026
b223ea5
fix: block AI shipment workflow bypass
cb8010d6 Jul 13, 2026
b9256ec
test: verify AI shipment guard in UAT
cb8010d6 Jul 13, 2026
d8d7283
fix: whitelist safe AI workflow actions
cb8010d6 Jul 13, 2026
ca935b1
docs: record AI workflow whitelist UAT
cb8010d6 Jul 13, 2026
dcc2122
fix: enforce domain workflow transaction boundaries
cb8010d6 Jul 13, 2026
f6435ec
docs: record workflow domain guard UAT
cb8010d6 Jul 13, 2026
70943e1
feat: add repeatable sales shipment reversals
cb8010d6 Jul 13, 2026
eb97174
fix: preserve shipment batch on reversal
cb8010d6 Jul 13, 2026
0ddf60a
docs: record repeatable shipment reversal UAT
cb8010d6 Jul 13, 2026
db6de78
fix: harden backup and restore drills
cb8010d6 Jul 13, 2026
12f5a82
docs: record controlled UAT operational gates
cb8010d6 Jul 13, 2026
e26b73a
fix: remove restore drill credential copies
cb8010d6 Jul 13, 2026
c952e42
fix: align cross-platform backup restore drills
cb8010d6 Jul 13, 2026
f9a100b
docs: record cross-platform restore drill
cb8010d6 Jul 13, 2026
499f7ff
fix: make production login guidance environment-aware
cb8010d6 Jul 13, 2026
d7d71ca
fix: improve presales workbench responsiveness
cb8010d6 Jul 13, 2026
12f73ad
docs: record presales workspace UAT
cb8010d6 Jul 13, 2026
8c02541
fix: default web API requests to same-origin proxy
cb8010d6 Jul 13, 2026
676364e
fix: label nested dashboard routes consistently
cb8010d6 Jul 13, 2026
5d88116
docs: record final workspace UAT cleanup
cb8010d6 Jul 18, 2026
98f39e0
docs: clarify UAT check evidence
cb8010d6 Jul 18, 2026
e1f7793
docs: record mobile workspace UAT
cb8010d6 Jul 19, 2026
7d96fd7
fix(mobile): align Expo dependencies and clear audit findings
cb8010d6 Jul 19, 2026
e776432
docs: record exact-image UAT deployment
cb8010d6 Jul 19, 2026
ffc8806
feat(web): improve sales requirement workbench
cb8010d6 Jul 19, 2026
cdd24d0
Add persistent DataGrid column views
cb8010d6 Jul 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
77 changes: 77 additions & 0 deletions .antigravity/skills/diagnose.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
name: diagnose
description: Structured debugging loop for hard bugs or performance regressions. Use when a bug is hard to fix, has multiple possible causes, or requires systematic investigation.
---

# Diagnose

## Philosophy

Debugging is a science. Don't guess; verify. The goal is to move from "something is broken" to "I have a reproducible, minimal case that proves exactly why it's broken."

## Workflow

### 1. Reproduce

Before changing any code, you must be able to trigger the bug reliably.

- [ ] Create a script, test case, or curl command that fails
- [ ] Confirm it fails 100% of the time (or has a known probability)
- [ ] Document the exact environment and inputs

If you can't reproduce it, you can't prove you fixed it.

### 2. Minimise

A giant codebase is a noisy place to debug. Strip away everything that isn't the bug.

- [ ] Reduce the input data to the smallest possible set
- [ ] Remove unrelated code paths
- [ ] Try to reproduce in a standalone script or unit test

**Target**: A "pure" reproduction that involves the minimum number of moving parts.

### 3. Hypothesise

List possible causes. Don't just pick one; list them all.

- [ ] "Is it a race condition?"
- [ ] "Is it an unhandled null?"
- [ ] "Is it a dependency version mismatch?"

Rank them by likelihood.

### 4. Instrument

Add logging, assertions, or use a debugger to verify your hypothesis.

- [ ] "If hypothesis A is true, I should see X in the logs here."
- [ ] Add `console.log` or `DEBUG` statements
- [ ] Use `command_status` to inspect state if running in background

**Rule**: Never change implementation code to fix the bug in this step. Only add observability.

### 5. Fix

Once you've proven the cause, apply the minimal fix.

- [ ] Address the root cause, not the symptom
- [ ] Ensure the fix doesn't break other behaviors (refer to existing tests)

### 6. Regression Test

Prove the bug is gone and stays gone.

- [ ] Run your reproduction case from Step 1 → it should now pass
- [ ] Convert the reproduction into a permanent automated test
- [ ] Run the full test suite

## Checklist

```
[ ] Bug is reliably reproducible
[ ] Reproduction case is minimal
[ ] Hypothesis was verified by data, not gut feel
[ ] Fix addresses root cause
[ ] Regression test is added to the suite
```
55 changes: 55 additions & 0 deletions .antigravity/skills/grill-me.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
name: grill-me
description: Deep-dive interview to uncover hidden assumptions and reach shared understanding. Use when a plan is complex, has high risk, or when you want the user to challenge your design.
---

# Grill Me

## Philosophy

The best designs survive scrutiny. "Grilling" is a process of asking tough questions to ensure every angle has been considered. It's not about finding fault; it's about finding clarity.

## Workflow

### 1. Preparation

The proposer (usually the AI) presents a clear plan or design.

- [ ] Clear goal statement
- [ ] Proposed implementation steps
- [ ] Identified risks

### 2. The Grilling

The interviewer (the user, or the AI acting as a devil's advocate) asks a series of "How", "Why", and "What if" questions.

- [ ] "How does this handle [Edge Case X]?"
- [ ] "Why choose [Approach A] over [Approach B]?"
- [ ] "What if [Dependency Y] is unavailable?"

**Resolution**: Each question must be answered. If an answer is unknown, it becomes a research task.

### 3. Decision Tree Resolution

The grilling continues until all branches of the decision tree have a recommended path.

- [ ] No "we'll figure this out later" allowed for critical paths
- [ ] Trade-offs are explicitly documented

### 4. Final Approval

Once the proposer has successfully answered the questions, the plan is updated and approved.

## Tips for the Interviewer

- Be relentless but constructive
- Focus on boundaries and interfaces
- Look for state management complexities
- Ask about failure modes

## Tips for the Proposer

- Don't be defensive
- If you don't know, say so (and then go find out)
- Use examples to clarify complex logic
- Document the "Why" behind choices
109 changes: 109 additions & 0 deletions .antigravity/skills/tdd.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
---
name: tdd
description: Test-driven development with red-green-refactor loop. Use when user wants to build features or fix bugs using TDD, mentions "red-green-refactor", wants integration tests, or asks for test-first development.
---

# Test-Driven Development

## Philosophy

**Core principle**: Tests should verify behavior through public interfaces, not implementation details. Code can change entirely; tests shouldn't.

**Good tests** are integration-style: they exercise real code paths through public APIs. They describe _what_ the system does, not _how_ it does it. A good test reads like a specification - "user can checkout with valid cart" tells you exactly what capability exists. These tests survive refactors because they don't care about internal structure.

**Bad tests** are coupled to implementation. They mock internal collaborators, test private methods, or verify through external means (like querying a database directly instead of using the interface). The warning sign: your test breaks when you refactor, but behavior hasn't changed. If you rename an internal function and tests fail, those tests were testing implementation, not behavior.

See [tests.md](tests.md) for examples and [mocking.md](mocking.md) for mocking guidelines.

## Anti-Pattern: Horizontal Slices

**DO NOT write all tests first, then all implementation.** This is "horizontal slicing" - treating RED as "write all tests" and GREEN as "write all code."

This produces **crap tests**:

- Tests written in bulk test _imagined_ behavior, not _actual_ behavior
- You end up testing the _shape_ of things (data structures, function signatures) rather than user-facing behavior
- Tests become insensitive to real changes - they pass when behavior breaks, fail when behavior is fine
- You outrun your headlights, committing to test structure before understanding the implementation

**Correct approach**: Vertical slices via tracer bullets. One test → one implementation → repeat. Each test responds to what you learned from the previous cycle. Because you just wrote the code, you know exactly what behavior matters and how to verify it.

```
WRONG (horizontal):
RED: test1, test2, test3, test4, test5
GREEN: impl1, impl2, impl3, impl4, impl5

RIGHT (vertical):
RED→GREEN: test1→impl1
RED→GREEN: test2→impl2
RED→GREEN: test3→impl3
...
```

## Workflow

### 1. Planning

When exploring the codebase, use the project's domain glossary so that test names and interface vocabulary match the project's language, and respect ADRs in the area you're touching.

Before writing any code:

- [ ] Confirm with user what interface changes are needed
- [ ] Confirm with user which behaviors to test (prioritize)
- [ ] Identify opportunities for [deep modules](deep-modules.md) (small interface, deep implementation)
- [ ] Design interfaces for [testability](interface-design.md)
- [ ] List the behaviors to test (not implementation steps)
- [ ] Get user approval on the plan

Ask: "What should the public interface look like? Which behaviors are most important to test?"

**You can't test everything.** Confirm with the user exactly which behaviors matter most. Focus testing effort on critical paths and complex logic, not every possible edge case.

### 2. Tracer Bullet

Write ONE test that confirms ONE thing about the system:

```
RED: Write test for first behavior → test fails
GREEN: Write minimal code to pass → test passes
```

This is your tracer bullet - proves the path works end-to-end.

### 3. Incremental Loop

For each remaining behavior:

```
RED: Write next test → fails
GREEN: Minimal code to pass → passes
```

Rules:

- One test at a time
- Only enough code to pass current test
- Don't anticipate future tests
- Keep tests focused on observable behavior

### 4. Refactor

After all tests pass, look for [refactor candidates](refactoring.md):

- [ ] Extract duplication
- [ ] Deepen modules (move complexity behind simple interfaces)
- [ ] Apply SOLID principles where natural
- [ ] Consider what new code reveals about existing code
- [ ] Run tests after each refactor step

**Never refactor while RED.** Get to GREEN first.

## Checklist Per Cycle

```
[ ] Test describes behavior, not implementation
[ ] Test uses public interface only
[ ] Test would survive internal refactor
[ ] Code is minimal for this test
[ ] No speculative features added
```
107 changes: 64 additions & 43 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,66 +1,87 @@
# ============================================================
# Enterprise ERP (.env.example)
# 复制本文件为 .env 并填写实际值: cp .env.example .env
# OneERP environment template
# Copy this file to .env and replace every CHANGE_ME value.
#
# For local trial deployment, prefer scripts/quickstart.*. It copies
# .env.quickstart and generates local secrets automatically.
# ============================================================

# ---- 数据库 (PostgreSQL) ----
# Prisma 和 Kysely 均使用此连接串
DATABASE_URL=postgresql://eip_user:eip_password@localhost:5432/eip_db
# ---- PostgreSQL ----
POSTGRES_USER=oneerp
POSTGRES_PASSWORD=CHANGE_ME_DATABASE_PASSWORD
POSTGRES_DB=oneerp

# Prisma and Kysely both read DATABASE_URL.
# Keep this value aligned with POSTGRES_* when you change database credentials.
DATABASE_URL=postgresql://oneerp:CHANGE_ME_DATABASE_PASSWORD@localhost:5432/oneerp

# ---- JWT 认证 ----
# 用于签发和校验 Bearer Token,请使用足够随机的强密钥
JWT_SECRET=EIP_SECRET_KEY_SUPER_SECURE
# ---- JWT authentication ----
# Use a unique random value of at least 32 bytes for real deployments.
JWT_SECRET=CHANGE_ME_JWT_SECRET

# ---- Redis ----
REDIS_HOST=localhost
REDIS_PORT=6379

# ---- MinIO 对象存储 ----
# ---- MinIO object storage ----
MINIO_ENDPOINT=127.0.0.1
MINIO_PORT=9000
MINIO_USE_SSL=false
MINIO_ACCESS_KEY=minio_admin
MINIO_SECRET_KEY=minio_password
MINIO_ACCESS_KEY=oneerp_minio
MINIO_SECRET_KEY=CHANGE_ME_MINIO_SECRET

# ---- Initial production admin ----
# Change the initial password immediately after first login.
INIT_ADMIN_EMAIL=admin@oneerp.local
INIT_ADMIN_PASSWORD=CHANGE_ME_ADMIN_PASSWORD
INIT_ADMIN_NAME=Administrator
INIT_COMPANY_NAME=OneERP Company

# ============================================================
# 端口 & URL 对应关系说明
# Ports and URL routing
# ============================================================
# 本地开发 (docker compose up + npm run start:dev / dev)
# ┌─────────────────┬──────────────┬─────────────────────────────────────┐
# │ 服务 │ 默认端口 │ 访问地址 │
# ├─────────────────┼──────────────┼─────────────────────────────────────┤
# │ NestJS API │ API_PORT │ http://localhost:{API_PORT}/api │
# │ Next.js Web │ WEB_PORT │ http://localhost:{WEB_PORT} │
# │ Swagger 文档 │ API_PORT │ http://localhost:{API_PORT}/api/docs│
# └─────────────────┴──────────────┴─────────────────────────────────────┘
# Local development:
# API docs: http://localhost:${API_PORT}/api/docs
# Web: http://localhost:${WEB_PORT}
#
# 前端 → 后端的请求链路:
# 浏览器 ──NEXT_PUBLIC_API_BASE_URL──▶ API 服务
# 开发环境默认值: http://127.0.0.1:{API_PORT}/api (代码内置回退)
# Docker 内部通信: http://api:{API_PORT}/api (compose 网络)
# 生产环境反向代理: /api/proxy (搭配 Next.js rewrites)
# Browser -> Web -> API:
# Development fallback: http://127.0.0.1:${API_PORT}/api
# Docker internal API: http://api:${API_PORT}/api
# Same-origin proxy: /api/proxy
# ============================================================

# ---- API 服务端口 ----
# NestJS API 服务监听端口,docker-compose.prod.yml 中也使用此变量
API_PORT=8000
# 兼容旧配置(NestJS main.ts 读取 process.env.PORT)
PORT=${API_PORT}

# ---- Web 前端端口 ----
# Next.js Web 应用监听端口,docker-compose.prod.yml 中也使用此变量
PORT=8000
WEB_PORT=3000

# ---- OpenAI (可选) ----
# 配置后可启用 AI Command Bar / Chat2SQL / Chat2Dash 等 AI 功能
# 未配置时 AI 功能自动降级为规则引擎
# For production, use real trusted Web origins only.
CORS_ORIGINS=http://localhost:3000
NEXT_PUBLIC_API_BASE_URL=/api/proxy

# ---- Image-based deployment (docker-compose.prod.yml) ----
REGISTRY=ghcr.io
IMAGE_PREFIX=CHANGE_ME_IMAGE_PREFIX
IMAGE_TAG=latest

# ---- AI provider (optional, backend only) ----
# Never expose API keys through NEXT_PUBLIC_* variables.
# If AI_API_KEY is empty, AI features degrade to deterministic/rule-based paths.
AI_PROVIDER=openai-compatible
AI_BASE_URL=https://token-plan-sgp.xiaomimimo.com/v1
AI_API_KEY=
AI_MODEL=mimo-v2.5
AI_PRO_MODEL=mimo-v2.5-pro
AI_REQUEST_TIMEOUT_MS=30000
# Comma-separated allowlist for exact public HTTPS AI API base URLs.
AI_ALLOWED_BASE_URLS=https://token-plan-sgp.xiaomimimo.com/v1
AI_SETTINGS_ENCRYPTION_KEY=CHANGE_ME_AI_SETTINGS_ENCRYPTION_KEY
AI_WRITE_ENABLED=false

# Backward-compatible OpenAI variables. Keep empty unless you intentionally
# want the backend to fall back to them.
OPENAI_API_KEY=
OPENAI_MODEL=gpt-4o-mini
OPENAI_MODEL=

# ---- Web 前端 (Next.js) ----
# 以下变量需在 apps/web/.env.local 中配置(供客户端使用,需 NEXT_PUBLIC_ 前缀)
# NEXT_PUBLIC_API_BASE_URL — 前端 axios 请求后端 API 的 baseURL
# 开发环境可留空(代码内置回退到 http://127.0.0.1:8000/api)
# 生产环境请根据实际部署地址配置,例如:
# NEXT_PUBLIC_API_BASE_URL=https://api.example.com/api
# NEXT_PUBLIC_API_BASE_URL=/api/proxy (搭配 Next.js rewrites 反向代理)
# ---- Backup policy ----
# Copy ops/backup-policy.example.json and adjust local/offsite paths.
BACKUP_POLICY_FILE=ops/backup-policy.example.json
Loading
Loading