@supersuit/superskill 0.2.1 → 0.2.2
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/CHANGELOG.md +19 -0
- package/SPEC.md +1 -1
- package/package.json +1 -1
- package/src/frontmatter.mjs +96 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.2 (2026-09-29)
|
|
4
|
+
|
|
5
|
+
- An inline flow map (`scope: { form: essay, audience: builders, purpose: persuade }`, `check: {
|
|
6
|
+
station: every segment carries a label }`) now reads as an object instead of the whole `{ ...
|
|
7
|
+
}` coming back as a string. Nested inline maps and inline lists inside inline maps work too
|
|
8
|
+
(`speech: { uses: [a, b], never: [c] }`).
|
|
9
|
+
- An inline flow list followed by a same-line comment (`conditions: [r1, r2, r3] # 5 to 10
|
|
10
|
+
ids`) now reads as a list. Before this, the inline-list check required the raw value to END in
|
|
11
|
+
`]`, and a trailing comment broke that, so the whole line came back as a string.
|
|
12
|
+
- Both are read by a quote-aware character scanner rather than a naive split, so a comma,
|
|
13
|
+
bracket, brace or hash inside a quoted value inside a flow collection stays text
|
|
14
|
+
(`{ note: "a, b] } # c" }`). Malformed flow syntax (unbalanced brackets) still never throws: it
|
|
15
|
+
falls back to the raw string, same as an unrecognized value always has.
|
|
16
|
+
- A block list item that is itself a bare inline flow map or list (`- { station: fine, severity:
|
|
17
|
+
fail }`, `- [a, b]`) now reads as an object or a list. Before this, the KEY regex that decides
|
|
18
|
+
whether `- key: value` opens a block submap matched on the first colon inside the braces
|
|
19
|
+
(reading `"{ station"` as the key), so the item came back as `{ "{ station": "fine, severity:
|
|
20
|
+
fail }" }`. `- key: { ... }` still opens a block submap as before.
|
|
21
|
+
|
|
3
22
|
## 0.2.1 (2026-09-28)
|
|
4
23
|
|
|
5
24
|
- An unquoted value that is only a comment now reads as empty, which is what YAML means. Before
|
package/SPEC.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# The superskill standard
|
|
2
2
|
|
|
3
|
-
**Version 0.2.
|
|
3
|
+
**Version 0.2.2** (2026-09-29). The reference checker is `@supersuit/superskill`; where this
|
|
4
4
|
document and the checker disagree, the checker has a bug.
|
|
5
5
|
|
|
6
6
|
A **superskill** runs on frontier intelligence, is checked against examples a person approved,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supersuit/superskill",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Score any agent skill folder as skill, tested, or superskill. An open standard and a zero-dependency CLI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": { "superskill": "bin/superskill.mjs" },
|
package/src/frontmatter.mjs
CHANGED
|
@@ -31,6 +31,13 @@ const indentOf = (l) => l.length - l.trimStart().length;
|
|
|
31
31
|
// reads as empty, the same as no value at all, which is what YAML means. A comment-only value
|
|
32
32
|
// that is followed by a more-indented block still opens that nested map or list, exactly as
|
|
33
33
|
// `key:` with nothing after it does.
|
|
34
|
+
// 0.2.2: an inline flow map (`scope: { form: essay, audience: builders }`) reads as an object,
|
|
35
|
+
// nested to any depth (a flow map inside a flow map, a flow list inside a flow map). And an
|
|
36
|
+
// inline flow list followed by a same-line comment (`conditions: [r1, r2, r3] # 5 to 10 ids`)
|
|
37
|
+
// reads as a list instead of the whole `[...] # ...` text, because the flow value is now parsed
|
|
38
|
+
// character-by-character (quote-aware) instead of by checking whether the raw value ends in `]`.
|
|
39
|
+
// Malformed flow syntax (unbalanced brackets) never throws: it falls back to the raw string, the
|
|
40
|
+
// same as an unrecognized value always has.
|
|
34
41
|
export function parseYamlSubset(lines) {
|
|
35
42
|
return parseMap(lines, 0, 0, true)[0];
|
|
36
43
|
}
|
|
@@ -103,6 +110,16 @@ function parseList(lines, i, indent) {
|
|
|
103
110
|
} else out.push("");
|
|
104
111
|
continue;
|
|
105
112
|
}
|
|
113
|
+
if (content.startsWith("{") || content.startsWith("[")) {
|
|
114
|
+
// A bare flow map/list item (`- { station: fine, severity: fail }`, `- [a, b]`) is not a
|
|
115
|
+
// "- key: value" line, even though the KEY regex below would happily match on the first
|
|
116
|
+
// colon inside the braces (reading "{ station" as the key, which produced garbage). Try
|
|
117
|
+
// the flow parse first; when it is malformed, `inlineOrScalar` falls back to the raw
|
|
118
|
+
// string via `scalar()`, same as an unrecognized top-level value always has. Either way
|
|
119
|
+
// this never falls through to the "- key: value" submap heuristic below, because a flow
|
|
120
|
+
// collection's opening bracket can never legitimately be a map key.
|
|
121
|
+
out.push(inlineOrScalar(content)); continue;
|
|
122
|
+
}
|
|
106
123
|
if (KEY.test(content) && !/^\[.*\]$/.test(content)) {
|
|
107
124
|
// "- key: value" opens a map whose keys sit where this content starts.
|
|
108
125
|
const sub = [" ".repeat(at) + content, ...lines.slice(i)];
|
|
@@ -124,10 +141,88 @@ function readBlock(lines, i, keyIndent, style) {
|
|
|
124
141
|
}
|
|
125
142
|
|
|
126
143
|
function inlineOrScalar(rest) {
|
|
127
|
-
if (rest.startsWith("[")
|
|
144
|
+
if (rest.startsWith("[") || rest.startsWith("{")) {
|
|
145
|
+
const flow = tryParseFlow(rest);
|
|
146
|
+
if (flow !== undefined) return flow;
|
|
147
|
+
}
|
|
128
148
|
return scalar(rest);
|
|
129
149
|
}
|
|
130
150
|
|
|
151
|
+
// A flow collection (`[...]` or `{...}`) parsed character-by-character so quotes can protect a
|
|
152
|
+
// `,` `]` `}` or `#` from being read as structure, and so trailing whitespace plus a same-line
|
|
153
|
+
// comment after the closing bracket does not fall the whole value back to a raw string. Returns
|
|
154
|
+
// `undefined` (never throws) when `rest` is not a clean flow value: unbalanced brackets, an
|
|
155
|
+
// unterminated quote, or trailing content that is neither blank nor a comment. The caller falls
|
|
156
|
+
// back to `scalar(rest)` in every one of those cases, same as an unrecognized value always has.
|
|
157
|
+
function tryParseFlow(rest) {
|
|
158
|
+
let parsed;
|
|
159
|
+
try {
|
|
160
|
+
parsed = readFlowCollection(rest, 0);
|
|
161
|
+
} catch {
|
|
162
|
+
return undefined;
|
|
163
|
+
}
|
|
164
|
+
const trailing = rest.slice(parsed.end);
|
|
165
|
+
if (trailing.trim() === "" || /^\s+#/.test(trailing)) return parsed.value;
|
|
166
|
+
return undefined;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function readFlowCollection(s, i) {
|
|
170
|
+
const open = s[i];
|
|
171
|
+
const close = open === "{" ? "}" : "]";
|
|
172
|
+
const isMap = open === "{";
|
|
173
|
+
i = skipFlowWs(s, i + 1);
|
|
174
|
+
if (s[i] === close) return { value: isMap ? {} : [], end: i + 1 };
|
|
175
|
+
const items = [];
|
|
176
|
+
for (;;) {
|
|
177
|
+
i = skipFlowWs(s, i);
|
|
178
|
+
if (i >= s.length) throw new Error("unterminated flow collection");
|
|
179
|
+
let key;
|
|
180
|
+
if (isMap) {
|
|
181
|
+
const k = readFlowToken(s, i, [":"]);
|
|
182
|
+
key = k.text.trim().replace(/^["']|["']$/g, "");
|
|
183
|
+
i = skipFlowWs(s, k.end + 1);
|
|
184
|
+
}
|
|
185
|
+
let value;
|
|
186
|
+
if (s[i] === "{" || s[i] === "[") {
|
|
187
|
+
const nested = readFlowCollection(s, i);
|
|
188
|
+
value = nested.value; i = nested.end;
|
|
189
|
+
} else {
|
|
190
|
+
const v = readFlowToken(s, i, [",", close]);
|
|
191
|
+
value = scalar(v.text);
|
|
192
|
+
i = v.end;
|
|
193
|
+
}
|
|
194
|
+
items.push(isMap ? [key, value] : value);
|
|
195
|
+
i = skipFlowWs(s, i);
|
|
196
|
+
if (s[i] === ",") { i = skipFlowWs(s, i + 1); if (s[i] === close) { i++; break; } continue; }
|
|
197
|
+
if (s[i] === close) { i++; break; }
|
|
198
|
+
throw new Error(`expected ',' or '${close}'`);
|
|
199
|
+
}
|
|
200
|
+
const value = isMap ? Object.fromEntries(items) : items.filter((v) => v !== "");
|
|
201
|
+
return { value, end: i };
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function skipFlowWs(s, i) {
|
|
205
|
+
while (i < s.length && /\s/.test(s[i])) i++;
|
|
206
|
+
return i;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// Reads raw text from `i` up to (but not including) the first unquoted occurrence of a char in
|
|
210
|
+
// `stopChars`, honoring both quote styles so a stop char inside quotes stays text. Throws (never
|
|
211
|
+
// returns a partial token) when the string runs out before a stop char is found outside quotes,
|
|
212
|
+
// which is what an unbalanced bracket or an unterminated quote looks like from here.
|
|
213
|
+
function readFlowToken(s, i, stopChars) {
|
|
214
|
+
let text = "";
|
|
215
|
+
let q = null;
|
|
216
|
+
while (i < s.length) {
|
|
217
|
+
const ch = s[i];
|
|
218
|
+
if (q) { text += ch; if (ch === q) q = null; i++; continue; }
|
|
219
|
+
if (ch === '"' || ch === "'") { q = ch; text += ch; i++; continue; }
|
|
220
|
+
if (stopChars.includes(ch)) return { text, end: i };
|
|
221
|
+
text += ch; i++;
|
|
222
|
+
}
|
|
223
|
+
throw new Error("unterminated flow token");
|
|
224
|
+
}
|
|
225
|
+
|
|
131
226
|
function foldLines(lines) {
|
|
132
227
|
let s = "";
|
|
133
228
|
for (const l of lines) {
|
|
@@ -137,19 +232,6 @@ function foldLines(lines) {
|
|
|
137
232
|
return s;
|
|
138
233
|
}
|
|
139
234
|
|
|
140
|
-
function splitInline(s) {
|
|
141
|
-
const parts = [];
|
|
142
|
-
let cur = "", q = null;
|
|
143
|
-
for (const ch of s) {
|
|
144
|
-
if (q) { cur += ch; if (ch === q) q = null; }
|
|
145
|
-
else if (ch === '"' || ch === "'") { q = ch; cur += ch; }
|
|
146
|
-
else if (ch === ",") { parts.push(cur); cur = ""; }
|
|
147
|
-
else cur += ch;
|
|
148
|
-
}
|
|
149
|
-
parts.push(cur);
|
|
150
|
-
return parts.map((p) => p.trim());
|
|
151
|
-
}
|
|
152
|
-
|
|
153
235
|
function scalar(raw) {
|
|
154
236
|
const s = String(raw).trim();
|
|
155
237
|
if (s.startsWith('"')) {
|