From 4833c3b707f30631d95f457ba266aa220206fa38 Mon Sep 17 00:00:00 2001 From: Nick Shirokov Date: Thu, 6 Aug 2026 14:11:11 +0300 Subject: [PATCH] =?UTF-8?q?fix(mxl-compile):=20PS-=D0=BF=D0=BE=D1=80=D1=82?= =?UTF-8?q?=20=D0=BD=D0=B5=20=D1=81=D0=BE=D0=B7=D0=B4=D0=B0=D0=B2=D0=B0?= =?UTF-8?q?=D0=BB=20=D0=BA=D0=B0=D1=82=D0=B0=D0=BB=D0=BE=D0=B3=20=D0=BD?= =?UTF-8?q?=D0=B0=D0=B7=D0=BD=D0=B0=D1=87=D0=B5=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Наполнение макета по свежему пути (Templates/<Имя>/Ext/Template.xml) на PowerShell падало с «Could not find a part of the path». py-порт каталог создаёт, form-compile и skd-compile — тоже; не создавал только этот порт. Тестами не ловилось: во всех кейсах mxl-compile писал в уже существующий каталог. Добавлен кейс с записью по несуществующему пути — проверено, что на коде до правки он падает. Найдено при разборе вопроса, нужна ли заглушка тела макета в template-add: оказалось, заглушка держала не замысел, а этот дефект. Co-Authored-By: Claude Opus 5 (1M context) --- .../mxl-compile/scripts/mxl-compile.ps1 | 7 ++- .../skills/mxl-compile/scripts/mxl-compile.py | 2 +- .../cases/mxl-compile/nested-output-dir.json | 29 ++++++++++ .../Templates/Макет/Ext/Template.xml | 54 +++++++++++++++++++ 4 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 tests/skills/cases/mxl-compile/nested-output-dir.json create mode 100644 tests/skills/cases/mxl-compile/snapshots/nested-output-dir/Templates/Макет/Ext/Template.xml 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