-
Notifications
You must be signed in to change notification settings - Fork 5
🧹 Extract inline awk script to improve idstack-gen-skills readability #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| BEGIN { | ||
| after_frontmatter = 0 | ||
| frontmatter_count = 0 | ||
| in_allowed_tools = 0 | ||
| } | ||
| /^---$/ { | ||
| frontmatter_count++ | ||
| if (frontmatter_count == 2) { | ||
| print header | ||
| print header2 | ||
| print "" | ||
| } | ||
| in_allowed_tools = 0 | ||
| next | ||
| } | ||
| # Strip the `allowed-tools:` block from frontmatter for codex target. | ||
| # The block runs from `allowed-tools:` until the next non-indented sibling | ||
| # key or the closing `---`. Match is case-insensitive and rejects leading | ||
| # whitespace so a stray indented duplicate cannot bypass the strip. | ||
| frontmatter_count == 1 && target == "codex" { | ||
| if (in_allowed_tools) { | ||
| if ($0 ~ /^[^ \t-]/) { | ||
| in_allowed_tools = 0 | ||
| # fall through to print this line (the next sibling key) | ||
| } else { | ||
| next # still inside allowed-tools list, skip | ||
| } | ||
| } | ||
| if (tolower($0) ~ /^allowed-tools:[[:space:]]*$/) { | ||
| in_allowed_tools = 1 | ||
| next | ||
| } | ||
| } | ||
| /\{\{PREAMBLE\}\}/ { | ||
| while ((getline line < preamble_file) > 0) print line | ||
| close(preamble_file) | ||
| next | ||
| } | ||
| /\{\{MANIFEST_SCHEMA\}\}/ { | ||
| while ((getline line < schema_file) > 0) print line | ||
| close(schema_file) | ||
| next | ||
| } | ||
|
Comment on lines
+35
to
+44
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If |
||
| { print } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable
after_frontmatteris initialized in theBEGINblock but is never used anywhere else in the script. Removing this unused variable improves code cleanliness and maintainability.