feat(kyberforge): add skill-author, merging skill-write and skill-improve
Closes #5. Single authoring skill replaces the factory trio — one set of standards, one script, one place for future governance rules. Routes to create or improve flow based on context. Passes skill-audit with no findings. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016z2ZFYHQCex8yZAMVMTZzZ
This commit is contained in:
28
plugins/kyberforge/skills/skill-author/tests/README.md
Normal file
28
plugins/kyberforge/skills/skill-author/tests/README.md
Normal file
@@ -0,0 +1,28 @@
|
||||
# tests/
|
||||
|
||||
Test files for scripts bundled with this skill.
|
||||
|
||||
## Dependencies
|
||||
|
||||
Tests require [bats-support](https://github.com/bats-core/bats-support) and
|
||||
[bats-assert](https://github.com/bats-core/bats-assert). The test files load
|
||||
helpers from the repo root's `tests/test_helper/`.
|
||||
|
||||
From the repo root:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/bats-core/bats-support tests/test_helper/bats-support
|
||||
git clone https://github.com/bats-core/bats-assert tests/test_helper/bats-assert
|
||||
```
|
||||
|
||||
Run all tests for this skill (from the repo root):
|
||||
|
||||
```bash
|
||||
bats plugins/kyberforge/skills/skill-author/tests/
|
||||
```
|
||||
|
||||
## Files
|
||||
|
||||
| File | Purpose |
|
||||
|------|---------|
|
||||
| `new-skill.bats` | Bats test suite for `scripts/new-skill.sh` |
|
||||
118
plugins/kyberforge/skills/skill-author/tests/new-skill.bats
Normal file
118
plugins/kyberforge/skills/skill-author/tests/new-skill.bats
Normal file
@@ -0,0 +1,118 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
setup() {
|
||||
REPO_ROOT="$(cd "$BATS_TEST_DIRNAME/../../../../../" && pwd)"
|
||||
load "$REPO_ROOT/tests/test_helper/bats-support/load"
|
||||
load "$REPO_ROOT/tests/test_helper/bats-assert/load"
|
||||
|
||||
SCRIPT="$(cd "$BATS_TEST_DIRNAME/../scripts" && pwd)/new-skill.sh"
|
||||
DEST="$(mktemp -d)"
|
||||
}
|
||||
|
||||
teardown() {
|
||||
rm -rf "$DEST"
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Passing cases
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@test "--help exits 0" {
|
||||
run bash "$SCRIPT" --help
|
||||
assert_success
|
||||
assert_output --partial "Usage:"
|
||||
}
|
||||
|
||||
@test "creates scaffold directory at destination" {
|
||||
run bash "$SCRIPT" my-tool "$DEST"
|
||||
assert_success
|
||||
assert [ -d "$DEST/my-tool" ]
|
||||
}
|
||||
|
||||
@test "scaffold contains SKILL.md" {
|
||||
bash "$SCRIPT" my-tool "$DEST"
|
||||
assert [ -f "$DEST/my-tool/SKILL.md" ]
|
||||
}
|
||||
|
||||
@test "scaffold contains README.md" {
|
||||
bash "$SCRIPT" my-tool "$DEST"
|
||||
assert [ -f "$DEST/my-tool/README.md" ]
|
||||
}
|
||||
|
||||
@test "scaffold contains scripts/, references/, assets/, tests/ directories" {
|
||||
bash "$SCRIPT" my-tool "$DEST"
|
||||
assert [ -d "$DEST/my-tool/scripts" ]
|
||||
assert [ -d "$DEST/my-tool/references" ]
|
||||
assert [ -d "$DEST/my-tool/assets" ]
|
||||
assert [ -d "$DEST/my-tool/tests" ]
|
||||
}
|
||||
|
||||
@test "substitutes skill name in SKILL.md" {
|
||||
bash "$SCRIPT" my-tool "$DEST"
|
||||
run grep "my-tool" "$DEST/my-tool/SKILL.md"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "substitutes skill name in README.md" {
|
||||
bash "$SCRIPT" my-tool "$DEST"
|
||||
run grep "my-tool" "$DEST/my-tool/README.md"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "substitutes skill name in tests/README.md" {
|
||||
bash "$SCRIPT" my-tool "$DEST"
|
||||
run grep "my-tool" "$DEST/my-tool/tests/README.md"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "skill name with numbers is valid" {
|
||||
run bash "$SCRIPT" my-tool-2 "$DEST"
|
||||
assert_success
|
||||
assert [ -d "$DEST/my-tool-2" ]
|
||||
}
|
||||
|
||||
@test "next-steps output references /skill-audit not validate.sh" {
|
||||
run bash "$SCRIPT" my-tool "$DEST"
|
||||
assert_output --partial "/skill-audit"
|
||||
refute_output --partial "validate.sh"
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Failing cases
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@test "fails when no arguments given" {
|
||||
run bash "$SCRIPT"
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test "fails when skill name contains uppercase" {
|
||||
run bash "$SCRIPT" MyTool "$DEST"
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test "fails when skill name has consecutive hyphens" {
|
||||
run bash "$SCRIPT" my--tool "$DEST"
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test "fails when skill name has a leading hyphen" {
|
||||
run bash "$SCRIPT" -my-tool "$DEST"
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test "fails when skill name has a trailing hyphen" {
|
||||
run bash "$SCRIPT" my-tool- "$DEST"
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test "fails when destination directory does not exist" {
|
||||
run bash "$SCRIPT" my-tool "/nonexistent/path"
|
||||
assert_failure
|
||||
}
|
||||
|
||||
@test "fails when target already exists" {
|
||||
mkdir -p "$DEST/my-tool"
|
||||
run bash "$SCRIPT" my-tool "$DEST"
|
||||
assert_failure
|
||||
}
|
||||
Reference in New Issue
Block a user