Skip to content

Commit 2bb9437

Browse files
committed
fix(cli): quote the skill description so strict YAML readers accept it (DeusData#1554)
The installed SKILL.md carried an unquoted `description` whose value contains "Triggers on: ". In YAML a colon-space inside an unquoted scalar is a nested-mapping indicator, so strict readers — js-yaml's `load`, the frontmatter parser in `npx skills` — reject the whole document. The skill does not load wrongly; it does not load at all, and nothing in the install output says why. Quoting the scalar fixes it without touching a word of the text. The test checks the RULE rather than this string: for every skill, any frontmatter value containing ": " must be quoted. Pinning the current wording would let the next skill someone adds reintroduce exactly this bug. Verified by reverting the fix — the test goes red, and green again with it restored. Reported by @xezzon. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
1 parent 42e320a commit 2bb9437

2 files changed

Lines changed: 61 additions & 2 deletions

File tree

‎src/cli/cli.c‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,12 +1255,17 @@ int cbm_replace_binary(const char *path, const unsigned char *data, int len, int
12551255
static const char skill_content[] =
12561256
"---\n"
12571257
"name: codebase-memory\n"
1258-
"description: Use the codebase knowledge graph for structural code queries. "
1258+
/* #1554: the value contains "Triggers on: " — a colon-space, which YAML
1259+
* reads as a nested-mapping indicator inside an unquoted scalar. Strict
1260+
* parsers (js-yaml's load, the frontmatter reader in `npx skills`) reject
1261+
* the whole file, so the skill silently fails to load rather than loading
1262+
* wrongly. Quoting the scalar is the fix; the text itself is unchanged. */
1263+
"description: \"Use the codebase knowledge graph for structural code queries. "
12591264
"Triggers on: explore the codebase, understand the architecture, what functions exist, "
12601265
"show me the structure, who calls this function, what does X call, trace the call chain, "
12611266
"find callers of, show dependencies, impact analysis, dead code, unused functions, "
12621267
"high fan-out, refactor candidates, code quality audit, graph query syntax, "
1263-
"Cypher query examples, edge types, how to use search_graph.\n"
1268+
"Cypher query examples, edge types, how to use search_graph.\"\n"
12641269
"---\n"
12651270
"\n"
12661271
"# Codebase Memory — Knowledge Graph Tools\n"

‎tests/test_cli.c‎

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12101,6 +12101,59 @@ TEST(cli_sha256_file_matches_known_vector) {
1210112101
* words people already type is not. Both flags must be accepted, do nothing,
1210212102
* and say so once. A genuinely unknown flag must still be rejected, or this
1210312103
* degenerates into ignoring typos. */
12104+
/* #1554: the skill's `description` contained "Triggers on: " — a colon-space,
12105+
* which YAML reads as a nested-mapping indicator inside an UNQUOTED scalar.
12106+
* Strict readers (js-yaml's load, the frontmatter parser in `npx skills`)
12107+
* reject the whole document, so the installed skill silently fails to load.
12108+
*
12109+
* The rule is checked for EVERY skill, not just the one that broke: any
12110+
* frontmatter scalar whose value contains ": " must be quoted. Pinning only
12111+
* the current text would let the next added skill reintroduce it. */
12112+
TEST(cli_skill_frontmatter_scalars_with_colons_are_quoted_issue1554) {
12113+
const cbm_skill_t *sk = cbm_get_skills();
12114+
ASSERT_NOT_NULL(sk);
12115+
for (int i = 0; i < CBM_SKILL_COUNT; i++) {
12116+
const char *body = sk[i].content;
12117+
ASSERT_NOT_NULL(body);
12118+
/* Frontmatter is the block between the first two "---" lines. */
12119+
ASSERT_TRUE(strncmp(body, "---\n", 4) == 0);
12120+
const char *end = strstr(body + 4, "\n---\n");
12121+
ASSERT_NOT_NULL(end);
12122+
12123+
const char *line = body + 4;
12124+
while (line < end) {
12125+
const char *eol = strchr(line, '\n');
12126+
if (!eol || eol > end) {
12127+
break;
12128+
}
12129+
const char *sep = NULL;
12130+
for (const char *c = line; c < eol - 1; c++) {
12131+
if (c[0] == ':' && c[1] == ' ') {
12132+
sep = c;
12133+
break;
12134+
}
12135+
}
12136+
if (sep) {
12137+
const char *value = sep + 2;
12138+
/* A value that itself contains ": " must be quoted, or a
12139+
* strict parser treats it as a nested mapping. */
12140+
bool has_inner_colon = false;
12141+
for (const char *c = value; c < eol - 1; c++) {
12142+
if (c[0] == ':' && c[1] == ' ') {
12143+
has_inner_colon = true;
12144+
break;
12145+
}
12146+
}
12147+
if (has_inner_colon) {
12148+
ASSERT_TRUE(value[0] == '"' || value[0] == '\'');
12149+
}
12150+
}
12151+
line = eol + 1;
12152+
}
12153+
}
12154+
PASS();
12155+
}
12156+
1210412157
TEST(cli_update_accepts_retired_variant_flags_issue1544) {
1210512158
char *ui_argv[] = {"--dry-run", "--ui", "--yes"};
1210612159
char *standard_argv[] = {"--dry-run", "--standard", "--yes"};
@@ -12189,6 +12242,7 @@ SUITE(cli) {
1218912242
RUN_TEST(cli_install_config_failure_keeps_published_binary);
1219012243
RUN_TEST(cli_update_download_failure_does_not_quiesce_sessions);
1219112244
RUN_TEST(cli_update_already_current_does_not_quiesce_sessions);
12245+
RUN_TEST(cli_skill_frontmatter_scalars_with_colons_are_quoted_issue1554);
1219212246
RUN_TEST(cli_update_accepts_retired_variant_flags_issue1544);
1219312247
RUN_TEST(cli_update_agent_configs_finish_before_guard_release);
1219412248
RUN_TEST(cli_uninstall_quiesces_active_cohort_before_removing_binary_and_index);

0 commit comments

Comments
 (0)