diff --git a/.github/workflows/check-tools.yml b/.github/workflows/check-tools.yml index f85b8ca9..6fbcbee7 100644 --- a/.github/workflows/check-tools.yml +++ b/.github/workflows/check-tools.yml @@ -21,3 +21,6 @@ jobs: - name: Validate generated Hermes plugin run: python3 scripts/check-hermes-plugin.py + + - name: Validate converted YAML frontmatter + run: bash scripts/test-convert-frontmatter.sh diff --git a/scripts/convert.sh b/scripts/convert.sh index af005ff9..6c1ddf68 100755 --- a/scripts/convert.sh +++ b/scripts/convert.sh @@ -106,6 +106,13 @@ toml_escape_string() { ' } +# Quote a single-line value for a YAML frontmatter scalar. Single-quoted YAML +# strings keep colons, hashes, backslashes, and Unicode literal, while doubling +# an apostrophe is the only escaping rule required here. +yaml_quote() { + printf "'%s'" "$(printf '%s' "$1" | sed "s/'/''/g")" +} + # --- Per-tool converters --- convert_antigravity() { @@ -127,8 +134,8 @@ convert_antigravity() { # valid Agent-Skills skill for any host (and deterministic — no date stamp). cat > "$outfile" < "$outfile" < "$outfile" < "$outfile" < "$outfile" < "$outfile" < "$outfile" < "$outfile" < "$outfile" </dev/null +done + +assert_quoted() { + local file="$1" field="$2" line prefix + line="$(awk -v key="$field" '$0 ~ "^" key ":" { print; exit }' "$file")" + prefix="$field: '" + [[ "$line" == "$prefix"*"'" ]] || { + printf 'Expected %s in %s to be a single-quoted YAML scalar, got: %s\n' \ + "$field" "$file" "$line" >&2 + return 1 + } +} + +assert_quoted \ + "$OUTPUT_DIR/gemini-cli/agents/developer-tooling-engineer.md" \ + description +assert_quoted \ + "$OUTPUT_DIR/opencode/agents/developer-tooling-engineer.md" \ + name +assert_quoted \ + "$OUTPUT_DIR/opencode/agents/developer-tooling-engineer.md" \ + description +assert_quoted \ + "$OUTPUT_DIR/qwen/agents/programmatic-display-buyer.md" \ + tools + +echo "PASS: converted YAML frontmatter keeps scalar values safely quoted"