Skip to content

fix(scripts): port skill-catalog generator off gawk-only awk -v (ag-mm6q #bsd-awk-portability)#784

Open
boshu2 wants to merge 1 commit into
mainfrom
fix/ag-mm6q-bsd-awk-catalog
Open

fix(scripts): port skill-catalog generator off gawk-only awk -v (ag-mm6q #bsd-awk-portability)#784
boshu2 wants to merge 1 commit into
mainfrom
fix/ag-mm6q-bsd-awk-catalog

Conversation

@boshu2
Copy link
Copy Markdown
Owner

@boshu2 boshu2 commented Jun 6, 2026

What

scripts/generate-skill-catalog.sh passed the YAML frontmatter into awk via awk -v fm="$fm". A literal newline inside a -v var=value assignment is accepted only by GNU awk; BSD/POSIX awk (macOS without gawk) errors with awk: newline in string ... and emits no catalog — so the catalog (and its drift gate check-skill-catalog-drift.sh) could only run inside Linux CI.

Fix

Feed the frontmatter on stdin and accumulate input lines into lines[] (processed in END exactly as before) instead of -v + split(). Pure input-mechanism change — the parse logic is untouched.

Evidence (macOS BSD awk, version 20200816)

  • Before: bash scripts/generate-skill-catalog.sh --stdoutawk: newline in string name: agent-native (no output).
  • After: valid JSON for all 81 skills; lists, context_rel, and quoted descriptions parse correctly (e.g. depscontext_rel: [{kind: supplier-to, with: vibe}], matching the source SKILL.md).
  • Added an explicit BSD/POSIX-awk regression test (multi-line frontmatter parses ... without 'newline in string'). Full bats suite 15/15 green on macOS.
  • shellcheck clean.

Scope note

The committed skills/catalog.json is independently stale (75 vs 81 skills — drift predates this change, since the generator never ran off-Linux). Regenerating it is deliberately left to the Linux-CI drift path (the check skill catalog drift job is I0 advisory / non-blocking) to avoid committing a glob-order-sensitive artifact generated off-CI.

Closes-scenario: ag-mm6q#bsd-awk-portability
Bounded-context: BC2-Validation
Evidence: tests/scripts/generate-skill-catalog.bats

…m6q #bsd-awk-portability)

generate-skill-catalog.sh passed the YAML frontmatter into awk via
`awk -v fm="$fm"`. A literal newline inside a `-v var=value` assignment is
accepted only by GNU awk; BSD/POSIX awk (macOS without gawk) errors with
"awk: newline in string ..." and emits no catalog, so the catalog could only
be regenerated inside Linux CI.

Feed the frontmatter on stdin and accumulate input lines into lines[]
(processed in END exactly as before) instead of -v + split(). Pure
input-mechanism change; the parse logic is untouched.

Verified on macOS BSD awk (version 20200816): --stdout now emits valid JSON
for all 81 skills, lists + context_rel + quoted descriptions parse correctly
(e.g. deps -> context_rel [{kind: supplier-to, with: vibe}] matches source).
Added an explicit BSD/POSIX-awk regression test; full bats suite 15/15 green.

The committed skills/catalog.json is independently stale (75 vs 81 skills);
regenerating it is left to the Linux-CI drift path (I0 advisory, non-blocking)
to avoid committing a glob-order-sensitive artifact generated off-CI.

Closes-scenario: ag-mm6q#bsd-awk-portability
Bounded-context: BC2-Validation
Evidence: tests/scripts/generate-skill-catalog.bats
@github-actions github-actions Bot added the tests label Jun 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant