-
Notifications
You must be signed in to change notification settings - Fork 0
refactor: add skills/ build system with CI freshness check #4
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
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 |
|---|---|---|
| @@ -1,12 +1,14 @@ | ||
| .PHONY: format validate audit ci | ||
| .PHONY: build format validate audit ci | ||
|
|
||
| format: ## Format skillshare-hub.json (sort by name, 2-space indent) | ||
| @./scripts/format.sh | ||
| build: ## Build skillshare-hub.json from skills/*.json | ||
| @./scripts/build.sh | ||
|
|
||
| format: build ## Alias for build (build already sorts and formats) | ||
|
|
||
| validate: ## Validate skillshare-hub.json format and rules | ||
| @./scripts/validate.sh | ||
|
|
||
| audit: ## Audit new/changed skills against main | ||
| @./scripts/audit.sh main | ||
|
|
||
| ci: validate audit ## Run full CI locally | ||
| ci: build validate audit ## Run full CI locally |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,26 @@ | ||||||||||||||||||
| #!/usr/bin/env bash | ||||||||||||||||||
| set -euo pipefail | ||||||||||||||||||
|
|
||||||||||||||||||
| SKILLS_DIR="${1:-skills}" | ||||||||||||||||||
| HUB_FILE="skillshare-hub.json" | ||||||||||||||||||
|
|
||||||||||||||||||
| if [ ! -d "$SKILLS_DIR" ]; then | ||||||||||||||||||
| echo "ERROR: $SKILLS_DIR directory not found" | ||||||||||||||||||
| exit 1 | ||||||||||||||||||
| fi | ||||||||||||||||||
|
|
||||||||||||||||||
| # Count source files | ||||||||||||||||||
| files=("$SKILLS_DIR"/*.json) | ||||||||||||||||||
| if [ ${#files[@]} -eq 0 ]; then | ||||||||||||||||||
| echo "ERROR: No .json files found in $SKILLS_DIR" | ||||||||||||||||||
| exit 1 | ||||||||||||||||||
| fi | ||||||||||||||||||
|
Comment on lines
+14
to
+17
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. This check for missing A more reliable way to check is to see if the first element of the array actually exists as a file.
Suggested change
|
||||||||||||||||||
|
|
||||||||||||||||||
| # Merge all arrays, sort by name, wrap in hub schema | ||||||||||||||||||
| jq -s '{ | ||||||||||||||||||
| schemaVersion: 1, | ||||||||||||||||||
| skills: ([.[][]] | sort_by(.name)) | ||||||||||||||||||
| }' "${files[@]}" > "$HUB_FILE" | ||||||||||||||||||
|
|
||||||||||||||||||
| count=$(jq '.skills | length' "$HUB_FILE") | ||||||||||||||||||
| echo "Built: $HUB_FILE ($count skills from ${#files[@]} files)" | ||||||||||||||||||
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.
This script creates temporary directories in multiple places (
group_dirandclone_dir). Whilegroup_diris cleaned up by atrap, theclone_dirs created in/tmpare removed manually. If the script is interrupted (e.g., with Ctrl-C), these clone directories might be left behind.For more robust cleanup, consider creating a single parent temporary directory for all transient data. A single
trapon this parent directory would ensure all temporary files and directories are cleaned up, regardless of how the script terminates.Example structure:
This would make the script's cleanup mechanism more resilient.