45 lines
2.2 KiB
Plaintext
45 lines
2.2 KiB
Plaintext
|
|
{
|
||
|
|
id = "0011",
|
||
|
|
slug = "manifest-coverage-hooks",
|
||
|
|
description = "Add pre-commit hook for manifest capability coverage and SessionStart hook showing manifest health. Prevents incomplete manifests from being committed and ensures agents see gaps at session start.",
|
||
|
|
check = {
|
||
|
|
tag = "NuCmd",
|
||
|
|
cmd = "let root = $env.ONTOREF_PROJECT_ROOT; let pcf = $\"($root)/.pre-commit-config.yaml\"; let hook = $\"($root)/.claude/hooks/session-context.sh\"; let has_manifest_hook = if ($pcf | path exists) { (open --raw $pcf | str contains 'manifest-coverage') } else { false }; let has_session_audit = if ($hook | path exists) { (open --raw $hook | str contains 'manifest-check') } else { false }; if $has_manifest_hook and $has_session_audit { exit 0 } else { exit 1 }",
|
||
|
|
expect_exit = 0,
|
||
|
|
},
|
||
|
|
instructions = "
|
||
|
|
Two hooks ensure manifest completeness is enforced and visible:
|
||
|
|
|
||
|
|
## 1. Pre-commit hook (blocks commits when manifest has Hard failures)
|
||
|
|
|
||
|
|
Add to .pre-commit-config.yaml in the local hooks section:
|
||
|
|
|
||
|
|
- id: manifest-coverage
|
||
|
|
name: Manifest capability completeness
|
||
|
|
entry: bash -c 'ONTOREF_ROOT=\"$(pwd)\" ONTOREF_PROJECT_ROOT=\"$(pwd)\" nu --no-config-file -c \"use ./reflection/modules/sync.nu *; sync manifest-check\"'
|
||
|
|
language: system
|
||
|
|
files: (\\.ontology/|reflection/modes/|reflection/forms/).*\\.ncl$
|
||
|
|
pass_filenames: false
|
||
|
|
stages: [pre-commit]
|
||
|
|
|
||
|
|
This fires when .ontology/, reflection/modes/, or reflection/forms/ NCL files change.
|
||
|
|
It blocks on Hard failures (no capabilities declared at all) and warns on Soft issues.
|
||
|
|
|
||
|
|
## 2. SessionStart hook (shows manifest health at session start)
|
||
|
|
|
||
|
|
Add to .claude/hooks/session-context.sh before the final line:
|
||
|
|
|
||
|
|
# quick manifest/ontology health check
|
||
|
|
HEALTH_OUT=$(cd \"$REPO_ROOT\" && ONTOREF_ROOT=\"$REPO_ROOT\" ONTOREF_PROJECT_ROOT=\"$REPO_ROOT\" \\
|
||
|
|
nu --no-config-file -c 'use ./reflection/modules/sync.nu *; sync manifest-check' 2>/dev/null || true)
|
||
|
|
|
||
|
|
if [[ -n \"$HEALTH_OUT\" ]]; then
|
||
|
|
echo \"Manifest Coverage\"
|
||
|
|
echo \"$HEALTH_OUT\"
|
||
|
|
fi
|
||
|
|
|
||
|
|
This ensures every Claude Code session starts with visibility into manifest completeness.
|
||
|
|
Agents see immediately if capabilities are missing and avoid reinventing existing functionality.
|
||
|
|
",
|
||
|
|
}
|