diff --git a/.claude/skills/mxl-compile/scripts/mxl-compile.ps1 b/.claude/skills/mxl-compile/scripts/mxl-compile.ps1 index 4bf0aacf..3cfe20a0 100644 --- a/.claude/skills/mxl-compile/scripts/mxl-compile.ps1 +++ b/.claude/skills/mxl-compile/scripts/mxl-compile.ps1 @@ -1,4 +1,4 @@ -# mxl-compile v1.7 — Compile 1C spreadsheet from JSON +# mxl-compile v1.8 — Compile 1C spreadsheet from JSON # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills param( [Parameter(Mandatory)] @@ -854,6 +854,11 @@ X '' $enc = New-Object System.Text.UTF8Encoding($true) $resolvedPath = if ([System.IO.Path]::IsPathRooted($OutputPath)) { $OutputPath } else { Join-Path (Get-Location) $OutputPath } +# Каталог назначения создаём сами: типовой путь — Templates/<Имя>/Ext/Template.xml, +# и его может ещё не быть. Так делают и form-compile, и skd-compile, и py-порт этого +# навыка; без этого PS-порт падал на «Could not find a part of the path». +$outDir = [System.IO.Path]::GetDirectoryName($resolvedPath) +if ($outDir -and -not (Test-Path $outDir)) { New-Item -ItemType Directory -Path $outDir -Force | Out-Null } Assert-EditAllowed $resolvedPath 'editable' [System.IO.File]::WriteAllText($resolvedPath, $xml.ToString().TrimEnd("`r", "`n"), $enc) diff --git a/.claude/skills/mxl-compile/scripts/mxl-compile.py b/.claude/skills/mxl-compile/scripts/mxl-compile.py index 518047c5..6996a0c0 100644 --- a/.claude/skills/mxl-compile/scripts/mxl-compile.py +++ b/.claude/skills/mxl-compile/scripts/mxl-compile.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# mxl-compile v1.7 — Compile 1C spreadsheet from JSON +# mxl-compile v1.8 — Compile 1C spreadsheet from JSON # Source: https://github.com/Nikolay-Shirokov/cc-1c-skills import argparse import json diff --git a/tests/skills/cases/mxl-compile/nested-output-dir.json b/tests/skills/cases/mxl-compile/nested-output-dir.json new file mode 100644 index 00000000..2e07c301 --- /dev/null +++ b/tests/skills/cases/mxl-compile/nested-output-dir.json @@ -0,0 +1,29 @@ +{ + "name": "Запись по несуществующему пути: каталог назначения создаётся навыком", + "input": { + "columns": 1, + "areas": [ + { + "name": "Шапка", + "rows": [ + { "cells": [{ "col": 1, "text": "Привет" }] } + ] + } + ] + }, + "params": { "outputPath": "Templates/Макет/Ext/Template.xml" }, + "validatePath": "Templates/Макет/Ext/Template.xml", + "expect": { + "files": ["Templates/Макет/Ext/Template.xml"], + "preserves": { + "file": "Templates/Макет/Ext/Template.xml", + "bom": true, + "eol": "crlf", + "encoding": "UTF-8", + "finalNewline": false, + "noCR13": true, + "selfClose": "tight", + "noEmptyPairs": true + } + } +} diff --git a/tests/skills/cases/mxl-compile/snapshots/nested-output-dir/Templates/Макет/Ext/Template.xml b/tests/skills/cases/mxl-compile/snapshots/nested-output-dir/Templates/Макет/Ext/Template.xml new file mode 100644 index 00000000..9fc37649 --- /dev/null +++ b/tests/skills/cases/mxl-compile/snapshots/nested-output-dir/Templates/Макет/Ext/Template.xml @@ -0,0 +1,54 @@ + + + + ru + ru + + ru + Русский + Русский + + + + 1 + + + 0 + + + 0 + + 2 + + + ru + Привет + + + + + + + true + 1 + 1 + 1 + + Шапка + + Rows + 0 + 0 + -1 + -1 + + + + + 10 + + + 0 + Text + + \ No newline at end of file