mirror of
https://github.com/awizemann/scarf.git
synced 2026-05-10 10:36:35 +00:00
fix(skills): parse equal-indent disabled list in skills config
`readDisabledSkillNames` broke out of the loop on `leading <= baseIndent`,
but PyYAML's default `yaml.dump` (what Hermes uses to write the disabled
list) emits list items at the SAME indent as the parent key:
skills:
disabled:
- foo
- bar
Here `disabled:` is at indent 2 and `- foo` is also at indent 2, so the
old check terminated before any item was appended — every disabled skill
written by Hermes would have appeared enabled in the UI.
Now the loop only breaks when the indent is strictly shallower than the
`disabled:` line, or when a same-indent line isn't a list item (sibling
key — that's still the end of the block). The deeper-indent layout still
parses correctly.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -152,9 +152,14 @@ public final class SkillsViewModel {
|
|||||||
}
|
}
|
||||||
if let baseIndent = disabledIndent {
|
if let baseIndent = disabledIndent {
|
||||||
let leading = raw.prefix { $0 == " " || $0 == "\t" }.count
|
let leading = raw.prefix { $0 == " " || $0 == "\t" }.count
|
||||||
if leading <= baseIndent && !trimmed.isEmpty {
|
if !trimmed.isEmpty {
|
||||||
// Out of the `disabled:` block.
|
// PyYAML's default `yaml.dump` emits list items at the
|
||||||
break
|
// same indent as the parent key, so `- foo` lines for
|
||||||
|
// `disabled:` arrive at `leading == baseIndent`. Only
|
||||||
|
// a strictly shallower indent — or a same-indent line
|
||||||
|
// that isn't a list item (sibling key) — ends the block.
|
||||||
|
if leading < baseIndent { break }
|
||||||
|
if leading == baseIndent && !trimmed.hasPrefix("- ") { break }
|
||||||
}
|
}
|
||||||
if trimmed.hasPrefix("- ") {
|
if trimmed.hasPrefix("- ") {
|
||||||
let name = trimmed.dropFirst(2).trimmingCharacters(in: CharacterSet(charactersIn: "\"' "))
|
let name = trimmed.dropFirst(2).trimmingCharacters(in: CharacterSet(charactersIn: "\"' "))
|
||||||
|
|||||||
Reference in New Issue
Block a user