Skip to content

[feature] deg改进为规则引擎#228

Closed
fatsheep2 wants to merge 25 commits into
deb-sig:masterfrom
fatsheep2:codex-rule-condition-runtime
Closed

[feature] deg改进为规则引擎#228
fatsheep2 wants to merge 25 commits into
deb-sig:masterfrom
fatsheep2:codex-rule-condition-runtime

Conversation

@fatsheep2

@fatsheep2 fatsheep2 commented May 29, 2026

Copy link
Copy Markdown
Contributor

Description

本 PR 增加运行时模板规则引擎和外部 provider template registry 支持,并将主库中的 provider 模板迁移到独立的 deg-provider-template 仓库维护。

主要变化包括:

  • 增加 runtime template import/config 流程。
  • 增加模板规则表达式与 action 引擎。
  • 增加 provider registry 支持。
  • 补充 runtime template、config、rules 使用文档。
  • 修复文档搜索,内置 jieba 词典。
  • 移除主库中的 provider template fixtures 和 runtime golden tests,改由模板仓库维护。

未关联 issue。

Motivation and Context

此前 provider 专用导入逻辑、模板数据和主库耦合较重。模板更新需要修改 DEG 主库,也容易出现主库和模板仓库两份模板不一致的问题。

新的结构中,DEG 主库只负责解释器、运行时规则引擎、CLI 和 registry 加载能力;deg-provider-template 负责维护 provider 模板、starter rules、样例账单、expected 输出和模板回归测试。

Dependencies

本 PR 需要配合模板仓库 PR:

deg-provider-template@codex/runtime-template-sync

建议先合并本 DEG runtime PR,再合并模板仓库 PR。模板仓库 CI 默认从 DEG main 安装并运行全量模板验证。

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How has this been tested?

  • Test A: 主库单元测试
go test ./...
  • Test B: 使用本 PR 构建出的 DEG 二进制跑模板仓库全量回归
go build -o /tmp/deg-pr .
cd ../deg-provider-template
DEG_BIN=/tmp/deg-pr ./scripts/verify.sh

@fatsheep2 fatsheep2 requested review from a team, Triple-Z and gaocegege as code owners May 29, 2026 14:37
@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@fatsheep2 fatsheep2 changed the title Codex rule condition runtime [feature] deg改进为规则引擎 May 29, 2026
@fatsheep2

Copy link
Copy Markdown
Contributor Author

@gaocegege @Triple-Z @deb-sig/generator-dev need review

我测试了一下没有什么问题,主要是新增的通用provider,config init从模板仓库下拉对应provider的个人规则骨架,deg template list可以看模板仓库内所有可用的provider,修改后使用deg import --rules <个人规则文件>.yaml ...(和原来参数差不多,beancount/ledget,选择账本,输出文件)

这样的好处就是可以尽量用通用规则去描述不同provider的规则,对于review来说减轻很多压力,同时也避免了原来的各家方言的情况,也比较有利于社区参与deg的贡献

@fatsheep2 fatsheep2 closed this May 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant