The Matt Pocock engineering skills (triage, to-tickets, to-spec, research, implement) assume per-repo config for three things: where work items live, what the triage label vocabulary is, and where domain docs sit. Nothing here declared any of them, so every skill run re-guessed. Frank's decisions, 2026-10-20: Gitea on Dankclaw as the tracker (no gh, no tea on any box, so it is recorded as prose — auth via a 600 curl config, the endpoint table, the 404-on-empty-token / form-encoded-merge / empty-200-on-merge traps, and the AGENTS.md laws a skill must not renegotiate); the canonical triage label vocabulary kept as-is, with the five labels created on the tracker (the repo had zero, so nothing collides); single-context domain docs. The configuration moved out of the skill's default docs/agents/ and into the one knowledge base this repo allows: three pages under omp-docs/skills/, an empty omp-docs/decisions/ carrying the ADR format rule, an "## Agent skills" pointer block in AGENTS.md, index entries, and a log entry. The glossary is deliberately not created — every candidate term already has an owner in system/, core/ or skills/, and a term list that paraphrases them is a second owner of facts already written down. Known cost: re-running setup-matt-pocock-skills will not recognise omp-docs/skills/* and will offer to recreate docs/agents/; the AGENTS.md pointer is what stops that. Also closes a verification gap found on the way: kb-lint.bats only ever points the linter at fixtures, so a page with no frontmatter or an index that stops listing a file passes the suite silently. Two tests now run the linter and the coverage checker against the shipped omp-docs/ tree. Refs #18
108 lines
2.8 KiB
Bash
Executable File
108 lines
2.8 KiB
Bash
Executable File
#!/usr/bin/env bats
|
|
# tests/kb-lint.bats — black-box tests for scripts/kb-lint.sh
|
|
#
|
|
# Contract: exit 0 when a knowledge bundle is OKF v0.1 conformant;
|
|
# one line per violation otherwise. Observable surface: stdout lines
|
|
# and exit status only.
|
|
|
|
setup() {
|
|
LINT="$BATS_TEST_DIRNAME/../scripts/kb-lint.sh"
|
|
KB="$(mktemp -d)/kb"
|
|
mkdir -p "$KB/sub"
|
|
cat > "$KB/index.md" <<'EOF'
|
|
# Index
|
|
|
|
* [Good](good.md) — fine.
|
|
EOF
|
|
cat > "$KB/good.md" <<'EOF'
|
|
---
|
|
type: reference
|
|
title: Good
|
|
---
|
|
Body.
|
|
EOF
|
|
}
|
|
|
|
teardown() { rm -rf "$(dirname "$KB")"; }
|
|
|
|
@test "conformant bundle passes" {
|
|
run bash "$LINT" "$KB"
|
|
[ "$status" -eq 0 ]
|
|
}
|
|
|
|
@test "missing frontmatter is reported" {
|
|
printf 'no frontmatter here\n' > "$KB/bad.md"
|
|
run bash "$LINT" "$KB"
|
|
[ "$status" -ne 0 ]
|
|
[[ "$output" == *"bad.md: missing frontmatter"* ]]
|
|
}
|
|
|
|
@test "frontmatter without type is reported" {
|
|
printf -- '---\ntitle: x\n---\nbody\n' > "$KB/notype.md"
|
|
run bash "$LINT" "$KB"
|
|
[ "$status" -ne 0 ]
|
|
[[ "$output" == *"notype.md"*"type"* ]]
|
|
}
|
|
|
|
@test "unclosed frontmatter is reported, not silently passed" {
|
|
# regression: a `---` in the body (fenced code, rule) must not be
|
|
# accepted as the closing delimiter of the frontmatter block
|
|
cat > "$KB/unclosed.md" <<'EOF'
|
|
---
|
|
type: reference
|
|
title: Unclosed
|
|
|
|
# Heading after a forgotten closing fence
|
|
|
|
```markdown
|
|
---
|
|
name: example
|
|
---
|
|
```
|
|
EOF
|
|
run bash "$LINT" "$KB"
|
|
[ "$status" -ne 0 ]
|
|
[[ "$output" == *"unclosed.md"* ]]
|
|
}
|
|
|
|
@test "frontmatter in index.md is reported" {
|
|
printf -- '---\ntype: x\n---\n# I\n' > "$KB/sub/index.md"
|
|
run bash "$LINT" "$KB"
|
|
[ "$status" -ne 0 ]
|
|
[[ "$output" == *"index.md must not have frontmatter"* ]]
|
|
}
|
|
|
|
@test "broken relative link is reported" {
|
|
printf -- '---\ntype: reference\n---\nsee [x](gone.md)\n' > "$KB/links.md"
|
|
run bash "$LINT" "$KB"
|
|
[ "$status" -ne 0 ]
|
|
[[ "$output" == *"links.md: broken relative link"* ]]
|
|
}
|
|
|
|
@test "broken wikilink is reported" {
|
|
printf -- '---\ntype: reference\n---\nsee [[nowhere]]\n' > "$KB/wiki.md"
|
|
run bash "$LINT" "$KB"
|
|
[ "$status" -ne 0 ]
|
|
[[ "$output" == *"wiki.md: broken wikilink"* ]]
|
|
}
|
|
|
|
@test "missing kb directory exits 2" {
|
|
run bash "$LINT" "$KB/no-such-dir"
|
|
[ "$status" -eq 2 ]
|
|
}
|
|
|
|
@test "the shipped knowledge base itself is conformant" {
|
|
# The tests above exercise the linter against fixtures; nothing else in the
|
|
# suite ever points it at the real bundle, so a page added without frontmatter
|
|
# or an index that stops listing a file passes CI silently. This is the gate.
|
|
run bash "$BATS_TEST_DIRNAME/../scripts/kb-lint.sh" "$BATS_TEST_DIRNAME/../omp-docs"
|
|
[ "$status" -eq 0 ]
|
|
[[ "$output" == *"0 violation(s)"* ]]
|
|
}
|
|
|
|
@test "every page in the shipped knowledge base is listed by an index" {
|
|
run python3 "$BATS_TEST_DIRNAME/../scripts/kb-coverage.py" "$BATS_TEST_DIRNAME/../omp-docs"
|
|
[ "$status" -eq 0 ]
|
|
[[ "$output" == *"0 issue(s)"* ]]
|
|
}
|