autonomous-coding-toolkit 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +22 -0
- package/.claude-plugin/plugin.json +13 -0
- package/LICENSE +21 -0
- package/Makefile +21 -0
- package/README.md +140 -0
- package/SECURITY.md +28 -0
- package/agents/bash-expert.md +113 -0
- package/agents/dependency-auditor.md +138 -0
- package/agents/integration-tester.md +120 -0
- package/agents/lesson-scanner.md +149 -0
- package/agents/python-expert.md +179 -0
- package/agents/service-monitor.md +141 -0
- package/agents/shell-expert.md +147 -0
- package/benchmarks/runner.sh +147 -0
- package/benchmarks/tasks/01-rest-endpoint/rubric.sh +29 -0
- package/benchmarks/tasks/01-rest-endpoint/task.md +17 -0
- package/benchmarks/tasks/02-refactor-module/task.md +8 -0
- package/benchmarks/tasks/03-fix-integration-bug/task.md +8 -0
- package/benchmarks/tasks/04-add-test-coverage/task.md +8 -0
- package/benchmarks/tasks/05-multi-file-feature/task.md +8 -0
- package/bin/act.js +238 -0
- package/commands/autocode.md +6 -0
- package/commands/cancel-ralph.md +18 -0
- package/commands/code-factory.md +53 -0
- package/commands/create-prd.md +55 -0
- package/commands/ralph-loop.md +18 -0
- package/commands/run-plan.md +117 -0
- package/commands/submit-lesson.md +122 -0
- package/docs/ARCHITECTURE.md +630 -0
- package/docs/CONTRIBUTING.md +125 -0
- package/docs/lessons/0001-bare-exception-swallowing.md +34 -0
- package/docs/lessons/0002-async-def-without-await.md +28 -0
- package/docs/lessons/0003-create-task-without-callback.md +28 -0
- package/docs/lessons/0004-hardcoded-test-counts.md +28 -0
- package/docs/lessons/0005-sqlite-without-closing.md +33 -0
- package/docs/lessons/0006-venv-pip-path.md +27 -0
- package/docs/lessons/0007-runner-state-self-rejection.md +35 -0
- package/docs/lessons/0008-quality-gate-blind-spot.md +33 -0
- package/docs/lessons/0009-parser-overcount-empty-batches.md +36 -0
- package/docs/lessons/0010-local-outside-function-bash.md +33 -0
- package/docs/lessons/0011-batch-tests-for-unimplemented-code.md +36 -0
- package/docs/lessons/0012-api-markdown-unescaped-chars.md +33 -0
- package/docs/lessons/0013-export-prefix-env-parsing.md +33 -0
- package/docs/lessons/0014-decorator-registry-import-side-effect.md +43 -0
- package/docs/lessons/0015-frontend-backend-schema-drift.md +43 -0
- package/docs/lessons/0016-event-driven-cold-start-seeding.md +44 -0
- package/docs/lessons/0017-copy-paste-logic-diverges.md +43 -0
- package/docs/lessons/0018-layer-passes-pipeline-broken.md +45 -0
- package/docs/lessons/0019-systemd-envfile-ignores-export.md +41 -0
- package/docs/lessons/0020-persist-state-incrementally.md +44 -0
- package/docs/lessons/0021-dual-axis-testing.md +48 -0
- package/docs/lessons/0022-jsx-factory-shadowing.md +43 -0
- package/docs/lessons/0023-static-analysis-spiral.md +51 -0
- package/docs/lessons/0024-shared-pipeline-implementation.md +55 -0
- package/docs/lessons/0025-defense-in-depth-all-entry-points.md +65 -0
- package/docs/lessons/0026-linter-no-rules-false-enforcement.md +54 -0
- package/docs/lessons/0027-jsx-silent-prop-drop.md +64 -0
- package/docs/lessons/0028-no-infrastructure-in-client-code.md +49 -0
- package/docs/lessons/0029-never-write-secrets-to-files.md +61 -0
- package/docs/lessons/0030-cache-merge-not-replace.md +62 -0
- package/docs/lessons/0031-verify-units-at-boundaries.md +66 -0
- package/docs/lessons/0032-module-lifecycle-subscribe-unsubscribe.md +89 -0
- package/docs/lessons/0033-async-iteration-mutable-snapshot.md +72 -0
- package/docs/lessons/0034-caller-missing-await-silent-discard.md +65 -0
- package/docs/lessons/0035-duplicate-registration-silent-overwrite.md +85 -0
- package/docs/lessons/0036-websocket-dirty-disconnect.md +33 -0
- package/docs/lessons/0037-parallel-agents-worktree-corruption.md +31 -0
- package/docs/lessons/0038-subscribe-no-stored-ref.md +36 -0
- package/docs/lessons/0039-fallback-or-default-hides-bugs.md +34 -0
- package/docs/lessons/0040-event-firehose-filter-first.md +36 -0
- package/docs/lessons/0041-ambiguous-base-dir-path-nesting.md +32 -0
- package/docs/lessons/0042-spec-compliance-insufficient.md +36 -0
- package/docs/lessons/0043-exact-count-extensible-collections.md +32 -0
- package/docs/lessons/0044-relative-file-deps-worktree.md +39 -0
- package/docs/lessons/0045-iterative-design-improvement.md +33 -0
- package/docs/lessons/0046-plan-assertion-math-bugs.md +38 -0
- package/docs/lessons/0047-pytest-single-threaded-default.md +37 -0
- package/docs/lessons/0048-integration-wiring-batch.md +40 -0
- package/docs/lessons/0049-ab-verification.md +41 -0
- package/docs/lessons/0050-editing-sourced-files-during-execution.md +33 -0
- package/docs/lessons/0051-infrastructure-fixes-cant-self-heal.md +30 -0
- package/docs/lessons/0052-uncommitted-changes-poison-quality-gates.md +31 -0
- package/docs/lessons/0053-jq-compact-flag-inconsistency.md +31 -0
- package/docs/lessons/0054-parser-matches-inside-code-blocks.md +30 -0
- package/docs/lessons/0055-agents-compensate-for-garbled-prompts.md +31 -0
- package/docs/lessons/0056-grep-count-exit-code-on-zero.md +42 -0
- package/docs/lessons/0057-new-artifacts-break-git-clean-gates.md +42 -0
- package/docs/lessons/0058-dead-config-keys-never-consumed.md +49 -0
- package/docs/lessons/0059-contract-test-shared-structures.md +53 -0
- package/docs/lessons/0060-set-e-silent-death-in-runners.md +53 -0
- package/docs/lessons/0061-context-injection-dirty-state.md +50 -0
- package/docs/lessons/0062-sibling-bug-neighborhood-scan.md +29 -0
- package/docs/lessons/0063-one-flag-two-lifetimes.md +31 -0
- package/docs/lessons/0064-test-passes-wrong-reason.md +31 -0
- package/docs/lessons/0065-pipefail-grep-count-double-output.md +39 -0
- package/docs/lessons/0066-local-keyword-outside-function.md +37 -0
- package/docs/lessons/0067-stdin-hang-non-interactive-shell.md +36 -0
- package/docs/lessons/0068-agent-builds-wrong-thing-correctly.md +31 -0
- package/docs/lessons/0069-plan-quality-dominates-execution.md +30 -0
- package/docs/lessons/0070-spec-echo-back-prevents-drift.md +31 -0
- package/docs/lessons/0071-positive-instructions-outperform-negative.md +30 -0
- package/docs/lessons/0072-lost-in-the-middle-context-placement.md +30 -0
- package/docs/lessons/0073-unscoped-lessons-cause-false-positives.md +30 -0
- package/docs/lessons/0074-stale-context-injection-wrong-batch.md +32 -0
- package/docs/lessons/0075-research-artifacts-must-persist.md +32 -0
- package/docs/lessons/0076-wrong-decomposition-contaminates-downstream.md +30 -0
- package/docs/lessons/0077-cherry-pick-merges-need-manual-resolution.md +30 -0
- package/docs/lessons/0078-static-review-without-live-test.md +30 -0
- package/docs/lessons/0079-integration-wiring-batch-required.md +32 -0
- package/docs/lessons/FRAMEWORK.md +161 -0
- package/docs/lessons/SUMMARY.md +201 -0
- package/docs/lessons/TEMPLATE.md +85 -0
- package/docs/plans/2026-02-21-code-factory-v2-design.md +204 -0
- package/docs/plans/2026-02-21-code-factory-v2-implementation-plan.md +2189 -0
- package/docs/plans/2026-02-21-code-factory-v2-phase4-design.md +537 -0
- package/docs/plans/2026-02-21-code-factory-v2-phase4-implementation-plan.md +2012 -0
- package/docs/plans/2026-02-21-hardening-pass-design.md +108 -0
- package/docs/plans/2026-02-21-hardening-pass-plan.md +1378 -0
- package/docs/plans/2026-02-21-mab-research-report.md +406 -0
- package/docs/plans/2026-02-21-marketplace-restructure-design.md +240 -0
- package/docs/plans/2026-02-21-marketplace-restructure-plan.md +832 -0
- package/docs/plans/2026-02-21-phase4-completion-plan.md +697 -0
- package/docs/plans/2026-02-21-validator-suite-design.md +148 -0
- package/docs/plans/2026-02-21-validator-suite-plan.md +540 -0
- package/docs/plans/2026-02-22-mab-research-round2.md +556 -0
- package/docs/plans/2026-02-22-mab-run-design.md +462 -0
- package/docs/plans/2026-02-22-mab-run-plan.md +2046 -0
- package/docs/plans/2026-02-22-operations-design-methodology-research.md +681 -0
- package/docs/plans/2026-02-22-research-agent-failure-taxonomy.md +532 -0
- package/docs/plans/2026-02-22-research-code-guideline-policies.md +886 -0
- package/docs/plans/2026-02-22-research-codebase-audit-refactoring.md +908 -0
- package/docs/plans/2026-02-22-research-coding-standards-documentation.md +541 -0
- package/docs/plans/2026-02-22-research-competitive-landscape.md +687 -0
- package/docs/plans/2026-02-22-research-comprehensive-testing.md +1076 -0
- package/docs/plans/2026-02-22-research-context-utilization.md +459 -0
- package/docs/plans/2026-02-22-research-cost-quality-tradeoff.md +548 -0
- package/docs/plans/2026-02-22-research-lesson-transferability.md +508 -0
- package/docs/plans/2026-02-22-research-multi-agent-coordination.md +312 -0
- package/docs/plans/2026-02-22-research-phase-integration.md +602 -0
- package/docs/plans/2026-02-22-research-plan-quality.md +428 -0
- package/docs/plans/2026-02-22-research-prompt-engineering.md +558 -0
- package/docs/plans/2026-02-22-research-unconventional-perspectives.md +528 -0
- package/docs/plans/2026-02-22-research-user-adoption.md +638 -0
- package/docs/plans/2026-02-22-research-verification-effectiveness.md +433 -0
- package/docs/plans/2026-02-23-agent-suite-design.md +299 -0
- package/docs/plans/2026-02-23-agent-suite-plan.md +578 -0
- package/docs/plans/2026-02-23-phase3-cost-infrastructure-design.md +148 -0
- package/docs/plans/2026-02-23-phase3-cost-infrastructure-plan.md +1062 -0
- package/docs/plans/2026-02-23-research-bash-expert-agent.md +543 -0
- package/docs/plans/2026-02-23-research-dependency-auditor-agent.md +564 -0
- package/docs/plans/2026-02-23-research-improving-existing-agents.md +503 -0
- package/docs/plans/2026-02-23-research-integration-tester-agent.md +454 -0
- package/docs/plans/2026-02-23-research-python-expert-agent.md +429 -0
- package/docs/plans/2026-02-23-research-service-monitor-agent.md +425 -0
- package/docs/plans/2026-02-23-research-shell-expert-agent.md +533 -0
- package/docs/plans/2026-02-23-roadmap-to-completion.md +530 -0
- package/docs/plans/2026-02-24-headless-module-split-design.md +98 -0
- package/docs/plans/2026-02-24-headless-module-split.md +443 -0
- package/docs/plans/2026-02-24-lesson-scope-metadata-design.md +228 -0
- package/docs/plans/2026-02-24-lesson-scope-metadata-plan.md +968 -0
- package/docs/plans/2026-02-24-npm-packaging-design.md +841 -0
- package/docs/plans/2026-02-24-npm-packaging-plan.md +1965 -0
- package/docs/plans/audit-findings.md +186 -0
- package/docs/telegram-notification-format.md +98 -0
- package/examples/example-plan.md +51 -0
- package/examples/example-prd.json +72 -0
- package/examples/example-roadmap.md +33 -0
- package/examples/quickstart-plan.md +63 -0
- package/hooks/hooks.json +26 -0
- package/hooks/setup-symlinks.sh +48 -0
- package/hooks/stop-hook.sh +135 -0
- package/package.json +47 -0
- package/policies/bash.md +71 -0
- package/policies/python.md +71 -0
- package/policies/testing.md +61 -0
- package/policies/universal.md +60 -0
- package/scripts/analyze-report.sh +97 -0
- package/scripts/architecture-map.sh +145 -0
- package/scripts/auto-compound.sh +273 -0
- package/scripts/batch-audit.sh +42 -0
- package/scripts/batch-test.sh +101 -0
- package/scripts/entropy-audit.sh +221 -0
- package/scripts/failure-digest.sh +51 -0
- package/scripts/generate-ast-rules.sh +96 -0
- package/scripts/init.sh +112 -0
- package/scripts/lesson-check.sh +428 -0
- package/scripts/lib/common.sh +61 -0
- package/scripts/lib/cost-tracking.sh +153 -0
- package/scripts/lib/ollama.sh +60 -0
- package/scripts/lib/progress-writer.sh +128 -0
- package/scripts/lib/run-plan-context.sh +215 -0
- package/scripts/lib/run-plan-echo-back.sh +231 -0
- package/scripts/lib/run-plan-headless.sh +396 -0
- package/scripts/lib/run-plan-notify.sh +57 -0
- package/scripts/lib/run-plan-parser.sh +81 -0
- package/scripts/lib/run-plan-prompt.sh +215 -0
- package/scripts/lib/run-plan-quality-gate.sh +132 -0
- package/scripts/lib/run-plan-routing.sh +315 -0
- package/scripts/lib/run-plan-sampling.sh +170 -0
- package/scripts/lib/run-plan-scoring.sh +146 -0
- package/scripts/lib/run-plan-state.sh +142 -0
- package/scripts/lib/run-plan-team.sh +199 -0
- package/scripts/lib/telegram.sh +54 -0
- package/scripts/lib/thompson-sampling.sh +176 -0
- package/scripts/license-check.sh +74 -0
- package/scripts/mab-run.sh +575 -0
- package/scripts/module-size-check.sh +146 -0
- package/scripts/patterns/async-no-await.yml +5 -0
- package/scripts/patterns/bare-except.yml +6 -0
- package/scripts/patterns/empty-catch.yml +6 -0
- package/scripts/patterns/hardcoded-localhost.yml +9 -0
- package/scripts/patterns/retry-loop-no-backoff.yml +12 -0
- package/scripts/pipeline-status.sh +197 -0
- package/scripts/policy-check.sh +226 -0
- package/scripts/prior-art-search.sh +133 -0
- package/scripts/promote-mab-lessons.sh +126 -0
- package/scripts/prompts/agent-a-superpowers.md +29 -0
- package/scripts/prompts/agent-b-ralph.md +29 -0
- package/scripts/prompts/judge-agent.md +61 -0
- package/scripts/prompts/planner-agent.md +44 -0
- package/scripts/pull-community-lessons.sh +90 -0
- package/scripts/quality-gate.sh +266 -0
- package/scripts/research-gate.sh +90 -0
- package/scripts/run-plan.sh +329 -0
- package/scripts/scope-infer.sh +159 -0
- package/scripts/setup-ralph-loop.sh +155 -0
- package/scripts/telemetry.sh +230 -0
- package/scripts/tests/run-all-tests.sh +52 -0
- package/scripts/tests/test-act-cli.sh +46 -0
- package/scripts/tests/test-agents-md.sh +87 -0
- package/scripts/tests/test-analyze-report.sh +114 -0
- package/scripts/tests/test-architecture-map.sh +89 -0
- package/scripts/tests/test-auto-compound.sh +169 -0
- package/scripts/tests/test-batch-test.sh +65 -0
- package/scripts/tests/test-benchmark-runner.sh +25 -0
- package/scripts/tests/test-common.sh +168 -0
- package/scripts/tests/test-cost-tracking.sh +158 -0
- package/scripts/tests/test-echo-back.sh +180 -0
- package/scripts/tests/test-entropy-audit.sh +146 -0
- package/scripts/tests/test-failure-digest.sh +66 -0
- package/scripts/tests/test-generate-ast-rules.sh +145 -0
- package/scripts/tests/test-helpers.sh +82 -0
- package/scripts/tests/test-init.sh +47 -0
- package/scripts/tests/test-lesson-check.sh +278 -0
- package/scripts/tests/test-lesson-local.sh +55 -0
- package/scripts/tests/test-license-check.sh +109 -0
- package/scripts/tests/test-mab-run.sh +182 -0
- package/scripts/tests/test-ollama-lib.sh +49 -0
- package/scripts/tests/test-ollama.sh +60 -0
- package/scripts/tests/test-pipeline-status.sh +198 -0
- package/scripts/tests/test-policy-check.sh +124 -0
- package/scripts/tests/test-prior-art-search.sh +96 -0
- package/scripts/tests/test-progress-writer.sh +140 -0
- package/scripts/tests/test-promote-mab-lessons.sh +110 -0
- package/scripts/tests/test-pull-community-lessons.sh +149 -0
- package/scripts/tests/test-quality-gate.sh +241 -0
- package/scripts/tests/test-research-gate.sh +132 -0
- package/scripts/tests/test-run-plan-cli.sh +86 -0
- package/scripts/tests/test-run-plan-context.sh +305 -0
- package/scripts/tests/test-run-plan-e2e.sh +153 -0
- package/scripts/tests/test-run-plan-headless.sh +424 -0
- package/scripts/tests/test-run-plan-notify.sh +124 -0
- package/scripts/tests/test-run-plan-parser.sh +217 -0
- package/scripts/tests/test-run-plan-prompt.sh +254 -0
- package/scripts/tests/test-run-plan-quality-gate.sh +222 -0
- package/scripts/tests/test-run-plan-routing.sh +178 -0
- package/scripts/tests/test-run-plan-scoring.sh +148 -0
- package/scripts/tests/test-run-plan-state.sh +261 -0
- package/scripts/tests/test-run-plan-team.sh +157 -0
- package/scripts/tests/test-scope-infer.sh +150 -0
- package/scripts/tests/test-setup-ralph-loop.sh +63 -0
- package/scripts/tests/test-telegram-env.sh +38 -0
- package/scripts/tests/test-telegram.sh +121 -0
- package/scripts/tests/test-telemetry.sh +46 -0
- package/scripts/tests/test-thompson-sampling.sh +139 -0
- package/scripts/tests/test-validate-all.sh +60 -0
- package/scripts/tests/test-validate-commands.sh +89 -0
- package/scripts/tests/test-validate-hooks.sh +98 -0
- package/scripts/tests/test-validate-lessons.sh +150 -0
- package/scripts/tests/test-validate-plan-quality.sh +235 -0
- package/scripts/tests/test-validate-plans.sh +187 -0
- package/scripts/tests/test-validate-plugin.sh +106 -0
- package/scripts/tests/test-validate-prd.sh +184 -0
- package/scripts/tests/test-validate-skills.sh +134 -0
- package/scripts/validate-all.sh +57 -0
- package/scripts/validate-commands.sh +67 -0
- package/scripts/validate-hooks.sh +89 -0
- package/scripts/validate-lessons.sh +98 -0
- package/scripts/validate-plan-quality.sh +369 -0
- package/scripts/validate-plans.sh +120 -0
- package/scripts/validate-plugin.sh +86 -0
- package/scripts/validate-policies.sh +42 -0
- package/scripts/validate-prd.sh +118 -0
- package/scripts/validate-skills.sh +96 -0
- package/skills/autocode/SKILL.md +285 -0
- package/skills/autocode/ab-verification.md +51 -0
- package/skills/autocode/code-quality-standards.md +37 -0
- package/skills/autocode/competitive-mode.md +364 -0
- package/skills/brainstorming/SKILL.md +97 -0
- package/skills/capture-lesson/SKILL.md +187 -0
- package/skills/check-lessons/SKILL.md +116 -0
- package/skills/dispatching-parallel-agents/SKILL.md +110 -0
- package/skills/executing-plans/SKILL.md +85 -0
- package/skills/finishing-a-development-branch/SKILL.md +201 -0
- package/skills/receiving-code-review/SKILL.md +72 -0
- package/skills/requesting-code-review/SKILL.md +59 -0
- package/skills/requesting-code-review/code-reviewer.md +82 -0
- package/skills/research/SKILL.md +145 -0
- package/skills/roadmap/SKILL.md +115 -0
- package/skills/subagent-driven-development/SKILL.md +98 -0
- package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +18 -0
- package/skills/subagent-driven-development/implementer-prompt.md +73 -0
- package/skills/subagent-driven-development/spec-reviewer-prompt.md +57 -0
- package/skills/systematic-debugging/SKILL.md +134 -0
- package/skills/systematic-debugging/condition-based-waiting.md +64 -0
- package/skills/systematic-debugging/defense-in-depth.md +32 -0
- package/skills/systematic-debugging/root-cause-tracing.md +55 -0
- package/skills/test-driven-development/SKILL.md +167 -0
- package/skills/using-git-worktrees/SKILL.md +219 -0
- package/skills/using-superpowers/SKILL.md +54 -0
- package/skills/verification-before-completion/SKILL.md +140 -0
- package/skills/verify/SKILL.md +82 -0
- package/skills/writing-plans/SKILL.md +128 -0
- package/skills/writing-skills/SKILL.md +93 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# Validator Suite Design
|
|
2
|
+
|
|
3
|
+
**Date:** 2026-02-21
|
|
4
|
+
**Status:** Approved
|
|
5
|
+
**Goal:** Self-validate all toolkit artifacts — lessons, skills, commands, plans, PRDs, plugin metadata, and hooks — with CI and Makefile integration.
|
|
6
|
+
|
|
7
|
+
## Problem
|
|
8
|
+
|
|
9
|
+
The toolkit enforces quality gates on consumer projects but has none on its own artifacts. Broken YAML frontmatter in lesson files silently drops checks (0056/0057 bug). Skill/command files with bad frontmatter won't load in Claude Code. No CI runs the existing 27 bash tests.
|
|
10
|
+
|
|
11
|
+
## Architecture
|
|
12
|
+
|
|
13
|
+
**Approach:** Modular validators + orchestrator. Individual `validate-*.sh` scripts per artifact type, plus `validate-all.sh` that runs them all. Mirrors existing pattern where `quality-gate.sh` orchestrates `lesson-check.sh` + tests.
|
|
14
|
+
|
|
15
|
+
## Validator Contract
|
|
16
|
+
|
|
17
|
+
Every validator follows the same interface:
|
|
18
|
+
|
|
19
|
+
- **Exit 0** = clean, **exit 1** = violations found
|
|
20
|
+
- `--warn` flag: print violations but exit 0
|
|
21
|
+
- `--help` for usage
|
|
22
|
+
- Output format: `validate-X: PASS` or `validate-X: FAIL (N issues)`
|
|
23
|
+
- Individual issues: `file:line: description` (same as `lesson-check.sh`)
|
|
24
|
+
- Sources `lib/common.sh` for shared utilities
|
|
25
|
+
|
|
26
|
+
## Validators
|
|
27
|
+
|
|
28
|
+
### validate-lessons.sh
|
|
29
|
+
|
|
30
|
+
Checks all `docs/lessons/[0-9]*.md` files:
|
|
31
|
+
- First line is `---` (not wrapped in code blocks)
|
|
32
|
+
- Required fields present: `id`, `title`, `severity`, `languages`, `pattern.type`
|
|
33
|
+
- Syntactic lessons (`pattern.type: syntactic`) have `regex` field
|
|
34
|
+
- IDs are sequential with no gaps or duplicates
|
|
35
|
+
- Severity is one of: `blocker`, `should-fix`, `nice-to-have`
|
|
36
|
+
- Languages are valid: `python`, `javascript`, `typescript`, `shell`, `all`
|
|
37
|
+
|
|
38
|
+
### validate-skills.sh
|
|
39
|
+
|
|
40
|
+
Checks all `skills/*/SKILL.md` files:
|
|
41
|
+
- YAML frontmatter has `name` and `description`
|
|
42
|
+
- `name` field matches the parent directory name
|
|
43
|
+
- Any `.md` files referenced in SKILL.md content exist in the same directory
|
|
44
|
+
|
|
45
|
+
### validate-commands.sh
|
|
46
|
+
|
|
47
|
+
Checks all `commands/*.md` files:
|
|
48
|
+
- YAML frontmatter has `description`
|
|
49
|
+
- Frontmatter delimiters (`---`) present
|
|
50
|
+
|
|
51
|
+
### validate-plans.sh
|
|
52
|
+
|
|
53
|
+
Validates plan markdown files (passed as argument or `docs/plans/*.md`):
|
|
54
|
+
- At least one `## Batch N:` header
|
|
55
|
+
- Each batch has at least one `### Task` header
|
|
56
|
+
- Batch numbers are sequential starting from 1
|
|
57
|
+
- No empty batches (header with no tasks)
|
|
58
|
+
|
|
59
|
+
### validate-prd.sh
|
|
60
|
+
|
|
61
|
+
Validates PRD JSON files (passed as argument or `tasks/prd.json`):
|
|
62
|
+
- Valid JSON array
|
|
63
|
+
- Each task has `id`, `title`, `acceptance_criteria`
|
|
64
|
+
- `acceptance_criteria` is a non-empty array of strings
|
|
65
|
+
- `blocked_by` references only valid task IDs within the file
|
|
66
|
+
- No circular dependencies in `blocked_by` graph
|
|
67
|
+
|
|
68
|
+
### validate-plugin.sh
|
|
69
|
+
|
|
70
|
+
Checks `.claude-plugin/plugin.json` and `.claude-plugin/marketplace.json`:
|
|
71
|
+
- Both files are valid JSON
|
|
72
|
+
- `name` field matches between them
|
|
73
|
+
- `version` field matches between them
|
|
74
|
+
- `source` path in marketplace.json exists
|
|
75
|
+
|
|
76
|
+
### validate-hooks.sh
|
|
77
|
+
|
|
78
|
+
Checks `hooks/hooks.json`:
|
|
79
|
+
- Valid JSON
|
|
80
|
+
- Referenced command scripts exist
|
|
81
|
+
- Referenced scripts are executable
|
|
82
|
+
|
|
83
|
+
### validate-all.sh
|
|
84
|
+
|
|
85
|
+
Orchestrator that runs all validators:
|
|
86
|
+
- Runs each validator, captures exit code
|
|
87
|
+
- Aggregates results into summary table
|
|
88
|
+
- Exits 1 if any validator failed
|
|
89
|
+
- Supports `--warn` (passes through to each validator)
|
|
90
|
+
|
|
91
|
+
## Makefile
|
|
92
|
+
|
|
93
|
+
```makefile
|
|
94
|
+
.PHONY: test validate ci
|
|
95
|
+
|
|
96
|
+
test:
|
|
97
|
+
bash scripts/tests/run-all-tests.sh
|
|
98
|
+
|
|
99
|
+
validate:
|
|
100
|
+
bash scripts/validate-all.sh
|
|
101
|
+
|
|
102
|
+
ci: validate test
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## GitHub Actions CI
|
|
106
|
+
|
|
107
|
+
`.github/workflows/ci.yml`:
|
|
108
|
+
- Triggers: push to main, pull requests
|
|
109
|
+
- Runner: ubuntu-latest
|
|
110
|
+
- Dependencies: jq (apt-get)
|
|
111
|
+
- Steps: checkout, install jq, `make ci`
|
|
112
|
+
- No claude CLI needed — existing tests mock external commands
|
|
113
|
+
|
|
114
|
+
## Integration with quality-gate.sh
|
|
115
|
+
|
|
116
|
+
Add `validate-all.sh` as step 0 in quality-gate.sh, before lesson-check and tests. This means toolkit development gets self-validation on every quality gate run.
|
|
117
|
+
|
|
118
|
+
## Test Files
|
|
119
|
+
|
|
120
|
+
Each validator gets a `scripts/tests/test-validate-*.sh` following existing patterns:
|
|
121
|
+
- `assert_eq`/`assert_exit` helpers (from test-common.sh pattern)
|
|
122
|
+
- Temp directory fixtures with `trap cleanup EXIT`
|
|
123
|
+
- Test both valid and invalid inputs
|
|
124
|
+
- No external dependencies
|
|
125
|
+
|
|
126
|
+
## File Summary
|
|
127
|
+
|
|
128
|
+
New files:
|
|
129
|
+
- `scripts/validate-lessons.sh`
|
|
130
|
+
- `scripts/validate-skills.sh`
|
|
131
|
+
- `scripts/validate-commands.sh`
|
|
132
|
+
- `scripts/validate-plans.sh`
|
|
133
|
+
- `scripts/validate-prd.sh`
|
|
134
|
+
- `scripts/validate-plugin.sh`
|
|
135
|
+
- `scripts/validate-hooks.sh`
|
|
136
|
+
- `scripts/validate-all.sh`
|
|
137
|
+
- `scripts/tests/test-validate-lessons.sh`
|
|
138
|
+
- `scripts/tests/test-validate-skills.sh`
|
|
139
|
+
- `scripts/tests/test-validate-commands.sh`
|
|
140
|
+
- `scripts/tests/test-validate-plans.sh`
|
|
141
|
+
- `scripts/tests/test-validate-prd.sh`
|
|
142
|
+
- `scripts/tests/test-validate-plugin.sh`
|
|
143
|
+
- `scripts/tests/test-validate-hooks.sh`
|
|
144
|
+
- `Makefile`
|
|
145
|
+
- `.github/workflows/ci.yml`
|
|
146
|
+
|
|
147
|
+
Modified files:
|
|
148
|
+
- `scripts/quality-gate.sh` — add validate-all.sh step
|
|
@@ -0,0 +1,540 @@
|
|
|
1
|
+
# Validator Suite Implementation Plan
|
|
2
|
+
|
|
3
|
+
> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
|
|
4
|
+
|
|
5
|
+
**Goal:** Build self-validation runners for all toolkit artifacts (lessons, skills, commands, plans, PRDs, plugin metadata, hooks), wire them into CI and a Makefile.
|
|
6
|
+
|
|
7
|
+
**Architecture:** Modular bash validators following the same contract (exit 0/1, `--warn`, `--help`), orchestrated by `validate-all.sh`, integrated into `quality-gate.sh` and GitHub Actions.
|
|
8
|
+
|
|
9
|
+
**Tech Stack:** Bash, jq, sed. No external dependencies beyond what the toolkit already uses.
|
|
10
|
+
|
|
11
|
+
**Design:** `docs/plans/2026-02-21-validator-suite-design.md`
|
|
12
|
+
|
|
13
|
+
## Quality Gates
|
|
14
|
+
|
|
15
|
+
Between each batch, run:
|
|
16
|
+
```bash
|
|
17
|
+
bash scripts/tests/run-all-tests.sh
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Batch 1: Test Helpers and validate-lessons.sh
|
|
23
|
+
|
|
24
|
+
### Task 1: Create shared test helpers
|
|
25
|
+
|
|
26
|
+
**Files:**
|
|
27
|
+
- Create: `scripts/tests/test-helpers.sh`
|
|
28
|
+
|
|
29
|
+
Create a sourceable helper file with `assert_eq`, `assert_exit`, `assert_contains` (extracted from the pattern in test-quality-gate.sh). Every new test file will source this instead of duplicating the helpers.
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
#!/usr/bin/env bash
|
|
33
|
+
# test-helpers.sh — Shared test assertions for validator tests
|
|
34
|
+
# Source this file, don't execute it directly.
|
|
35
|
+
|
|
36
|
+
FAILURES=0
|
|
37
|
+
TESTS=0
|
|
38
|
+
|
|
39
|
+
assert_eq() {
|
|
40
|
+
local desc="$1" expected="$2" actual="$3"
|
|
41
|
+
TESTS=$((TESTS + 1))
|
|
42
|
+
if [[ "$expected" != "$actual" ]]; then
|
|
43
|
+
echo "FAIL: $desc"
|
|
44
|
+
echo " expected: $expected"
|
|
45
|
+
echo " actual: $actual"
|
|
46
|
+
FAILURES=$((FAILURES + 1))
|
|
47
|
+
else
|
|
48
|
+
echo "PASS: $desc"
|
|
49
|
+
fi
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
assert_exit() {
|
|
53
|
+
local desc="$1" expected_exit="$2"
|
|
54
|
+
shift 2
|
|
55
|
+
local actual_exit=0
|
|
56
|
+
"$@" >/dev/null 2>&1 || actual_exit=$?
|
|
57
|
+
TESTS=$((TESTS + 1))
|
|
58
|
+
if [[ "$expected_exit" != "$actual_exit" ]]; then
|
|
59
|
+
echo "FAIL: $desc"
|
|
60
|
+
echo " expected exit: $expected_exit"
|
|
61
|
+
echo " actual exit: $actual_exit"
|
|
62
|
+
FAILURES=$((FAILURES + 1))
|
|
63
|
+
else
|
|
64
|
+
echo "PASS: $desc"
|
|
65
|
+
fi
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
assert_contains() {
|
|
69
|
+
local desc="$1" needle="$2" haystack="$3"
|
|
70
|
+
TESTS=$((TESTS + 1))
|
|
71
|
+
if echo "$haystack" | grep -qF "$needle"; then
|
|
72
|
+
echo "PASS: $desc"
|
|
73
|
+
else
|
|
74
|
+
echo "FAIL: $desc"
|
|
75
|
+
echo " expected to contain: $needle"
|
|
76
|
+
echo " in: $(echo "$haystack" | head -5)"
|
|
77
|
+
FAILURES=$((FAILURES + 1))
|
|
78
|
+
fi
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
assert_not_contains() {
|
|
82
|
+
local desc="$1" needle="$2" haystack="$3"
|
|
83
|
+
TESTS=$((TESTS + 1))
|
|
84
|
+
if echo "$haystack" | grep -qF "$needle"; then
|
|
85
|
+
echo "FAIL: $desc"
|
|
86
|
+
echo " should NOT contain: $needle"
|
|
87
|
+
FAILURES=$((FAILURES + 1))
|
|
88
|
+
else
|
|
89
|
+
echo "PASS: $desc"
|
|
90
|
+
fi
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
# Call at end of test file
|
|
94
|
+
report_results() {
|
|
95
|
+
echo ""
|
|
96
|
+
echo "Results: $((TESTS - FAILURES))/$TESTS passed"
|
|
97
|
+
if [[ $FAILURES -gt 0 ]]; then
|
|
98
|
+
echo "FAILURES: $FAILURES"
|
|
99
|
+
exit 1
|
|
100
|
+
fi
|
|
101
|
+
echo "ALL PASSED"
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Task 2: Write validate-lessons.sh
|
|
106
|
+
|
|
107
|
+
**Files:**
|
|
108
|
+
- Create: `scripts/validate-lessons.sh`
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
#!/usr/bin/env bash
|
|
112
|
+
# validate-lessons.sh — Validate lesson file format and frontmatter
|
|
113
|
+
# Exit 0 if clean, exit 1 if violations found. Use --warn to print but exit 0.
|
|
114
|
+
set -euo pipefail
|
|
115
|
+
|
|
116
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
117
|
+
LESSONS_DIR="$SCRIPT_DIR/../docs/lessons"
|
|
118
|
+
WARN_ONLY=false
|
|
119
|
+
violations=0
|
|
120
|
+
|
|
121
|
+
usage() {
|
|
122
|
+
echo "Usage: validate-lessons.sh [--warn] [--help]"
|
|
123
|
+
echo " Validates all lesson files in docs/lessons/"
|
|
124
|
+
echo " --warn Print violations but exit 0"
|
|
125
|
+
exit 0
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
report_violation() {
|
|
129
|
+
local file="$1" line="$2" msg="$3"
|
|
130
|
+
echo "${file}:${line}: ${msg}"
|
|
131
|
+
((violations++)) || true
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
[[ "${1:-}" == "--help" || "${1:-}" == "-h" ]] && usage
|
|
135
|
+
[[ "${1:-}" == "--warn" ]] && WARN_ONLY=true
|
|
136
|
+
|
|
137
|
+
if [[ ! -d "$LESSONS_DIR" ]]; then
|
|
138
|
+
echo "validate-lessons: lessons directory not found: $LESSONS_DIR" >&2
|
|
139
|
+
exit 1
|
|
140
|
+
fi
|
|
141
|
+
|
|
142
|
+
seen_ids=()
|
|
143
|
+
|
|
144
|
+
for lesson in "$LESSONS_DIR"/[0-9]*.md; do
|
|
145
|
+
[[ -f "$lesson" ]] || continue
|
|
146
|
+
fname="$(basename "$lesson")"
|
|
147
|
+
|
|
148
|
+
# Check 1: First line must be ---
|
|
149
|
+
first_line=$(head -1 "$lesson")
|
|
150
|
+
if [[ "$first_line" != "---" ]]; then
|
|
151
|
+
report_violation "$fname" 1 "First line must be '---', got '$first_line' (code block wrapping?)"
|
|
152
|
+
continue # Can't parse frontmatter if start is wrong
|
|
153
|
+
fi
|
|
154
|
+
|
|
155
|
+
# Extract frontmatter (between first two --- lines)
|
|
156
|
+
frontmatter=$(sed -n '2,/^---$/{ /^---$/d; p; }' "$lesson")
|
|
157
|
+
|
|
158
|
+
# Check 2: Required fields
|
|
159
|
+
for field in id title severity languages; do
|
|
160
|
+
if ! echo "$frontmatter" | grep -q "^${field}:"; then
|
|
161
|
+
report_violation "$fname" 0 "Missing required field: $field"
|
|
162
|
+
fi
|
|
163
|
+
done
|
|
164
|
+
|
|
165
|
+
# Check 3: pattern.type must exist
|
|
166
|
+
if ! echo "$frontmatter" | grep -q "type:"; then
|
|
167
|
+
report_violation "$fname" 0 "Missing pattern.type field"
|
|
168
|
+
fi
|
|
169
|
+
|
|
170
|
+
# Check 4: Extract and validate ID
|
|
171
|
+
lesson_id=$(echo "$frontmatter" | sed -n 's/^id:[[:space:]]*\(.*\)/\1/p' | tr -d ' "'"'"'')
|
|
172
|
+
if [[ -n "$lesson_id" ]]; then
|
|
173
|
+
# Check for duplicate IDs
|
|
174
|
+
for seen in "${seen_ids[@]+"${seen_ids[@]}"}"; do
|
|
175
|
+
if [[ "$seen" == "$lesson_id" ]]; then
|
|
176
|
+
report_violation "$fname" 0 "Duplicate lesson ID: $lesson_id"
|
|
177
|
+
fi
|
|
178
|
+
done
|
|
179
|
+
seen_ids+=("$lesson_id")
|
|
180
|
+
fi
|
|
181
|
+
|
|
182
|
+
# Check 5: Severity must be valid
|
|
183
|
+
severity=$(echo "$frontmatter" | sed -n 's/^severity:[[:space:]]*\(.*\)/\1/p' | tr -d ' ')
|
|
184
|
+
if [[ -n "$severity" ]]; then
|
|
185
|
+
case "$severity" in
|
|
186
|
+
blocker|should-fix|nice-to-have) ;;
|
|
187
|
+
*) report_violation "$fname" 0 "Invalid severity '$severity' (must be blocker|should-fix|nice-to-have)" ;;
|
|
188
|
+
esac
|
|
189
|
+
fi
|
|
190
|
+
|
|
191
|
+
# Check 6: Syntactic lessons must have regex
|
|
192
|
+
pattern_type=$(echo "$frontmatter" | grep "type:" | tail -1 | sed 's/.*type:[[:space:]]*//' | tr -d ' ')
|
|
193
|
+
if [[ "$pattern_type" == "syntactic" ]]; then
|
|
194
|
+
if ! echo "$frontmatter" | grep -q "regex:"; then
|
|
195
|
+
report_violation "$fname" 0 "Syntactic lesson missing regex field"
|
|
196
|
+
fi
|
|
197
|
+
fi
|
|
198
|
+
done
|
|
199
|
+
|
|
200
|
+
if [[ $violations -gt 0 ]]; then
|
|
201
|
+
echo ""
|
|
202
|
+
echo "validate-lessons: FAIL ($violations issues)"
|
|
203
|
+
[[ "$WARN_ONLY" == true ]] && exit 0
|
|
204
|
+
exit 1
|
|
205
|
+
else
|
|
206
|
+
echo "validate-lessons: PASS"
|
|
207
|
+
exit 0
|
|
208
|
+
fi
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Make executable: `chmod +x scripts/validate-lessons.sh`
|
|
212
|
+
|
|
213
|
+
### Task 3: Write test-validate-lessons.sh
|
|
214
|
+
|
|
215
|
+
**Files:**
|
|
216
|
+
- Create: `scripts/tests/test-validate-lessons.sh`
|
|
217
|
+
|
|
218
|
+
Test with fixture lesson files in a temp directory. Override `LESSONS_DIR` approach: the validator uses `$SCRIPT_DIR/../docs/lessons` so we'll test by creating a temp toolkit structure. Tests:
|
|
219
|
+
- Valid lesson passes
|
|
220
|
+
- Missing `---` start line fails
|
|
221
|
+
- Missing required field fails
|
|
222
|
+
- Duplicate IDs fail
|
|
223
|
+
- Invalid severity fails
|
|
224
|
+
- Syntactic without regex fails
|
|
225
|
+
- `--warn` exits 0 even with violations
|
|
226
|
+
- `--help` exits 0
|
|
227
|
+
|
|
228
|
+
The test should create a minimal temp directory mimicking the toolkit structure, symlink the validator script, and set up fixture lesson files.
|
|
229
|
+
|
|
230
|
+
### Task 4: Run tests, commit Batch 1
|
|
231
|
+
|
|
232
|
+
Run: `bash scripts/tests/test-validate-lessons.sh`
|
|
233
|
+
Expected: ALL PASSED
|
|
234
|
+
|
|
235
|
+
Commit:
|
|
236
|
+
```bash
|
|
237
|
+
git add scripts/validate-lessons.sh scripts/tests/test-helpers.sh scripts/tests/test-validate-lessons.sh
|
|
238
|
+
git commit -m "feat: add validate-lessons.sh with test helpers and tests"
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## Batch 2: validate-skills.sh and validate-commands.sh
|
|
244
|
+
|
|
245
|
+
### Task 5: Write validate-skills.sh
|
|
246
|
+
|
|
247
|
+
**Files:**
|
|
248
|
+
- Create: `scripts/validate-skills.sh`
|
|
249
|
+
|
|
250
|
+
Check all `skills/*/SKILL.md` files:
|
|
251
|
+
- Frontmatter starts with `---`
|
|
252
|
+
- Has `name` and `description` fields
|
|
253
|
+
- `name` field matches directory name
|
|
254
|
+
- Any `.md` files referenced in SKILL.md body exist in same directory (use grep for `[filename].md` patterns)
|
|
255
|
+
|
|
256
|
+
Same contract: exit 0/1, `--warn`, `--help`. Make executable.
|
|
257
|
+
|
|
258
|
+
### Task 6: Write validate-commands.sh
|
|
259
|
+
|
|
260
|
+
**Files:**
|
|
261
|
+
- Create: `scripts/validate-commands.sh`
|
|
262
|
+
|
|
263
|
+
Check all `commands/*.md` files:
|
|
264
|
+
- Frontmatter starts with `---`
|
|
265
|
+
- Has `description` field
|
|
266
|
+
- Second `---` delimiter exists (frontmatter is closed)
|
|
267
|
+
|
|
268
|
+
Same contract. Make executable.
|
|
269
|
+
|
|
270
|
+
### Task 7: Write test-validate-skills.sh
|
|
271
|
+
|
|
272
|
+
**Files:**
|
|
273
|
+
- Create: `scripts/tests/test-validate-skills.sh`
|
|
274
|
+
|
|
275
|
+
Source `test-helpers.sh`. Create temp skill directories with valid/invalid SKILL.md files. Test:
|
|
276
|
+
- Valid skill passes
|
|
277
|
+
- Missing name fails
|
|
278
|
+
- Name mismatch with directory fails
|
|
279
|
+
- `--warn` exits 0
|
|
280
|
+
|
|
281
|
+
### Task 8: Write test-validate-commands.sh
|
|
282
|
+
|
|
283
|
+
**Files:**
|
|
284
|
+
- Create: `scripts/tests/test-validate-commands.sh`
|
|
285
|
+
|
|
286
|
+
Source `test-helpers.sh`. Create temp command files. Test:
|
|
287
|
+
- Valid command passes
|
|
288
|
+
- Missing description fails
|
|
289
|
+
- Missing frontmatter fails
|
|
290
|
+
- `--warn` exits 0
|
|
291
|
+
|
|
292
|
+
### Task 9: Run tests, commit Batch 2
|
|
293
|
+
|
|
294
|
+
Run: `bash scripts/tests/test-validate-skills.sh && bash scripts/tests/test-validate-commands.sh`
|
|
295
|
+
Expected: ALL PASSED
|
|
296
|
+
|
|
297
|
+
Commit:
|
|
298
|
+
```bash
|
|
299
|
+
git add scripts/validate-skills.sh scripts/validate-commands.sh scripts/tests/test-validate-skills.sh scripts/tests/test-validate-commands.sh
|
|
300
|
+
git commit -m "feat: add validate-skills.sh and validate-commands.sh with tests"
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
---
|
|
304
|
+
|
|
305
|
+
## Batch 3: validate-plans.sh and validate-prd.sh
|
|
306
|
+
|
|
307
|
+
### Task 10: Write validate-plans.sh
|
|
308
|
+
|
|
309
|
+
**Files:**
|
|
310
|
+
- Create: `scripts/validate-plans.sh`
|
|
311
|
+
|
|
312
|
+
Accepts plan file as argument or defaults to `docs/plans/*.md` (skip design docs — only validate files with `## Batch` headers).
|
|
313
|
+
|
|
314
|
+
Checks:
|
|
315
|
+
- At least one `## Batch N:` header found
|
|
316
|
+
- Each batch has at least one `### Task` header
|
|
317
|
+
- Batch numbers are sequential starting from 1
|
|
318
|
+
|
|
319
|
+
Same contract. Make executable.
|
|
320
|
+
|
|
321
|
+
### Task 11: Write validate-prd.sh
|
|
322
|
+
|
|
323
|
+
**Files:**
|
|
324
|
+
- Create: `scripts/validate-prd.sh`
|
|
325
|
+
|
|
326
|
+
Accepts PRD JSON file as argument or defaults to `tasks/prd.json`. Requires `jq`.
|
|
327
|
+
|
|
328
|
+
Checks:
|
|
329
|
+
- Valid JSON (jq parses without error)
|
|
330
|
+
- Is a JSON array
|
|
331
|
+
- Each element has `id` (number), `title` (string), `acceptance_criteria` (non-empty array)
|
|
332
|
+
- `blocked_by` references only IDs that exist in the file
|
|
333
|
+
- No circular dependencies (simple: check if any task blocks itself)
|
|
334
|
+
|
|
335
|
+
Same contract. Make executable.
|
|
336
|
+
|
|
337
|
+
### Task 12: Write test-validate-plans.sh and test-validate-prd.sh
|
|
338
|
+
|
|
339
|
+
**Files:**
|
|
340
|
+
- Create: `scripts/tests/test-validate-plans.sh`
|
|
341
|
+
- Create: `scripts/tests/test-validate-prd.sh`
|
|
342
|
+
|
|
343
|
+
Plan tests: valid plan passes, no batches fails, empty batch fails, non-sequential fails.
|
|
344
|
+
PRD tests: valid PRD passes, invalid JSON fails, missing fields fail, bad blocked_by fails.
|
|
345
|
+
|
|
346
|
+
### Task 13: Run tests, commit Batch 3
|
|
347
|
+
|
|
348
|
+
Run: `bash scripts/tests/test-validate-plans.sh && bash scripts/tests/test-validate-prd.sh`
|
|
349
|
+
Expected: ALL PASSED
|
|
350
|
+
|
|
351
|
+
Commit:
|
|
352
|
+
```bash
|
|
353
|
+
git add scripts/validate-plans.sh scripts/validate-prd.sh scripts/tests/test-validate-plans.sh scripts/tests/test-validate-prd.sh
|
|
354
|
+
git commit -m "feat: add validate-plans.sh and validate-prd.sh with tests"
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
---
|
|
358
|
+
|
|
359
|
+
## Batch 4: validate-plugin.sh, validate-hooks.sh, and validate-all.sh
|
|
360
|
+
|
|
361
|
+
### Task 14: Write validate-plugin.sh
|
|
362
|
+
|
|
363
|
+
**Files:**
|
|
364
|
+
- Create: `scripts/validate-plugin.sh`
|
|
365
|
+
|
|
366
|
+
Checks `.claude-plugin/plugin.json` and `.claude-plugin/marketplace.json`:
|
|
367
|
+
- Both files exist and are valid JSON
|
|
368
|
+
- `name` field matches between them
|
|
369
|
+
- `version` field matches between them
|
|
370
|
+
|
|
371
|
+
Same contract. Make executable.
|
|
372
|
+
|
|
373
|
+
### Task 15: Write validate-hooks.sh
|
|
374
|
+
|
|
375
|
+
**Files:**
|
|
376
|
+
- Create: `scripts/validate-hooks.sh`
|
|
377
|
+
|
|
378
|
+
Checks `hooks/hooks.json`:
|
|
379
|
+
- Valid JSON
|
|
380
|
+
- Each referenced command script path exists (resolve `${CLAUDE_PLUGIN_ROOT}` to toolkit root)
|
|
381
|
+
- Referenced scripts are executable
|
|
382
|
+
|
|
383
|
+
Same contract. Make executable.
|
|
384
|
+
|
|
385
|
+
### Task 16: Write validate-all.sh
|
|
386
|
+
|
|
387
|
+
**Files:**
|
|
388
|
+
- Create: `scripts/validate-all.sh`
|
|
389
|
+
|
|
390
|
+
Orchestrator that runs: validate-lessons, validate-skills, validate-commands, validate-plugin, validate-hooks. (validate-plans and validate-prd are on-demand — they need file arguments, not repo-level.)
|
|
391
|
+
|
|
392
|
+
For each validator:
|
|
393
|
+
- Run it, capture exit code
|
|
394
|
+
- Print PASS/FAIL per validator
|
|
395
|
+
- Print summary: N/M validators passed
|
|
396
|
+
- Exit 1 if any failed
|
|
397
|
+
- Pass `--warn` through to all validators if provided
|
|
398
|
+
|
|
399
|
+
Make executable.
|
|
400
|
+
|
|
401
|
+
### Task 17: Write tests for plugin, hooks, and validate-all
|
|
402
|
+
|
|
403
|
+
**Files:**
|
|
404
|
+
- Create: `scripts/tests/test-validate-plugin.sh`
|
|
405
|
+
- Create: `scripts/tests/test-validate-hooks.sh`
|
|
406
|
+
- Create: `scripts/tests/test-validate-all.sh`
|
|
407
|
+
|
|
408
|
+
Plugin tests: matching versions pass, mismatched versions fail, missing file fails.
|
|
409
|
+
Hooks tests: valid hooks.json passes, nonexistent script fails, non-executable script fails.
|
|
410
|
+
Validate-all tests: runs on actual toolkit (should pass), `--warn` flag passes through.
|
|
411
|
+
|
|
412
|
+
### Task 18: Run tests, commit Batch 4
|
|
413
|
+
|
|
414
|
+
Run: `bash scripts/tests/test-validate-plugin.sh && bash scripts/tests/test-validate-hooks.sh && bash scripts/tests/test-validate-all.sh`
|
|
415
|
+
Expected: ALL PASSED
|
|
416
|
+
|
|
417
|
+
Commit:
|
|
418
|
+
```bash
|
|
419
|
+
git add scripts/validate-plugin.sh scripts/validate-hooks.sh scripts/validate-all.sh scripts/tests/test-validate-plugin.sh scripts/tests/test-validate-hooks.sh scripts/tests/test-validate-all.sh
|
|
420
|
+
git commit -m "feat: add validate-plugin, validate-hooks, validate-all with tests"
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
---
|
|
424
|
+
|
|
425
|
+
## Batch 5: Makefile, CI, and quality-gate.sh Integration
|
|
426
|
+
|
|
427
|
+
### Task 19: Create Makefile
|
|
428
|
+
|
|
429
|
+
**Files:**
|
|
430
|
+
- Create: `Makefile`
|
|
431
|
+
|
|
432
|
+
```makefile
|
|
433
|
+
.PHONY: test validate ci
|
|
434
|
+
|
|
435
|
+
test:
|
|
436
|
+
@bash scripts/tests/run-all-tests.sh
|
|
437
|
+
|
|
438
|
+
validate:
|
|
439
|
+
@bash scripts/validate-all.sh
|
|
440
|
+
|
|
441
|
+
ci: validate test
|
|
442
|
+
@echo "CI: ALL PASSED"
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
### Task 20: Create GitHub Actions CI workflow
|
|
446
|
+
|
|
447
|
+
**Files:**
|
|
448
|
+
- Create: `.github/workflows/ci.yml`
|
|
449
|
+
|
|
450
|
+
```yaml
|
|
451
|
+
name: CI
|
|
452
|
+
on:
|
|
453
|
+
push:
|
|
454
|
+
branches: [main]
|
|
455
|
+
pull_request:
|
|
456
|
+
branches: [main]
|
|
457
|
+
|
|
458
|
+
jobs:
|
|
459
|
+
ci:
|
|
460
|
+
runs-on: ubuntu-latest
|
|
461
|
+
steps:
|
|
462
|
+
- uses: actions/checkout@v4
|
|
463
|
+
- name: Install jq
|
|
464
|
+
run: sudo apt-get install -y jq
|
|
465
|
+
- name: Run CI
|
|
466
|
+
run: make ci
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
### Task 21: Add validate-all.sh to quality-gate.sh
|
|
470
|
+
|
|
471
|
+
**Files:**
|
|
472
|
+
- Modify: `scripts/quality-gate.sh`
|
|
473
|
+
|
|
474
|
+
Add a new check section between the existing header and Check 1 (Lesson Check):
|
|
475
|
+
|
|
476
|
+
```bash
|
|
477
|
+
# === Check 0: Toolkit Self-Validation ===
|
|
478
|
+
# Only runs when quality-gate is invoked from the toolkit itself
|
|
479
|
+
if [[ -f "$PROJECT_ROOT/scripts/validate-all.sh" ]]; then
|
|
480
|
+
echo "=== Quality Gate: Toolkit Validation ==="
|
|
481
|
+
if ! bash "$PROJECT_ROOT/scripts/validate-all.sh"; then
|
|
482
|
+
echo ""
|
|
483
|
+
echo "quality-gate: FAILED at toolkit validation"
|
|
484
|
+
exit 1
|
|
485
|
+
fi
|
|
486
|
+
fi
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
### Task 22: Run full CI, commit Batch 5
|
|
490
|
+
|
|
491
|
+
Run: `make ci`
|
|
492
|
+
Expected: ALL PASSED (both validate and test)
|
|
493
|
+
|
|
494
|
+
Also run: `bash scripts/validate-all.sh` on the actual toolkit to verify it passes against all real artifacts.
|
|
495
|
+
|
|
496
|
+
Commit:
|
|
497
|
+
```bash
|
|
498
|
+
git add Makefile .github/workflows/ci.yml scripts/quality-gate.sh
|
|
499
|
+
git commit -m "feat: add Makefile, GitHub Actions CI, wire validators into quality-gate"
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
---
|
|
503
|
+
|
|
504
|
+
## Batch 6: Integration Wiring and Final Verification
|
|
505
|
+
|
|
506
|
+
### Task 23: Run validate-all.sh against actual toolkit artifacts
|
|
507
|
+
|
|
508
|
+
Run every validator individually against the real toolkit to confirm they all pass:
|
|
509
|
+
```bash
|
|
510
|
+
bash scripts/validate-lessons.sh
|
|
511
|
+
bash scripts/validate-skills.sh
|
|
512
|
+
bash scripts/validate-commands.sh
|
|
513
|
+
bash scripts/validate-plugin.sh
|
|
514
|
+
bash scripts/validate-hooks.sh
|
|
515
|
+
bash scripts/validate-all.sh
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
Fix any real violations discovered (e.g., skills with name mismatches, commands missing fields).
|
|
519
|
+
|
|
520
|
+
### Task 24: Run full test suite
|
|
521
|
+
|
|
522
|
+
Run the complete test suite to verify no regressions:
|
|
523
|
+
```bash
|
|
524
|
+
bash scripts/tests/run-all-tests.sh
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
Expected: ALL test files pass, including all new test-validate-*.sh files.
|
|
528
|
+
|
|
529
|
+
### Task 25: Run make ci end-to-end
|
|
530
|
+
|
|
531
|
+
Run: `make ci`
|
|
532
|
+
Expected: validate passes, then tests pass, then "CI: ALL PASSED"
|
|
533
|
+
|
|
534
|
+
### Task 26: Final commit if any fixes needed
|
|
535
|
+
|
|
536
|
+
If Task 23 found real violations that needed fixing, commit those fixes:
|
|
537
|
+
```bash
|
|
538
|
+
git add -A
|
|
539
|
+
git commit -m "fix: resolve validator findings in toolkit artifacts"
|
|
540
|
+
```
|