mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-09-20 00:45:54 +03:00
refactor(skd-compile,skd-edit,form-compile,role-*): одно правило поиска @файла
Чтение текста из файла жило тремя копиями под именем Resolve-QueryValue и вне реестра гарда, а role-* завели четвёртое правило — только от рабочего каталога. Теперь функция одна на пять навыков: Resolve-TextFromFile / resolve_text_from_file, заведена семья в check-inline-drift, эталон — skd-edit. Правило поиска общее: абсолютный путь как есть, относительный — рядом с DSL (у edit-навыков — рядом с редактируемым объектом), затем в текущем каталоге, не нашли — ошибка со списком проверенных мест. Имя без "query": в ролях из файла приходит условие RLS, а не запрос. Текст ошибки приведён к языку остальных сообщений. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FGkXwoXTuafcu1SXMsauFq
This commit is contained in:
co-authored by
Claude Opus 5
parent
121c9c8ad3
commit
d425833709
@@ -1,4 +1,4 @@
|
||||
# skd-edit v1.39 — Atomic 1C DCS editor
|
||||
# skd-edit v1.40 — Atomic 1C DCS editor
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
# NB: парный .py собирает выражения автодат вне f-string ради совместимости с python 3.9 (PEP 701).
|
||||
[CmdletBinding(PositionalBinding=$false)]
|
||||
@@ -194,7 +194,7 @@ function Esc-XmlText {
|
||||
return $s.Replace('&','&').Replace('<','<').Replace('>','>')
|
||||
}
|
||||
|
||||
function Resolve-QueryValue {
|
||||
function Resolve-TextFromFile {
|
||||
param([string]$val, [string]$baseDir)
|
||||
if (-not $val.StartsWith("@")) { return $val }
|
||||
$filePath = $val.Substring(1)
|
||||
@@ -211,7 +211,7 @@ function Resolve-QueryValue {
|
||||
return (Get-Content -Raw -Encoding UTF8 $c).TrimEnd()
|
||||
}
|
||||
}
|
||||
Write-Error "Query file not found: $filePath (searched: $($candidates -join ', '))"
|
||||
Write-Error "Файл значения не найден: $filePath (искали: $($candidates -join ', '))"
|
||||
exit 1
|
||||
}
|
||||
|
||||
@@ -3097,7 +3097,7 @@ switch ($Operation) {
|
||||
}
|
||||
|
||||
# InnerText setter handles XML escaping automatically
|
||||
$queryEl.InnerText = Resolve-QueryValue $Value $script:queryBaseDir
|
||||
$queryEl.InnerText = Resolve-TextFromFile $Value $script:queryBaseDir
|
||||
|
||||
$script:Dirty = $true; Write-Host "[OK] Query replaced in dataset `"$dsName`""
|
||||
}
|
||||
@@ -3337,7 +3337,7 @@ switch ($Operation) {
|
||||
$childIndent = Get-ChildIndent $root
|
||||
|
||||
$parsed = Parse-DataSetShorthand $Value
|
||||
$parsed.query = Resolve-QueryValue $parsed.query $script:queryBaseDir
|
||||
$parsed.query = Resolve-TextFromFile $parsed.query $script:queryBaseDir
|
||||
|
||||
# Auto-name if empty
|
||||
if (-not $parsed.name) {
|
||||
|
||||
Reference in New Issue
Block a user