Skip to content

Commit 16cbe04

Browse files
authored
Merge pull request #4380 from VisActor/release/2.0.12
[Auto release] release 2.0.12
2 parents 10ce15b + 6921321 commit 16cbe04

92 files changed

Lines changed: 7781 additions & 5366 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ report.html
4747
coverage/
4848

4949
*.local.ts
50+
*.local.md
5051

5152
# Dependency directories
5253
node_modules/
@@ -132,4 +133,4 @@ packages/vchart/__tests__/runtime/node/**.png
132133
# env files
133134
.env.local
134135

135-
*.tsbuildinfo
136+
*.tsbuildinfo

.trae/documents/auto-flow.solo.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Auto Flow(串行编排)Solo 使用说明
2+
3+
- 入口文件:`./.trae/jobs/auto-flow.md`
4+
- 流程:分支预检查 → 自动化测试 → Rush 变更日志 → 创建 PR
5+
6+
## 参数
7+
- `baseBranch`:默认 `develop`
8+
- `lang``zh|en`,默认 `zh`
9+
- `labels`:默认 `[changelog, test]`
10+
- `topic`:可选;用于 PR 标题优化(未提供时用当前分支名)
11+
- `message`:可选;作为 PR body 摘要
12+
- `bumpType`:默认 `auto`
13+
- `notCommit`:默认 `true`
14+
- `head`:可选;未提供时自动推导当前分支
15+
16+
## 前置
17+
- 若需自动创建 PR 或聚合 Issue 标题,请先设置 `GITHUB_TOKEN`(参考 `./.trae/github-token.local.md`
18+
19+
## 使用(Solo)
20+
- 在聊天中发起:“执行 Auto Flow(.trae/jobs/auto-flow.md)”,可附加:
21+
- `topic: feature-legend`
22+
- `message: 'docs: chore(trae): add auto-flow'`
23+
- `mode: browser`(默认以浏览器创建 PR,输出可复制内容与 compare URL)
24+
- (可选)`openBrowser: true`(自动打开浏览器)
25+
26+
## 输出
27+
- `autotest_report``./.trae/jobs/autotest.report.local.md`
28+
- `rush_change_entries``common/changes/**`
29+
- `pr_url`:PR 链接(若已创建)
30+
31+
## 人工检查
32+
- 单测后检查报告与覆盖率摘要
33+
- 变更日志后检查 `common/changes/**`
34+
- PR 前检查标题与正文信息;如需补充 body,请人工完善后再创建

.trae/documents/auto-test.solo.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Autotest(差异驱动单元测试生成)Solo 使用说明
2+
3+
- 入口文件:`./.trae/jobs/auto-test.md`
4+
- 作用:根据 `develop...HEAD` 的代码差异,自动生成/更新测试用例与快照,并运行覆盖率与报告
5+
6+
## 参数
7+
- `sinceBranch`:默认 `develop`
8+
- `project`:默认 `auto`(自动识别变更包);可指定如 `@visactor/vchart`
9+
- `mode``full`(默认)
10+
- `noSnapshot`:是否跳过快照,默认 `false`
11+
- `onlyNew`:仅生成新的自动化区块,默认 `false`
12+
- `reportFormat``md|json`,默认 `md`
13+
- `applyManualOverrides`:应用人工覆写,默认 `true`
14+
- `replaceAutogen`:允许替换已有 `autogen:` 块,默认 `false`
15+
- `dryRun`:仅预览不写文件,默认 `false`
16+
- `preview`:是否预览模式,默认 `false`
17+
- `stopOnError`:遇错停止,默认 `true`
18+
- `focusChangedOnly`:仅聚焦变更,默认 `true`
19+
- `snapshotStrategy``combined`(默认)
20+
- `tempReportPath`:默认 `./.trae/output/autotest.report.local.md`
21+
- `mockDefaults`:默认 `time=fixed(2020-01-01T00:00:00Z)``random=seed(42)`
22+
23+
## 使用(Solo)
24+
- 最简:在聊天中发起“执行 Auto Test Job(.trae/jobs/auto-test.md)”
25+
- 指定包:`project: '@visactor/vchart'`
26+
- 指定输出格式:`reportFormat: 'json'`
27+
28+
## 输出
29+
- `test_files`:新增/更新的 `.test.ts`
30+
- `snapshots`:快照文件
31+
- `coverage_report`:覆盖率摘要
32+
- `manual_nodes`:需人工处理的用例占位
33+
- `temp_markdown_report`:临时报告(默认写入 `./.trae/output/autotest.report.local.md`
34+
35+
## 成功标准
36+
- `tests_generated_for_changed_exports`
37+
- `compile_without_errors`
38+
- `coverage_increase_or_maintained`
39+
40+
## 人工覆写示例
41+
```yaml
42+
manual_overrides:
43+
- target: packages/vchart/src/util/color.ts#parseColor
44+
mocks:
45+
date: fixed(2020-01-01T00:00:00Z)
46+
random: seed(42)
47+
inputs:
48+
- { args: ['#ff0000'], desc: '基本路径' }
49+
- { args: ['invalid'], desc: '异常路径' }
50+
asserts:
51+
- { expect: 'toEqual', value: { r: 255, g: 0, b: 0 } }
52+
```
53+
54+
## 运行与诊断
55+
- 我会自动执行 `rush run -p <project> -s test` 与 `test-cov`
56+
- TypeScript 诊断与覆盖率结果会写入临时报告以便复核
57+
58+
## 注意事项
59+
- 若差异范围为空,建议指定 `project` 以运行目标包测试
60+
- 对低覆盖模块,建议补充手动测试并复跑 Auto Test 以提升覆盖率
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Changelog(Rush 智能变更日志)Solo 使用说明
2+
3+
- 入口文件:`./.trae/jobs/changelog-rush-smart.md`
4+
- 作用:对齐并增强 `change-all.ts`,生成 Rush 变更条目(`common/changes/**`
5+
6+
## 参数
7+
- `sinceBranch`:默认 `develop`
8+
- `message`:可选;若为空自动生成富摘要
9+
- `bumpType``auto|major|minor|patch`,默认 `auto`
10+
- `notCommit`:是否跳过 `git commit`,默认 `true`
11+
- `githubToken`:可选,聚合 Issue 标题时需要
12+
13+
## 使用(Solo)
14+
- 在聊天中发起:“执行 Changelog Job(.trae/jobs/changelog-rush-smart.md)”,可附加:
15+
- `message: 'docs: chore(trae): add auto-flow'`
16+
- `bumpType: patch`
17+
18+
## 输出
19+
- `rush_change_entries`:新增的变更条目路径集合
20+
- `computed_bump_type`:自动判定的 bump 类型
21+
- `final_message`:最终用于 `rush change` 的消息
22+
23+
## 人工检查
24+
- 复核 `common/changes/**` 的内容(包名、类型、comment),必要时重新执行并覆盖 `message/bumpType`
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Create Branch Job(Solo 使用说明)
2+
3+
- 入口文件:`./.trae/jobs/create-branch.md`
4+
- 适用场景:需要在本地通过 Job 统一创建开发分支
5+
6+
## 参数
7+
- `baseBranch`:默认 `develop`
8+
- `branchPrefix`:默认 `chore/trae`
9+
- `topic`:必填,主题描述(例如 `feature-legend`
10+
- `useDateSuffix`:是否追加日期后缀,默认 `true`
11+
12+
## 使用(Solo)
13+
- 在聊天中发起:“执行 Create Branch Job(.trae/jobs/create-branch.md)”,并传入:
14+
- `topic: feature-legend`
15+
16+
## 输出
17+
- `branch_name`:生成的分支名
18+
19+
## 人工检查
20+
- 执行完成后:`git status` 确认当前分支与工作树状态

.trae/documents/pr-create.solo.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# PR 创建 Job(Solo 使用说明)
2+
3+
- 入口文件:`./.trae/jobs/pr-create.md`
4+
- 作用:依据仓库 PR 模版生成正文并创建 PR
5+
6+
## 参数
7+
- `base`:默认 `develop`
8+
- `head`:可选;未提供时自动推导当前分支
9+
- `title`:必填;PR 标题
10+
- `lang``zh|en`,默认 `zh`
11+
- `labels`:可选标签数组
12+
- `draft`:是否草稿,默认 `false`
13+
- `useGhCli`:是否使用 `gh` 创建,默认 `true`
14+
- `mode``auto|gh|rest|browser`(默认 `auto`,优先浏览器免安装)
15+
- `localBodyFile`:是否生成本地可复制正文文件(默认 `false`
16+
- `openBrowser`:是否自动打开 compare URL(默认 `true`
17+
- `commitBeforeCreate`:创建 PR 前是否自动提交未提交变更(默认 `false`
18+
- `commitMessage`:自动提交的 commit 消息(默认 `chore: auto commit before pr`
19+
- `commitAllowEmpty`:是否允许空提交(默认 `false`
20+
- `pushAfterCommit`:提交后是否自动推送当前分支(默认 `true`
21+
- `commitMessageStrategy`:提交信息生成策略(`auto|topic|manual`,默认 `auto`
22+
- `auto`:按变更内容自动判定类型(`docs|test|chore`)、作用域(包名或顶层目录),主题取 `message` 首行或自动摘要
23+
- `topic`:主题优先使用 `title`/外层 `topic`
24+
- `manual`:使用 `commitMessage`
25+
26+
## 前置(登录/令牌)
27+
- 优先方案:使用 GitHub CLI(`gh`)并已登录 → 不需要额外令牌
28+
- 备选方案:无 `gh` 时提供 `GITHUB_TOKEN`(参见 `./.trae/github-token.local.md`
29+
- 兜底方案:生成浏览器 compare URL,使用你浏览器的登录态手动创建 PR
30+
31+
## 使用(Solo)
32+
- 在聊天中发起:“执行 PR Job(.trae/jobs/pr-create.md)”,并传:
33+
- `title: '[Auto] feature-legend'`
34+
- (可选)`head: chore/trae-feature-legend-20251222-1030`
35+
- (可选)`mode: auto|gh|rest|browser`(默认 `auto`
36+
- (可选)`localBodyFile: true|false`(默认 `false`
37+
- (可选)`openBrowser: true|false`(默认 `true`
38+
- (可选)`commitBeforeCreate: true``commitMessage: 'chore: auto commit before pr'``pushAfterCommit: true`
39+
- (可选)`commitMessageStrategy: auto`
40+
41+
## 正文准备
42+
-`message` 已包含摘要与关联信息,可直接作为 body
43+
- 若需要补充,请先人工完善 body 文本,再执行创建(不生成临时文件)
44+
45+
## 输出
46+
- `pr_url`:创建的 PR 链接(`gh/rest`
47+
- `compare_url`:浏览器 compare 页面(`browser`
48+
- `generated_title`:建议标题(便于复制)
49+
- `generated_body_preview`:建议正文(便于复制)
50+
51+
## 人工检查
52+
- 提交前检查标题、关联链接与 Changelog 摘要是否完整

.trae/jobs/README.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# 通过说明文件驱动执行
2+
3+
## 目的
4+
5+
- 不依赖“工作流模版”概念,仅在仓库中放置一个说明文件,描述任务与参数;我将按说明执行并回传报告。
6+
7+
## 放置位置
8+
9+
- 目录:`.trae/jobs/`
10+
- 文件:建议使用 `*.request.md``*.request.json`,便于版本化与审阅。
11+
12+
## 通用字段
13+
14+
- `Task`:任务标识,例如 `Auto Test (diff-with-develop)`
15+
- `Parameters`:运行参数,例如 `sinceBranch``project``mode``noSnapshot``onlyNew``reportFormat``tempReportPath`
16+
- `ExecutionHints`(可选):执行提示,如是否跳过快照、是否仅分析、不写补丁、选择包。
17+
- `StepsOverride`(可选):覆盖默认执行步骤的命令或动作(如自定义 diff 命令)。
18+
19+
## 示例(Markdown 请求)
20+
21+
```
22+
# Task
23+
Auto Test (diff-with-develop)
24+
25+
# Parameters
26+
sinceBranch: develop
27+
project: ''
28+
mode: full
29+
noSnapshot: false
30+
onlyNew: false
31+
reportFormat: md
32+
33+
# ExecutionHints
34+
- skipWrite: false
35+
- stopOnError: true
36+
37+
# StepsOverride
38+
- git fetch --all --prune
39+
- git diff --name-status --diff-filter=AMR develop...HEAD
40+
- rush run -s test
41+
- rush run -s test-cov
42+
```
43+
44+
## 使用方式
45+
46+
- 推荐入口文件:`.trae/jobs/auto-test.md`(已提供,含参数、步骤、人工覆写与成功标准)
47+
- 最简用法(默认参数):在聊天中发起“执行 Auto Test Job(.trae/jobs/auto-test.md)”。
48+
- 可选覆盖参数:`project=@visactor/vchart-theme``reportFormat=json``replaceAutogen=true` 等。
49+
- 我将按 `.trae/jobs/auto-test.md` 的步骤顺序执行:采集差异、分析缺口、生成/更新测试(含函数级注释)、运行覆盖率、生成报告、插入人工节点。
50+
51+
## 结果与报告
52+
53+
- 报告以 `reportFormat` 指定(`md``json`)。
54+
- 默认临时报告写入 `./.trae/output/autotest.report.local.md`(可通过 `tempReportPath` 覆盖)。
55+
- 我会附带执行日志摘要、受影响包、生成/跳过的测试、覆盖率与人工节点清单。
56+
57+
## 旧方案清理
58+
59+
- 旧的“工作流模版”文件与文档已移除:
60+
- `.trae/workflows/autotest.diff-with-develop.json`
61+
- `docs/autotest-workflow.md`
62+
- 现仅保留 Job 文件方案(`.trae/jobs/auto-test.md`)。
63+
64+
## 默认参数(参考)
65+
66+
- `sinceBranch=develop`
67+
- `project=auto`(自动按 diff 识别变更包)
68+
- `mode=full`
69+
- `noSnapshot=false`
70+
- `onlyNew=false`
71+
- `reportFormat=md`
72+
- `applyManualOverrides=true`
73+
- `replaceAutogen=false`
74+
- `dryRun=false`
75+
- `preview=false`
76+
- `stopOnError=true`
77+
- `focusChangedOnly=false`
78+
- `snapshotStrategy=combined`
79+
- `tempReportPath=./.trae/output/autotest.report.local.md`
80+
- `mockDefaults: time=fixed(2020-01-01T00:00:00Z), random=seed(42)`

.trae/jobs/auto-flow.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
---
2+
job: release-prep-pipeline
3+
intent: prepare-release
4+
version: v1
5+
domain: pipeline
6+
runner: trae-solo
7+
parameters:
8+
baseBranch: develop
9+
lang: zh
10+
labels:
11+
- changelog
12+
- test
13+
topic: ''
14+
message: ''
15+
bumpType: auto
16+
notCommit: true
17+
head: ''
18+
mode: auto
19+
commitBeforeFlow: true
20+
commitAllowEmpty: false
21+
pushAfterCommit: true
22+
commitMessageStrategy: auto
23+
enforceCommit: true
24+
commitRetry: 1
25+
required_parameters: []
26+
outputs:
27+
- autotest_report
28+
- rush_change_entries
29+
- pr_url
30+
success_criteria:
31+
- flow_completed
32+
---
33+
34+
# Auto Flow Job(分支 → 单测 → 变更日志 →PR 串行编排)
35+
36+
## 参数检查
37+
38+
- 分支参数 `head` 可选:若未提供,将通过 `git rev-parse --abbrev-ref HEAD` 推导当前分支
39+
- 建议提供 `topic` 以优化 PR 标题;未提供时将回退为当前分支名
40+
41+
## 步骤
42+
43+
1. 分支预检查
44+
45+
- 运行 `git rev-parse --abbrev-ref HEAD` 获取当前分支作为 `head`
46+
- 确认当前分支不是 `main`/`develop`,且工作树状态符合提交规范
47+
- 人工检查点:如不在开发分支,请先自行创建并切换到正确分支
48+
49+
1.1 自动提交未提交变更(当 `commitBeforeFlow==true`
50+
51+
- 检查工作树:`git status --porcelain`
52+
- 若存在未提交变更:
53+
- `git add --all`
54+
- 生成提交信息(按 `commitMessageStrategy`):
55+
- `auto`:类型 `chore`;作用域为顶层或包名(如 `vchart`);主题为 `sync changes before Auto Flow`
56+
- 最终示例:`chore(vchart): sync changes before Auto Flow`
57+
- 运行 `git commit {{#commitAllowEmpty}}--allow-empty{{/commitAllowEmpty}} -m "<auto_message>"`
58+
-`pushAfterCommit==true``git push -u origin {{head}}`
59+
- 提交后校验(当 `enforceCommit==true`):
60+
- 运行 `git status --porcelain`,若非空则视为失败;进行最多 `commitRetry` 次重试(`git add --all && git commit -m '<auto_message>'`),仍失败则中止流程并提示处理
61+
-`commitBeforeFlow==false` 且存在未提交变更:直接失败并提示先完成提交
62+
63+
2. 运行差异驱动单测
64+
65+
- 执行 Job:`.trae/jobs/auto-test.md`
66+
- 传参:`sinceBranch={{baseBranch}}`(其余沿用默认)
67+
- 接收输出:`autotest_report=.trae/output/autotest.report.local.md`
68+
- 人工检查点:打开临时报告,确认新增/更新测试与覆盖率
69+
70+
3. 生成 Rush 变更日志
71+
72+
- 执行 Job:`.trae/jobs/changelog-rush-smart.md`
73+
- 传参:`sinceBranch={{baseBranch}}``message={{message}}``bumpType={{bumpType}}``notCommit={{notCommit}}`
74+
- 接收输出:`rush_change_entries`
75+
- 人工检查点:检查 `common/changes/**` 条目与摘要
76+
77+
4. 创建 PR
78+
79+
- 执行 Job:`.trae/jobs/pr-create.md`
80+
- 传参:
81+
- `base={{baseBranch}}`
82+
- `head={{head}}`
83+
- `title='[Auto] {{topic || head}}'`
84+
- `lang={{lang}}`
85+
- `labels={{labels}}`
86+
- `message={{message}}`(用于正文摘要)
87+
- `bumpType={{bumpType}}`
88+
- `mode={{mode}}`(auto 优先 gh → token → 浏览器 URL)
89+
- `commitBeforeCreate=false`(已在 1.1 阶段完成自动提交)
90+
- 接收输出:`pr_url`
91+
- 人工检查点:最终确认并提交
92+
93+
5. 完成
94+
95+
- 标记 `flow_completed`,返回 `autotest_report``rush_change_entries``pr_url`

0 commit comments

Comments
 (0)