Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ai/commands/sandboxes-try.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
description: Spin up a throwaway site in the sandboxes/ folder of the Webship Workspace to try one thing: pick the smallest builder, build, say the address, and offer to remove it when the question is answered.
description: Spin up a throwaway site in the sandboxes/ folder of the Webship Workspace to try one thing — pick the smallest builder, build, say the address, and offer to remove it when the question is answered.
argument-hint: '<what to try> [name]'
---

Expand Down
29 changes: 29 additions & 0 deletions tests/items.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,3 +211,32 @@ test('the items say container-based, name the folder and the plugin they come wi
for (const name of [...AGENTS, ...SKILLS, ...AI_COMMANDS, ...PROMPTS]) assert.ok(readme.includes(name), `the README lists ${name}`);
for (const folder of Object.values(KINDS)) assert.ok(readme.includes(`${folder}/`), `the README says what lands in ${folder}/`);
});

// Other AI command-line assistants read the frontmatter with a strict YAML parser: a value such a parser
// cannot read is lost there (the item arrives with an empty description). The default assistant is lenient,
// so the items are held to the strict reading here.
test('the frontmatter of every item is YAML a strict parser reads', () => {
const ai = JSON.parse(read('package.json')).workspacePlugin.ai || {};
const files: string[] = [...(ai.agents || []), ...(ai.commands || []), ...(ai.skills || []).map((s: string) => `${s}/SKILL.md`)];
let seen = 0;
for (const f of files) {
const head = frontmatter(read(f));
assert.ok(head, `${f} has frontmatter`);
for (const line of head.split('\n').slice(1)) {
const m = line.match(/^([A-Za-z][A-Za-z0-9_-]*):(?: (.*))?$/);
if (!m) {
assert.match(line, /^ +(- )?\S/, `${f}: "${line}" is neither a key nor a part of the key above it`);
continue;
}
const value = (m[2] || '').trim();
seen += 1;
if (value === '') continue; // a list follows
if (value.startsWith("'")) { assert.match(value, /^'(?:[^']|'')*'$/, `${f}: the value of ${m[1]} is not a closed single-quoted value`); continue; }
if (value.startsWith('"')) { assert.doesNotThrow(() => JSON.parse(value), `${f}: the value of ${m[1]} is not a closed double-quoted value`); continue; }
if (/^\[.*\]$/.test(value)) continue; // a list on one line
assert.doesNotMatch(value, /: |:$| #/, `${f}: the value of ${m[1]} holds ": " or " #". A strict YAML parser stops there, and the assistant that uses one gets no ${m[1]}: reword it, or quote the value`);
assert.doesNotMatch(value, /^(?:[[\]{}>|*&!%@\`#,]|[-?:] )/, `${f}: the value of ${m[1]} starts with a sign YAML keeps for itself: quote the value`);
}
}
assert.ok(seen > 0, 'the items carry frontmatter');
});
Loading