Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,13 @@ jobs:
[ -f "$f" ] || { echo "SKILL.md: referenced file not found: $f"; exit 1; }
done
echo "SKILL.md OK"

test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Run validation tests
run: bash tests/validate.sh
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0.1
41 changes: 41 additions & 0 deletions tests/validate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env bash
# Validate rtk-command-code documentation integrity
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
fail=0

echo "=== rtk-command-code validation ==="

# Required files
for f in AGENTS.md CHANGELOG.md CODE_OF_CONDUCT.md CONTRIBUTING.md LICENSE README.md SECURITY.md SKILL.md VERSION install.sh install.ps1; do
[ -f "$ROOT/$f" ] || { echo "FAIL: $f missing"; fail=1; }
done

# VERSION semver
version=$(tr -d '[:space:]' < "$ROOT/VERSION")
echo "$version" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$' || { echo "FAIL: VERSION not semver: $version"; fail=1; }

# SKILL.md frontmatter
head -1 "$ROOT/SKILL.md" | grep -qx -- '---' || { echo "FAIL: SKILL.md no frontmatter"; fail=1; }
grep -qE '^name:' "$ROOT/SKILL.md" || { echo "FAIL: SKILL.md no name"; fail=1; }

# AGENTS.md @imports
while IFS= read -r ref; do
[ -f "$ROOT/${ref#@}" ] || { echo "FAIL: missing @import ${ref#@}"; fail=1; }
done < <(grep -aoE '^@[A-Za-z0-9._/-]+' "$ROOT/AGENTS.md" || true)

# SKILL.md references
for f in $(grep -aoE 'references/[A-Za-z0-9._/-]+\.md' "$ROOT/SKILL.md" | sort -u); do
[ -f "$ROOT/$f" ] || { echo "FAIL: missing $f"; fail=1; }
done

# CHANGELOG.md version header
grep -qE '^## \[[0-9]+\.[0-9]+\.[0-9]+\]' "$ROOT/CHANGELOG.md" || { echo "FAIL: CHANGELOG.md no version header"; fail=1; }

# Validate install.ps1 syntax (if pwsh available)
if command -v pwsh &>/dev/null; then
pwsh -NoProfile -Command "\$e=@(); [System.Management.Automation.PSParser]::Tokenize((Get-Content -Raw install.ps1),[ref]\$e)|Out-Null; if(\$e.Count){exit 1}" 2>/dev/null || { echo "FAIL: install.ps1 syntax error"; fail=1; }
fi

echo "=== $([ "$fail" -eq 0 ] && echo 'ALL PASSED' || echo 'SOME FAILED') ==="
exit $fail
Loading