Добавлены action и скрипт синхронизации parent meta, уточнены правила подтверждения
This commit is contained in:
18
ACTIONS.md
18
ACTIONS.md
@@ -65,3 +65,21 @@ ACTIONS:
|
|||||||
- no_unverified_claims
|
- no_unverified_claims
|
||||||
outputs:
|
outputs:
|
||||||
- final_user_report
|
- final_user_report
|
||||||
|
meta:sync-parent:
|
||||||
|
intent: sync_dependency_moduleshortdesc_from_parent_meta
|
||||||
|
inputs:
|
||||||
|
- parent_meta_path
|
||||||
|
- Mods/DnD 5.5e AIO Russian/meta.lsx
|
||||||
|
plan:
|
||||||
|
- read_parent_moduleinfo_fields
|
||||||
|
- validate_required_fields_folder_md5_name_publishhandle_uuid_version64
|
||||||
|
- update_target_dependencies_moduleshortdesc_fields
|
||||||
|
- validate_xml_structure
|
||||||
|
- report_changed_fields
|
||||||
|
checks:
|
||||||
|
- xml_valid
|
||||||
|
- required_parent_fields_present
|
||||||
|
- only_dependencies_moduleshortdesc_changed
|
||||||
|
outputs:
|
||||||
|
- Mods/DnD 5.5e AIO Russian/meta.lsx
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,8 @@
|
|||||||
2. merging to `main` immediately and deleting the `fix/*`/`feat/*` branch.
|
2. merging to `main` immediately and deleting the `fix/*`/`feat/*` branch.
|
||||||
- If push fails: retry up to 2 more times with 3s pause.
|
- If push fails: retry up to 2 more times with 3s pause.
|
||||||
- Never auto-commit/auto-push without explicit user approval.
|
- Never auto-commit/auto-push without explicit user approval.
|
||||||
|
- Approval prompts for pending actions: short direct question in imperative form, no soft/opening phrases.
|
||||||
|
- If multiple actions or combinations are possible: provide a numbered options list so user can reply with a number.
|
||||||
|
|
||||||
### Cleanup (General)
|
### Cleanup (General)
|
||||||
- Do not leave temporary/debug artifacts in repo.
|
- Do not leave temporary/debug artifacts in repo.
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<attribute id="Author" type="LSString" value="MikhailRaw"/>
|
<attribute id="Author" type="LSString" value="MikhailRaw"/>
|
||||||
<attribute id="CharacterCreationLevelName" type="FixedString" value=""/>
|
<attribute id="CharacterCreationLevelName" type="FixedString" value=""/>
|
||||||
<attribute id="Description" type="LSString" value="Русский перевод мода DnD 5.5e All-in-One BEYOND. Перевод ещё в разработке: AI помогает быстро обновлять тексты, а финальные правки и качество мы проверяем вручную."/>
|
<attribute id="Description" type="LSString" value="Русский перевод мода DnD 5.5e All-in-One BEYOND. Перевод ещё в разработке: AI помогает быстро обновлять тексты, а финальные правки и качество мы проверяем вручную."/>
|
||||||
<attribute id="FileSize" type="uint64" value="0"/>
|
<attribute id="FileSize" type="uint64" value="2488095"/>
|
||||||
<attribute id="Folder" type="LSString" value="DnD 5.5e AIO Russian"/>
|
<attribute id="Folder" type="LSString" value="DnD 5.5e AIO Russian"/>
|
||||||
<attribute id="LobbyLevelName" type="FixedString" value=""/>
|
<attribute id="LobbyLevelName" type="FixedString" value=""/>
|
||||||
<attribute id="MD5" type="LSString" value="c0a8f3412870277331306e0719fc6f77"/>
|
<attribute id="MD5" type="LSString" value="c0a8f3412870277331306e0719fc6f77"/>
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
<attribute id="PublishHandle" type="uint64" value="5965149"/>
|
<attribute id="PublishHandle" type="uint64" value="5965149"/>
|
||||||
<attribute id="StartupLevelName" type="FixedString" value=""/>
|
<attribute id="StartupLevelName" type="FixedString" value=""/>
|
||||||
<attribute id="UUID" type="FixedString" value="6401e84d-daf2-416d-adeb-99c03a2487a6"/>
|
<attribute id="UUID" type="FixedString" value="6401e84d-daf2-416d-adeb-99c03a2487a6"/>
|
||||||
<attribute id="Version64" type="int64" value="281477124194306"/>
|
<attribute id="Version64" type="int64" value="281477124194307"/>
|
||||||
<children>
|
<children>
|
||||||
<node id="PublishVersion">
|
<node id="PublishVersion">
|
||||||
<attribute id="Version64" type="int64" value="281477124194304"/>
|
<attribute id="Version64" type="int64" value="281477124194304"/>
|
||||||
|
|||||||
87
scripts/sync-parent-meta.ps1
Normal file
87
scripts/sync-parent-meta.ps1
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
param(
|
||||||
|
[Parameter(Mandatory = $true)]
|
||||||
|
[string]$ParentMetaPath,
|
||||||
|
[string]$TargetMetaPath = "Mods/DnD 5.5e AIO Russian/meta.lsx"
|
||||||
|
)
|
||||||
|
|
||||||
|
$ErrorActionPreference = "Stop"
|
||||||
|
|
||||||
|
$resolvedParentMetaPath = [System.IO.Path]::GetFullPath($ParentMetaPath)
|
||||||
|
$resolvedTargetMetaPath = [System.IO.Path]::GetFullPath($TargetMetaPath)
|
||||||
|
|
||||||
|
if (-not (Test-Path -LiteralPath $resolvedParentMetaPath)) {
|
||||||
|
throw "Parent meta.lsx was not found: '$resolvedParentMetaPath'."
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not (Test-Path -LiteralPath $resolvedTargetMetaPath)) {
|
||||||
|
throw "Target meta.lsx was not found: '$resolvedTargetMetaPath'."
|
||||||
|
}
|
||||||
|
|
||||||
|
$parentRaw = Get-Content -LiteralPath $resolvedParentMetaPath -Raw
|
||||||
|
$targetRaw = Get-Content -LiteralPath $resolvedTargetMetaPath -Raw
|
||||||
|
|
||||||
|
[xml]$parentXml = $parentRaw
|
||||||
|
[xml]$targetXml = $targetRaw
|
||||||
|
|
||||||
|
$parentModuleInfo = $parentXml.SelectSingleNode('/save/region/node/children/node[@id="ModuleInfo"]')
|
||||||
|
if ($null -eq $parentModuleInfo) {
|
||||||
|
throw "ModuleInfo node was not found in parent meta: '$resolvedParentMetaPath'."
|
||||||
|
}
|
||||||
|
|
||||||
|
$requiredFields = @("Folder", "MD5", "Name", "PublishHandle", "UUID", "Version64")
|
||||||
|
$sourceValues = @{}
|
||||||
|
|
||||||
|
foreach ($field in $requiredFields) {
|
||||||
|
$node = $parentModuleInfo.SelectSingleNode("attribute[@id='$field']")
|
||||||
|
if ($null -eq $node) {
|
||||||
|
throw "Required parent ModuleInfo attribute '$field' is missing in '$resolvedParentMetaPath'."
|
||||||
|
}
|
||||||
|
|
||||||
|
$value = $node.GetAttribute("value")
|
||||||
|
if ([string]::IsNullOrWhiteSpace($value)) {
|
||||||
|
throw "Required parent ModuleInfo attribute '$field' has empty value in '$resolvedParentMetaPath'."
|
||||||
|
}
|
||||||
|
|
||||||
|
$sourceValues[$field] = $value
|
||||||
|
}
|
||||||
|
|
||||||
|
$targetDependencyNode = $targetXml.SelectSingleNode('/save/region/node/children/node[@id="Dependencies"]/children/node[@id="ModuleShortDesc"]')
|
||||||
|
if ($null -eq $targetDependencyNode) {
|
||||||
|
throw "Dependencies/ModuleShortDesc node was not found in target meta: '$resolvedTargetMetaPath'."
|
||||||
|
}
|
||||||
|
|
||||||
|
$changedFields = @()
|
||||||
|
foreach ($field in $requiredFields) {
|
||||||
|
$targetAttr = $targetDependencyNode.SelectSingleNode("attribute[@id='$field']")
|
||||||
|
if ($null -eq $targetAttr) {
|
||||||
|
throw "Target Dependencies/ModuleShortDesc attribute '$field' is missing in '$resolvedTargetMetaPath'."
|
||||||
|
}
|
||||||
|
|
||||||
|
$currentValue = $targetAttr.GetAttribute("value")
|
||||||
|
$newValue = [string]$sourceValues[$field]
|
||||||
|
if ($currentValue -ne $newValue) {
|
||||||
|
$targetAttr.SetAttribute("value", $newValue)
|
||||||
|
$changedFields += $field
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($changedFields.Count -eq 0) {
|
||||||
|
Write-Host "[sync-parent-meta.ps1] No changes needed. Target dependency data is already up to date."
|
||||||
|
} else {
|
||||||
|
$utf8Bom = New-Object System.Text.UTF8Encoding($true)
|
||||||
|
$settings = New-Object System.Xml.XmlWriterSettings
|
||||||
|
$settings.Encoding = $utf8Bom
|
||||||
|
$settings.Indent = $true
|
||||||
|
$settings.IndentChars = " "
|
||||||
|
$settings.NewLineChars = "`n"
|
||||||
|
$settings.NewLineHandling = [System.Xml.NewLineHandling]::Replace
|
||||||
|
|
||||||
|
$writer = [System.Xml.XmlWriter]::Create($resolvedTargetMetaPath, $settings)
|
||||||
|
try {
|
||||||
|
$targetXml.WriteTo($writer)
|
||||||
|
} finally {
|
||||||
|
$writer.Dispose()
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host ("[sync-parent-meta.ps1] Updated fields: " + ($changedFields -join ", "))
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user