diff --git a/AGENTS.md b/AGENTS.md index 96cf80f..2742ab8 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -39,7 +39,7 @@ - CI triggers: tag `v*` and manual dispatch; not every push to `main`. ## Version/Release Rules (MUST) -- Source of truth for release version: `ModuleInfo/Version64` in `meta.lsx`. +- Read release version only from `save/region/node[@id="ModuleSettings"]/children/node[@id="ModuleInfo"]/attribute[@id="Version64"]` via explicit XML parsing. - `PublishVersion` must not be changed during release preparation. - Release tag must match the source-of-truth version. - Decision logic before tagging: diff --git a/scripts/set-version.ps1 b/scripts/set-version.ps1 index b30ccd1..2387f5b 100644 --- a/scripts/set-version.ps1 +++ b/scripts/set-version.ps1 @@ -36,8 +36,16 @@ if (-not (Test-Path -LiteralPath $resolvedMetaPath)) { $resolvedVersion64 = Convert-VersionTagToVersion64 -Tag $VersionTag $metaContent = Get-Content -LiteralPath $resolvedMetaPath -Raw +[xml]$metaXml = $metaContent -$moduleInfoVersionPattern = '(?s)(.*?)' +# Explicitly target ModuleInfo/Version64 via XML path to avoid touching Dependencies/PublishVersion. +$moduleInfoVersionNode = $metaXml.SelectSingleNode('/save/region/node/children/node[@id="ModuleInfo"]/attribute[@id="Version64" and @type="int64"]') +if ($null -eq $moduleInfoVersionNode) { + throw "ModuleInfo/Version64 attribute was not found in '$resolvedMetaPath'." +} + +# Replace only the Version64 attribute that appears inside ModuleInfo before its block. +$moduleInfoVersionPattern = '(?s)(\s*(?:(?!).)*?)' if ($metaContent -notmatch $moduleInfoVersionPattern) { throw "ModuleInfo/Version64 attribute was not found in '$resolvedMetaPath'." }