refactor(harness): improve hooks and harness robustness and YAML parsing#16
Merged
Merged
Conversation
Replace per-file symlink hooks in .git/hooks with git's native core.hooksPath mechanism. This eliminates worktree crashes, core.hooksPath bypass, exec-bit dirtiness, and nullglob edge cases. Also commit the executable bit (100755) for post-checkout, post-merge, and pre-push hooks so chmod +x is no longer needed. Add shellcheck linting to CI pipeline for all .sh scripts. Update doctor.md hook detection to check core.hooksPath instead of individual symlink files. Plan-by: glm-5.2 Acked-by: deepseek-v4-pro Fixes: #12 Signed-off-by: Sean Bruen <kyau@kyau.net>
Resolve HARNESS_DIR relative to git rev-parse --show-toplevel to prevent vacuous PASS when run from subdirectories. Fail on all-zero category counts. Replace toggling frontmatter parser with counter-based awk that stops at the second --- delimiter, preventing re-entry on Markdown horizontal rules. Replace string+grep name registry with bash associative arrays for O(1) exact-match lookup, eliminating regex injection from dotted filenames. Replace grep -c || echo 0 with grep -c || true to prevent bogus 0\n0 count that breaks the integer expression test. Fixes: #13 Plan-by: glm-5.2 Acked-by: deepseek-v4-pro Signed-off-by: Sean Bruen <kyau@kyau.net>
Replace the awk+sed frontmatter parser with a small Node.js helper using js-yaml. This handles quoted values, folded/block scalars, comments, and CRLF line endings correctly — all cases the old parser got wrong. Add js-yaml as a devDependency. Fix two skill files where unquoted colons in description values were ambiguous YAML (Hard-gate: and Two-phase:). Fixes: #14 Plan-by: glm-5.2 Acked-by: deepseek-v4-pro Signed-off-by: Sean Bruen <kyau@kyau.net>
Remove always-green shellcheck fallback in CI (|| true masked failures). Fix grep -c regression: use ''grep -c ...) || count=0'' instead of ''|| true'' (handles both zero-match and file-error cases correctly). Add Node.js prerequisite check to validate-harness.sh before delegating to the YAML frontmatter parser. Add UTF-8 BOM stripping to frontmatter-parser.js for Windows editors. Fix test harness: use exit code check instead of fragile error-message substring; add trap for temp-dir cleanup; guard empty-string arithmetic. Add Node.js globals config for .github/scripts/ JS files in ESLint. Plan-by: glm-5.2 Acked-by: deepseek-v4-pro Signed-off-by: Sean Bruen <kyau@kyau.net>
Plan-by: glm-5.2 Acked-by: deepseek-v4-pro Signed-off-by: kyau <git@kyaulabs.com>
kyau
force-pushed
the
feat/kyau-f5fix-hooks-harness-fixes
branch
from
July 6, 2026 06:10
4b278f6 to
3662da1
Compare
Plan-by: glm-5.2 Acked-by: deepseek-v4-pro Signed-off-by: kyau <git@kyaulabs.com>
Plan-by: glm-5.2 Acked-by: deepseek-v4-pro Signed-off-by: kyau <git@kyaulabs.com>
kyaulabs-bot
approved these changes
Jul 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces several improvements to the repository's developer tooling and harness validation scripts, with a focus on reliability, maintainability, and correctness. The main changes include a complete overhaul of the git hooks installation process, robust YAML frontmatter parsing for harness validation, and a suite of tests to ensure correct hook installation behavior. Additionally, ESLint and workflow configurations are updated to support these enhancements.
Git hooks installation and validation improvements:
install-hooks.shwithgit config core.hooksPath .github/hooks, eliminating issues with worktrees, symlink breakage, and file permission dirtiness. The script now only sets the hooks path and checks for the existence of the hooks directory..opencode/commands/doctor.mdto verify hooks installation viacore.hooksPathrather than checking individual hook files.tests/Shell/install-hooks_test.shto verify correct installation, permissions, and handling of edge cases such as empty hooks directories.Harness validation robustness and maintainability:
.github/scripts/validate-harness.shto require Bash 4+ and Node.js, replacing brittle awk/sed YAML parsing with a new Node.js script,frontmatter-parser.js, which usesjs-yamlfor robust YAML frontmatter extraction. This ensures correct handling of quoted values, scalars, comments, and CRLF line endings. [1] [2] [3]validate-harness.shto use Bash associative arrays for O(1) exact-match lookups, preventing regex injection and improving performance. [1] [2] [3] [4] [5]validate-harness.shto fail if no skills, agents, or commands are found, preventing vacuous passes.Tooling and workflow updates:
js-yamlas a development dependency inpackage.jsonto support the new frontmatter parser.eslint.config.mjsto correctly lint Node.js scripts in.github/scripts, allowing Node.js globals and disabling noisy console warnings.Shellcheckstep to the CI workflow to lint shell scripts and hooks for best practices and errors.Minor content and formatting fixes:
Git hooks installation and testing:
install-hooks.shto usegit config core.hooksPath .github/hooks, removing all per-file symlink logic and related bugs.install-hooks_test.shto verify correct installation, permissions, and handling of edge cases.doctor.mdto reflect new installation method.Harness validation robustness:
validate-harness.shwith a new Node.js-basedfrontmatter-parser.jsusingjs-yamlfor correct YAML frontmatter extraction. [1] [2]validate-harness.shto Bash associative arrays for safe and fast cross-reference validation. [1] [2] [3] [4] [5]Tooling and workflow:
js-yamltopackage.jsonfor YAML parsing.YAML formatting:
Plan-by: glm-5.2
Acked-by: deepseek-v4-pro
Signed-off-by: kyau git@kyaulabs.com