arkaos 2.16.0 → 2.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.16.
|
|
1
|
+
2.16.1
|
|
Binary file
|
|
@@ -101,21 +101,51 @@ def _split_frontmatter(text: str) -> tuple[dict, str]:
|
|
|
101
101
|
|
|
102
102
|
|
|
103
103
|
def _normalize_stack_item(item: str) -> str:
|
|
104
|
-
"""Normalize a stack item to lowercase first word for comparison.
|
|
105
|
-
|
|
104
|
+
"""Normalize a stack item to lowercase first word for comparison.
|
|
105
|
+
|
|
106
|
+
Returns an empty string for empty or whitespace-only input so that
|
|
107
|
+
iteration over malformed stacks (e.g., a scalar YAML string) does not
|
|
108
|
+
crash with IndexError.
|
|
109
|
+
"""
|
|
110
|
+
parts = item.strip().lower().split()
|
|
111
|
+
return parts[0] if parts else ""
|
|
106
112
|
|
|
107
113
|
|
|
108
114
|
def _check_stack(
|
|
109
115
|
frontmatter: dict, detected_stack: list[str], changes: list[str]
|
|
110
116
|
) -> None:
|
|
111
|
-
"""Compare frontmatter stack with detected stack and update if different.
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
117
|
+
"""Compare frontmatter stack with detected stack and update if different.
|
|
118
|
+
|
|
119
|
+
Tolerates malformed frontmatter where ``stack`` is a scalar string or
|
|
120
|
+
``None`` by coercing it to a list first. A scalar value is always
|
|
121
|
+
rewritten as a list even when the normalized tokens match. Empty or
|
|
122
|
+
whitespace-only items are dropped during normalization.
|
|
123
|
+
"""
|
|
124
|
+
raw_fm_stack = frontmatter.get("stack")
|
|
125
|
+
needs_type_coercion = not isinstance(raw_fm_stack, list)
|
|
126
|
+
|
|
127
|
+
if raw_fm_stack is None:
|
|
128
|
+
fm_stack: list[str] = []
|
|
129
|
+
elif isinstance(raw_fm_stack, str):
|
|
130
|
+
fm_stack = [raw_fm_stack]
|
|
131
|
+
elif isinstance(raw_fm_stack, list):
|
|
132
|
+
fm_stack = [s for s in raw_fm_stack if isinstance(s, str)]
|
|
133
|
+
else:
|
|
134
|
+
fm_stack = []
|
|
135
|
+
|
|
136
|
+
fm_normalized = {
|
|
137
|
+
token for s in fm_stack if (token := _normalize_stack_item(s))
|
|
138
|
+
}
|
|
139
|
+
detected_normalized = {
|
|
140
|
+
token for s in detected_stack if (token := _normalize_stack_item(s))
|
|
141
|
+
}
|
|
115
142
|
|
|
116
143
|
if fm_normalized != detected_normalized and detected_stack:
|
|
117
144
|
frontmatter["stack"] = detected_stack
|
|
118
145
|
changes.append(f"stack updated: {fm_stack} -> {detected_stack}")
|
|
146
|
+
elif needs_type_coercion and detected_stack:
|
|
147
|
+
frontmatter["stack"] = detected_stack
|
|
148
|
+
changes.append(f"stack coerced to list: {raw_fm_stack!r} -> {detected_stack}")
|
|
119
149
|
|
|
120
150
|
|
|
121
151
|
def _check_activity(
|
package/package.json
CHANGED