ZHERP-Automation
Purpose
Run the ZHERP/YigoERP SVN automation as a staged, script-backed workflow. The skill should make the mechanical steps deterministic and leave code-review judgment to the model plus requesting-code-review.
Non-Negotiables
- Communicate in Chinese. Use Windows/PowerShell. Treat Chinese text files as UTF-8.
- This is an SVN workflow, not a Git workflow.
- Never expose
SVN_PASSWORD. - In sandbox/restricted environments, use workspace-local SVN config and keep the main user SVN auth cache out of the workflow.
- Run only the routed goal for the current request. Use historical artifacts only when the user asks to inspect or diagnose history.
Execution Model
Before running prepare, auth-check, log, update, Maven, or any other command, resolve the current run’s workspace and user-facing goal.
- The user-facing goal must come from the user request or automation task definition. If it is missing or ambiguous, stop and ask with this exact numbered list:
- 更新代码
- 生成实体
- Maven 编译
- 更新代码 + 生成实体 + Maven 编译
- 代码审查
workspacemay come from the user request, automation configuration, script arguments, or an execution context that clearly identifies the ZHERP SVN working copy. If it cannot be determined confidently, stop and ask for it.restrictedmust be decided from the current execution environment and user-provided config; pass explicit-Restricted yesor-Restricted no.time_rangeis needed only for 代码审查, or when the user explicitly asks to inspect SVN commit records. Use explicit start/end when provided; otherwise use the default business window for “today/current day”: previous local date19:00:00through current local date18:59:59.revision_filteris optional and deterministic. Use script parameters for exact author/message filtering only; leave semantic filtering to Codex afterlog.jsonexists.
Route the user-facing goal before asking for optional inputs or running commands. Keep script command names internal.
| 用户目标 | 必要输入 | 内部命令流 | 输出 |
|---|---|---|---|
| 更新代码 | workspace, restricted |
auth-check -> update |
更新结果 |
| 生成实体 | workspace |
entity-generate |
实体生成结果 |
| Maven 编译 | workspace |
maven-build |
编译结果 |
| 更新代码 + 生成实体 + Maven 编译 | workspace, restricted |
auth-check -> post-log-prep |
准备结果 |
| 代码审查 | workspace, restricted, time_range |
auth-check -> log -> post-log-prep -> diff -> review -> report |
审查报告 |
SVN 提交记录查询是辅助能力,不是默认用户目标。只有用户明确要求“查提交”“看日志”或“列 revision”时,才执行 auth-check -> log,输出 log.json 摘要并停止。
如果配置缺失或不明确,只读取 environment.md 中与当前阻塞相关的部分。
Script Contract
Use scripts/zherp_svn.ps1 for mechanical steps. Resolve this path from the directory containing this SKILL.md; it is not <workspace>\scripts\zherp_svn.ps1. Do not reimplement SVN/Maven command assembly unless the script is unavailable.
prepare is optional diagnostics. It may show workspace-local env/config files, but it does not decide whether the current run is restricted; the agent still must pass explicit -Restricted yes or -Restricted no.
Every SVN-backed route starts with auth-check, then follows the command flow selected in the Execution Model.
$skillDir = "<directory containing this SKILL.md>"
$script = Join-Path $skillDir "scripts\zherp_svn.ps1"
$workspace = "<workspace>"
$restricted = "<yes-or-no>"
$runId = Get-Date -Format "yyyyMMdd-HHmmss"
$runDir = Join-Path $workspace ("automation-output\svn审查\" + (Get-Date -Format "yyyy-MM-dd") + "\run-" + $runId)
powershell -NoProfile -ExecutionPolicy Bypass -File $script auth-check -Workspace $workspace -Restricted $restricted
Use log only when the user explicitly asks to query SVN commits or run code review. Do not run it for update/entity/build-only requests.
The log command supports only deterministic filters:
-IncludeAuthors "a,b": keep only exact SVN authors.-ExcludeAuthors "a,b": skip exact SVN authors.-SkipMessageContains "text1,text2": skip messages containing literal text.-NoDefaultSkipRules: disable the default Jenkins/ZHERP skip rules.
powershell -NoProfile -ExecutionPolicy Bypass -File $script log -Workspace $workspace -Start "<start>" -End "<end>" -Restricted $restricted -Output (Join-Path $runDir "log.json")
For full code review, read that current run log and continue only if reviewable_revisions is non-empty:
$log = Get-Content -Raw -Encoding UTF8 (Join-Path $runDir "log.json") | ConvertFrom-Json
$reviewRevs = @($log.reviewable_revisions | ForEach-Object { $_.revision })
powershell -NoProfile -ExecutionPolicy Bypass -File $script post-log-prep -Workspace $workspace -Restricted $restricted
powershell -NoProfile -ExecutionPolicy Bypass -File $script diff -Workspace $workspace -Revisions ($reviewRevs -join ",") -Restricted $restricted -OutputDir (Join-Path $runDir "diffs")
post-log-prep is intentionally serial: svn update -> entity-generate -> maven-build.
Read script JSON status before deciding the next step:
ok: continue.need_env: stop. The script creates<workspace>\.zherp-automation\svn-automation.envif missing; tell the user to fillSVN_USERNAMEandSVN_PASSWORDin that local file, then continue after they confirm. Never ask the user to send SVN credentials in chat.restricted_unresolved: stop, decide and pass explicit-Restricted yes/no.workspace_invalid,svn_not_found,config_error,path_out_of_scope: stop and ask for the missing/fixed input.auth_failed: stop and report本次阻塞于 SVN 远端认证失败.log_failed,update_failed, Maven failures: stop at that stage.diff_failed: review may continue only for retrieved diffs; report that the conclusion is limited.
Evidence Contract
- Use only current-run artifacts as evidence for the active run.
- When the current goal runs
log, writerunDir\log.json. - When the current goal runs
diff, writerunDir\diffs. log.json.revisionsis the raw revision-discovery list.log.json.reviewable_revisionsis the only review candidate list.log.json.filterrecords exact script filter settings.log.json.skipped_revisionscontains revisions skipped by script rules. Each skipped item must includeskip_reason, such asdefault_message_contains:【Jenkins 发布版本】,include_author_mismatch:<author>, orexclude_author:<author>.- Final responses and reports must identify the current run’s
time_range,log.json, diff manifest, and report path only when those artifacts apply to the requested goal.
Review Handling
只有“代码审查”进入本节。如果用户只是明确要求查看 SVN 提交记录,执行 log、汇总总提交数/候选提交数/跳过提交数,然后在进入本节前停止。
- 代码审查:
- If
count == 0, write the short无新增提交report. - Otherwise use only current-run
reviewable_revisions. - If
reviewable_revisionsis empty, write the short无需要审查的提交report. - Run
post-log-prep; stop on failure. - Pull diffs for
reviewable_revisions. - Review using requesting-code-review/SKILL.md.
- Write the report using report-template.md under
runDir.
- If
If the user adds semantic filtering instructions such as “only review Blue Sky related commits” or “exclude pure wording changes,” apply them after reading log.json.reviewable_revisions. Record the semantic filter instruction, selected revisions, excluded revisions, and exclusion reasons in the run summary or review report. Keep log.json as the script-generated fact layer.
Maven Defaults
- Main compile:
compile -DskipTests. - Entity generation:
-pl ../erp-entity-generator package. - Full review order: entity generation before Maven compile.
When To Load References
- Load environment.md only for missing/failed configuration, env template, restricted SVN details, Maven path/settings, or automations writable-roots.
- Load report-template.md only when writing a review report.
- Load requesting-code-review/SKILL.md only when code review is requested.