hatch3r 1.8.0 → 2.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/README.md +68 -178
- package/dist/cli/index.js +26966 -15942
- package/{agents → dist/content/agents}/hatch3r-architect.md +39 -9
- package/dist/content/agents/hatch3r-brownfield-spec.md +254 -0
- package/{agents → dist/content/agents}/hatch3r-ci-watcher.md +10 -3
- package/{agents → dist/content/agents}/hatch3r-context-rules.md +24 -6
- package/{agents → dist/content/agents}/hatch3r-creator.md +78 -39
- package/dist/content/agents/hatch3r-dependency-drafter.md +162 -0
- package/{agents → dist/content/agents}/hatch3r-devops.md +14 -4
- package/{agents → dist/content/agents}/hatch3r-docs-writer.md +11 -1
- package/dist/content/agents/hatch3r-edge-case-analyst.md +134 -0
- package/dist/content/agents/hatch3r-enhancability.md +192 -0
- package/{agents → dist/content/agents}/hatch3r-fixer.md +61 -10
- package/dist/content/agents/hatch3r-greenfield-spec.md +256 -0
- package/{agents → dist/content/agents}/hatch3r-handoff-loader.md +40 -14
- package/{agents → dist/content/agents}/hatch3r-handoff-preparer.md +17 -8
- package/dist/content/agents/hatch3r-implementer.md +409 -0
- package/dist/content/agents/hatch3r-incident-responder.md +96 -0
- package/dist/content/agents/hatch3r-learnings-loader.md +377 -0
- package/{agents → dist/content/agents}/hatch3r-lint-fixer.md +16 -4
- package/dist/content/agents/hatch3r-maintainability.md +183 -0
- package/dist/content/agents/hatch3r-pack-installer.md +113 -0
- package/dist/content/agents/hatch3r-performance.md +179 -0
- package/dist/content/agents/hatch3r-reliability.md +193 -0
- package/{agents → dist/content/agents}/hatch3r-researcher.md +30 -7
- package/dist/content/agents/hatch3r-reviewer.md +364 -0
- package/dist/content/agents/hatch3r-scalability.md +162 -0
- package/dist/content/agents/hatch3r-security.md +197 -0
- package/dist/content/agents/hatch3r-testability.md +204 -0
- package/dist/content/agents/hatch3r-ui.md +175 -0
- package/dist/content/agents/hatch3r-ux.md +160 -0
- package/{agents → dist/content/agents}/modes/requirements-elicitation.md +1 -1
- package/{agents → dist/content/agents}/modes/user-flows.md +2 -2
- package/dist/content/agents/shared/clarification-default-block.md +44 -0
- package/dist/content/agents/shared/confidence-gate.md +42 -0
- package/dist/content/agents/shared/cq-specialist-roster.md +26 -0
- package/{agents → dist/content/agents}/shared/efficiency-patterns.md +32 -1
- package/{agents → dist/content/agents}/shared/external-knowledge.md +1 -1
- package/{agents → dist/content/agents}/shared/injection-patterns.md +19 -8
- package/dist/content/agents/shared/principles.md +60 -0
- package/{agents → dist/content/agents}/shared/prompt-structure.md +7 -1
- package/{agents → dist/content/agents}/shared/quality-charter.md +73 -9
- package/dist/content/agents/shared/quality-specialist-frame.md +141 -0
- package/dist/content/agents/shared/rigor-contract.md +151 -0
- package/dist/content/agents/shared/severity-mapping.md +92 -0
- package/dist/content/agents/shared/triage-vocabulary.md +46 -0
- package/{agents → dist/content/agents}/shared/user-content-templates.md +40 -14
- package/dist/content/agents/shared/user-question-protocol.md +139 -0
- package/{checks → dist/content/checks}/README.md +5 -0
- package/{checks → dist/content/checks}/accessibility.md +14 -7
- package/{checks → dist/content/checks}/code-quality.md +1 -1
- package/{checks → dist/content/checks}/performance.md +7 -4
- package/{checks → dist/content/checks}/security.md +6 -6
- package/{checks → dist/content/checks}/testing.md +1 -1
- package/{commands → dist/content/commands}/board/pickup-azure-devops.md +1 -1
- package/{commands → dist/content/commands}/board/pickup-delegation-multi.md +41 -14
- package/{commands → dist/content/commands}/board/pickup-delegation.md +10 -8
- package/{commands → dist/content/commands}/board/pickup-github.md +1 -1
- package/{commands → dist/content/commands}/board/pickup-gitlab.md +1 -1
- package/{commands → dist/content/commands}/board/pickup-modes.md +1 -0
- package/{commands → dist/content/commands}/board/pickup-post-impl.md +2 -2
- package/{commands → dist/content/commands}/board/shared-azure-devops.md +1 -1
- package/{commands → dist/content/commands}/board/shared-github.md +2 -2
- package/{commands → dist/content/commands}/board/shared-gitlab.md +1 -1
- package/{commands → dist/content/commands}/hatch3r-api-spec.md +80 -3
- package/dist/content/commands/hatch3r-auth-scaffold.md +250 -0
- package/{commands → dist/content/commands}/hatch3r-benchmark.md +91 -8
- package/{commands → dist/content/commands}/hatch3r-board-fill.md +104 -18
- package/{commands → dist/content/commands}/hatch3r-board-pickup.md +99 -15
- package/dist/content/commands/hatch3r-bug-pipeline.md +240 -0
- package/{commands → dist/content/commands}/hatch3r-bug-plan.md +84 -8
- package/{commands → dist/content/commands}/hatch3r-codebase-map.md +82 -6
- package/{commands → dist/content/commands}/hatch3r-create.md +116 -18
- package/{commands → dist/content/commands}/hatch3r-debug.md +112 -24
- package/dist/content/commands/hatch3r-diagnose.md +238 -0
- package/{commands → dist/content/commands}/hatch3r-feature-plan.md +130 -10
- package/dist/content/commands/hatch3r-handoff.md +213 -0
- package/{commands → dist/content/commands}/hatch3r-healthcheck.md +106 -6
- package/dist/content/commands/hatch3r-incident-response.md +228 -0
- package/{commands → dist/content/commands}/hatch3r-migration-plan.md +81 -5
- package/{commands → dist/content/commands}/hatch3r-onboard.md +100 -9
- package/dist/content/commands/hatch3r-pack-install.md +243 -0
- package/{commands → dist/content/commands}/hatch3r-pr-resolve.md +114 -31
- package/{commands → dist/content/commands}/hatch3r-project-spec.md +85 -9
- package/{commands → dist/content/commands}/hatch3r-quick-change.md +115 -20
- package/{commands → dist/content/commands}/hatch3r-refactor-plan.md +82 -6
- package/dist/content/commands/hatch3r-release.md +401 -0
- package/{commands → dist/content/commands}/hatch3r-revision.md +104 -18
- package/{commands → dist/content/commands}/hatch3r-roadmap.md +94 -12
- package/{commands → dist/content/commands}/hatch3r-security-audit.md +107 -7
- package/dist/content/commands/hatch3r-slo-scaffold.md +246 -0
- package/dist/content/commands/hatch3r-spec.md +216 -0
- package/{commands → dist/content/commands}/hatch3r-test-plan.md +90 -14
- package/dist/content/commands/hatch3r-workflow.md +628 -0
- package/{commands → dist/content/commands}/revision/revision-delegation.md +8 -7
- package/{commands → dist/content/commands}/revision/revision-modes.md +49 -4
- package/{commands → dist/content/commands}/revision/revision-quality.md +12 -9
- package/dist/content/commands/shared/orchestration-frame.md +119 -0
- package/{github-agents → dist/content/github-agents}/hatch3r-docs-agent.md +22 -2
- package/dist/content/github-agents/hatch3r-lint-agent.md +66 -0
- package/{github-agents → dist/content/github-agents}/hatch3r-security-agent.md +22 -2
- package/{github-agents → dist/content/github-agents}/hatch3r-test-agent.md +22 -2
- package/{hooks → dist/content/hooks}/hatch3r-ci-failure.md +3 -3
- package/{hooks → dist/content/hooks}/hatch3r-file-save.md +4 -4
- package/{hooks → dist/content/hooks}/hatch3r-post-merge.md +1 -1
- package/{hooks → dist/content/hooks}/hatch3r-pre-commit.md +1 -1
- package/{hooks → dist/content/hooks}/hatch3r-pre-push.md +7 -7
- package/dist/content/hooks/hatch3r-review-loop-cap.md +52 -0
- package/{hooks → dist/content/hooks}/hatch3r-session-start.md +3 -3
- package/{mcp → dist/content/mcp}/mcp.json +7 -5
- package/{rules → dist/content/rules}/hatch3r-accessibility-standards.md +16 -3
- package/{rules → dist/content/rules}/hatch3r-accessibility-standards.mdc +13 -1
- package/dist/content/rules/hatch3r-agent-orchestration-detail.md +250 -0
- package/dist/content/rules/hatch3r-agent-orchestration-detail.mdc +245 -0
- package/dist/content/rules/hatch3r-agent-orchestration.md +250 -0
- package/dist/content/rules/hatch3r-agent-orchestration.mdc +245 -0
- package/{rules → dist/content/rules}/hatch3r-ai-evals.md +7 -5
- package/{rules → dist/content/rules}/hatch3r-ai-evals.mdc +5 -4
- package/{rules → dist/content/rules}/hatch3r-ai-ux-patterns.md +7 -3
- package/{rules → dist/content/rules}/hatch3r-ai-ux-patterns.mdc +4 -1
- package/dist/content/rules/hatch3r-android-patterns.md +107 -0
- package/dist/content/rules/hatch3r-android-patterns.mdc +102 -0
- package/dist/content/rules/hatch3r-anti-duplication.md +115 -0
- package/dist/content/rules/hatch3r-anti-duplication.mdc +115 -0
- package/{rules → dist/content/rules}/hatch3r-api-design.md +5 -1
- package/{rules → dist/content/rules}/hatch3r-api-design.mdc +3 -0
- package/{rules → dist/content/rules}/hatch3r-api-versioning.md +3 -1
- package/{rules → dist/content/rules}/hatch3r-api-versioning.mdc +1 -0
- package/{rules → dist/content/rules}/hatch3r-auth-patterns.md +5 -2
- package/{rules → dist/content/rules}/hatch3r-auth-patterns.mdc +2 -0
- package/{rules → dist/content/rules}/hatch3r-browser-verification.md +8 -10
- package/{rules → dist/content/rules}/hatch3r-browser-verification.mdc +8 -10
- package/dist/content/rules/hatch3r-capability-matrix.md +108 -0
- package/dist/content/rules/hatch3r-capability-matrix.mdc +108 -0
- package/{rules → dist/content/rules}/hatch3r-ci-cd.md +9 -1
- package/{rules → dist/content/rules}/hatch3r-ci-cd.mdc +7 -0
- package/dist/content/rules/hatch3r-clarification-default.md +73 -0
- package/dist/content/rules/hatch3r-clarification-default.mdc +73 -0
- package/{rules → dist/content/rules}/hatch3r-code-standards.md +23 -47
- package/{rules → dist/content/rules}/hatch3r-code-standards.mdc +22 -46
- package/{rules → dist/content/rules}/hatch3r-component-conventions.md +4 -1
- package/{rules → dist/content/rules}/hatch3r-component-conventions.mdc +3 -0
- package/{rules → dist/content/rules}/hatch3r-container-hardening.md +13 -3
- package/{rules → dist/content/rules}/hatch3r-container-hardening.mdc +10 -1
- package/{rules → dist/content/rules}/hatch3r-contract-testing.md +3 -1
- package/{rules → dist/content/rules}/hatch3r-contract-testing.mdc +1 -0
- package/dist/content/rules/hatch3r-cost-visibility.md +135 -0
- package/dist/content/rules/hatch3r-cost-visibility.mdc +135 -0
- package/dist/content/rules/hatch3r-cq-rule-frame.md +54 -0
- package/dist/content/rules/hatch3r-cq-rule-frame.mdc +49 -0
- package/{rules → dist/content/rules}/hatch3r-data-classification.md +5 -2
- package/{rules → dist/content/rules}/hatch3r-data-classification.mdc +3 -1
- package/{rules → dist/content/rules}/hatch3r-deep-context.md +14 -14
- package/{rules → dist/content/rules}/hatch3r-deep-context.mdc +13 -13
- package/{rules → dist/content/rules}/hatch3r-dependency-management.md +18 -4
- package/{rules → dist/content/rules}/hatch3r-dependency-management.mdc +16 -3
- package/{rules → dist/content/rules}/hatch3r-design-system-detection.md +4 -2
- package/{rules → dist/content/rules}/hatch3r-design-system-detection.mdc +1 -0
- package/dist/content/rules/hatch3r-dotnet-patterns.md +104 -0
- package/dist/content/rules/hatch3r-dotnet-patterns.mdc +99 -0
- package/dist/content/rules/hatch3r-edge-case-discipline.md +65 -0
- package/dist/content/rules/hatch3r-edge-case-discipline.mdc +65 -0
- package/dist/content/rules/hatch3r-enhancability.md +147 -0
- package/dist/content/rules/hatch3r-enhancability.mdc +142 -0
- package/{rules → dist/content/rules}/hatch3r-event-schema-evolution.md +3 -1
- package/{rules → dist/content/rules}/hatch3r-event-schema-evolution.mdc +1 -0
- package/dist/content/rules/hatch3r-fan-out-discipline.md +91 -0
- package/dist/content/rules/hatch3r-fan-out-discipline.mdc +91 -0
- package/{rules → dist/content/rules}/hatch3r-feature-flags.md +2 -0
- package/{rules → dist/content/rules}/hatch3r-feature-flags.mdc +2 -0
- package/dist/content/rules/hatch3r-flutter-patterns.md +88 -0
- package/dist/content/rules/hatch3r-flutter-patterns.mdc +83 -0
- package/{rules → dist/content/rules}/hatch3r-git-conventions.md +5 -2
- package/{rules → dist/content/rules}/hatch3r-git-conventions.mdc +2 -0
- package/dist/content/rules/hatch3r-go-patterns.md +98 -0
- package/dist/content/rules/hatch3r-go-patterns.mdc +93 -0
- package/{rules → dist/content/rules}/hatch3r-handoff-readiness.md +14 -4
- package/{rules → dist/content/rules}/hatch3r-handoff-readiness.mdc +13 -3
- package/{rules → dist/content/rules}/hatch3r-i18n.md +3 -1
- package/{rules → dist/content/rules}/hatch3r-i18n.mdc +2 -0
- package/dist/content/rules/hatch3r-iteration-summary.md +108 -0
- package/dist/content/rules/hatch3r-iteration-summary.mdc +108 -0
- package/dist/content/rules/hatch3r-learning-system.md +202 -0
- package/dist/content/rules/hatch3r-learning-system.mdc +202 -0
- package/dist/content/rules/hatch3r-maintainability.md +157 -0
- package/dist/content/rules/hatch3r-maintainability.mdc +152 -0
- package/{rules → dist/content/rules}/hatch3r-migrations.md +4 -2
- package/{rules → dist/content/rules}/hatch3r-migrations.mdc +1 -0
- package/{rules → dist/content/rules}/hatch3r-observability-logging.md +2 -1
- package/{rules → dist/content/rules}/hatch3r-observability-logging.mdc +1 -0
- package/{rules → dist/content/rules}/hatch3r-observability-metrics.md +2 -1
- package/{rules → dist/content/rules}/hatch3r-observability-metrics.mdc +1 -0
- package/{rules → dist/content/rules}/hatch3r-observability-tracing.md +46 -36
- package/{rules → dist/content/rules}/hatch3r-observability-tracing.mdc +45 -35
- package/{rules → dist/content/rules}/hatch3r-operability.md +3 -1
- package/{rules → dist/content/rules}/hatch3r-operability.mdc +1 -0
- package/{rules → dist/content/rules}/hatch3r-passkey-server.md +4 -2
- package/{rules → dist/content/rules}/hatch3r-passkey-server.mdc +1 -0
- package/{rules → dist/content/rules}/hatch3r-performance-budgets.md +3 -1
- package/{rules → dist/content/rules}/hatch3r-performance-budgets.mdc +3 -1
- package/dist/content/rules/hatch3r-php-laravel-patterns.md +109 -0
- package/dist/content/rules/hatch3r-php-laravel-patterns.mdc +104 -0
- package/{rules → dist/content/rules}/hatch3r-progressive-delivery.md +5 -1
- package/{rules → dist/content/rules}/hatch3r-progressive-delivery.mdc +3 -0
- package/dist/content/rules/hatch3r-proof-model.md +131 -0
- package/dist/content/rules/hatch3r-proof-model.mdc +131 -0
- package/dist/content/rules/hatch3r-python-patterns.md +70 -0
- package/dist/content/rules/hatch3r-python-patterns.mdc +65 -0
- package/dist/content/rules/hatch3r-react-native-patterns.md +83 -0
- package/dist/content/rules/hatch3r-react-native-patterns.mdc +78 -0
- package/{rules → dist/content/rules}/hatch3r-resilience-patterns.md +3 -1
- package/{rules → dist/content/rules}/hatch3r-resilience-patterns.mdc +1 -0
- package/dist/content/rules/hatch3r-reviewer-calibration.md +84 -0
- package/dist/content/rules/hatch3r-reviewer-calibration.mdc +84 -0
- package/dist/content/rules/hatch3r-right-sizing.md +68 -0
- package/dist/content/rules/hatch3r-right-sizing.mdc +66 -0
- package/dist/content/rules/hatch3r-ruby-rails-patterns.md +111 -0
- package/dist/content/rules/hatch3r-ruby-rails-patterns.mdc +106 -0
- package/dist/content/rules/hatch3r-rust-patterns.md +107 -0
- package/dist/content/rules/hatch3r-rust-patterns.mdc +102 -0
- package/dist/content/rules/hatch3r-scalability.md +137 -0
- package/dist/content/rules/hatch3r-scalability.mdc +132 -0
- package/{rules → dist/content/rules}/hatch3r-secrets-management.md +12 -2
- package/{rules → dist/content/rules}/hatch3r-secrets-management.mdc +9 -0
- package/{rules → dist/content/rules}/hatch3r-security-patterns.md +38 -35
- package/{rules → dist/content/rules}/hatch3r-security-patterns.mdc +36 -34
- package/dist/content/rules/hatch3r-security.md +97 -0
- package/dist/content/rules/hatch3r-security.mdc +92 -0
- package/dist/content/rules/hatch3r-swiftui-patterns.md +98 -0
- package/dist/content/rules/hatch3r-swiftui-patterns.mdc +93 -0
- package/dist/content/rules/hatch3r-testability.md +115 -0
- package/dist/content/rules/hatch3r-testability.mdc +110 -0
- package/{rules → dist/content/rules}/hatch3r-testing.md +6 -2
- package/{rules → dist/content/rules}/hatch3r-testing.mdc +3 -0
- package/{rules → dist/content/rules}/hatch3r-theming.md +3 -1
- package/{rules → dist/content/rules}/hatch3r-theming.mdc +2 -0
- package/dist/content/rules/hatch3r-tool-currency.md +91 -0
- package/dist/content/rules/hatch3r-tool-currency.mdc +86 -0
- package/{rules → dist/content/rules}/hatch3r-tooling-hierarchy.md +30 -32
- package/{rules → dist/content/rules}/hatch3r-tooling-hierarchy.mdc +28 -31
- package/dist/content/rules/hatch3r-typescript-patterns.md +58 -0
- package/dist/content/rules/hatch3r-typescript-patterns.mdc +53 -0
- package/{rules → dist/content/rules}/hatch3r-ux-states-and-flows.md +13 -5
- package/{rules → dist/content/rules}/hatch3r-ux-states-and-flows.mdc +10 -3
- package/{skills → dist/content/skills}/hatch3r-a11y-audit/SKILL.md +11 -9
- package/{skills → dist/content/skills}/hatch3r-a11y-audit/references/manual-audit-checklist.md +7 -5
- package/dist/content/skills/hatch3r-adhoc-orchestrate/SKILL.md +131 -0
- package/{skills → dist/content/skills}/hatch3r-ai-feature/SKILL.md +4 -6
- package/{skills → dist/content/skills}/hatch3r-api-spec/SKILL.md +27 -2
- package/{skills → dist/content/skills}/hatch3r-architecture-review/SKILL.md +5 -8
- package/{commands/hatch3r-board-groom.md → dist/content/skills/hatch3r-board-groom/SKILL.md} +16 -18
- package/{commands/hatch3r-board-init.md → dist/content/skills/hatch3r-board-init/SKILL.md} +34 -31
- package/{commands/hatch3r-board-refresh.md → dist/content/skills/hatch3r-board-refresh/SKILL.md} +17 -19
- package/{commands/hatch3r-board-shared.md → dist/content/skills/hatch3r-board-shared/SKILL.md} +45 -15
- package/dist/content/skills/hatch3r-browser-verify/SKILL.md +307 -0
- package/{skills → dist/content/skills}/hatch3r-bug-fix/SKILL.md +16 -3
- package/{skills → dist/content/skills}/hatch3r-ci-pipeline/SKILL.md +17 -7
- package/{skills → dist/content/skills}/hatch3r-cli-fd/SKILL.md +34 -2
- package/{skills → dist/content/skills}/hatch3r-cli-fzf/SKILL.md +34 -2
- package/dist/content/skills/hatch3r-cli-gh/SKILL.md +139 -0
- package/{skills → dist/content/skills}/hatch3r-cli-jq/SKILL.md +43 -9
- package/{skills → dist/content/skills}/hatch3r-cli-ripgrep/SKILL.md +36 -4
- package/dist/content/skills/hatch3r-cli-toolbox/SKILL.md +376 -0
- package/dist/content/skills/hatch3r-containerize/SKILL.md +157 -0
- package/{skills → dist/content/skills}/hatch3r-context-health/SKILL.md +27 -9
- package/dist/content/skills/hatch3r-cost-tracking/SKILL.md +164 -0
- package/{skills → dist/content/skills}/hatch3r-customize/SKILL.md +9 -13
- package/{skills → dist/content/skills}/hatch3r-dep-audit/SKILL.md +29 -9
- package/{skills → dist/content/skills}/hatch3r-design-system-detect/SKILL.md +4 -8
- package/dist/content/skills/hatch3r-docs-writing/SKILL.md +159 -0
- package/dist/content/skills/hatch3r-enhancability-verify/SKILL.md +152 -0
- package/{skills → dist/content/skills}/hatch3r-feature/SKILL.md +54 -4
- package/dist/content/skills/hatch3r-feedback/SKILL.md +103 -0
- package/{skills → dist/content/skills}/hatch3r-gh-agentic-workflows/SKILL.md +14 -12
- package/{skills → dist/content/skills}/hatch3r-gh-agentic-workflows/references/azure-devops.md +2 -2
- package/{skills → dist/content/skills}/hatch3r-gh-agentic-workflows/references/gitlab-ci.md +1 -1
- package/{skills → dist/content/skills}/hatch3r-handoff-prepare/SKILL.md +12 -15
- package/{skills → dist/content/skills}/hatch3r-handoff-resume/SKILL.md +5 -8
- package/{commands/hatch3r-hooks.md → dist/content/skills/hatch3r-hooks/SKILL.md} +59 -148
- package/dist/content/skills/hatch3r-incident-response/SKILL.md +174 -0
- package/{skills → dist/content/skills}/hatch3r-issue-workflow/SKILL.md +15 -4
- package/dist/content/skills/hatch3r-learn/SKILL.md +317 -0
- package/{skills → dist/content/skills}/hatch3r-logical-refactor/SKILL.md +6 -7
- package/dist/content/skills/hatch3r-maintainability-verify/SKILL.md +146 -0
- package/{skills → dist/content/skills}/hatch3r-migration/SKILL.md +9 -8
- package/{skills → dist/content/skills}/hatch3r-observability-verify/SKILL.md +17 -13
- package/{skills → dist/content/skills}/hatch3r-perf-audit/SKILL.md +14 -10
- package/{skills → dist/content/skills}/hatch3r-pr-creation/SKILL.md +8 -11
- package/{skills → dist/content/skills}/hatch3r-qa-validation/SKILL.md +8 -7
- package/dist/content/skills/hatch3r-recipe/SKILL.md +174 -0
- package/{skills → dist/content/skills}/hatch3r-refactor/SKILL.md +7 -8
- package/dist/content/skills/hatch3r-release/SKILL.md +265 -0
- package/{skills → dist/content/skills}/hatch3r-reliability-verify/SKILL.md +9 -5
- package/{commands/hatch3r-report.md → dist/content/skills/hatch3r-report/SKILL.md} +21 -18
- package/dist/content/skills/hatch3r-scalability-verify/SKILL.md +145 -0
- package/dist/content/skills/hatch3r-security-verify/SKILL.md +144 -0
- package/dist/content/skills/hatch3r-team-convention-author/SKILL.md +126 -0
- package/dist/content/skills/hatch3r-testability-verify/SKILL.md +147 -0
- package/{skills → dist/content/skills}/hatch3r-ui-ux-verify/SKILL.md +20 -12
- package/{skills → dist/content/skills}/hatch3r-visual-refactor/SKILL.md +12 -8
- package/package.json +53 -46
- package/agents/hatch3r-a11y-auditor.md +0 -159
- package/agents/hatch3r-dependency-auditor.md +0 -219
- package/agents/hatch3r-implementer.md +0 -278
- package/agents/hatch3r-learnings-loader.md +0 -343
- package/agents/hatch3r-perf-profiler.md +0 -166
- package/agents/hatch3r-reviewer.md +0 -314
- package/agents/hatch3r-security-auditor.md +0 -180
- package/agents/hatch3r-test-writer.md +0 -171
- package/agents/shared/user-question-protocol.md +0 -95
- package/commands/hatch3r-agent-customize.md +0 -201
- package/commands/hatch3r-command-customize.md +0 -113
- package/commands/hatch3r-context-health.md +0 -147
- package/commands/hatch3r-cost-tracking.md +0 -163
- package/commands/hatch3r-dep-audit.md +0 -188
- package/commands/hatch3r-handoff.md +0 -133
- package/commands/hatch3r-learn.md +0 -312
- package/commands/hatch3r-recipe.md +0 -194
- package/commands/hatch3r-release.md +0 -350
- package/commands/hatch3r-rule-customize.md +0 -133
- package/commands/hatch3r-skill-customize.md +0 -112
- package/commands/hatch3r-workflow.md +0 -504
- package/dist/cli/index.d.ts +0 -2
- package/dist/cli/index.js.map +0 -1
- package/github-agents/hatch3r-lint-agent.md +0 -46
- package/prompts/hatch3r-bug-triage.md +0 -158
- package/prompts/hatch3r-code-review.md +0 -134
- package/prompts/hatch3r-pr-description.md +0 -176
- package/rules/hatch3r-agent-orchestration-detail.md +0 -211
- package/rules/hatch3r-agent-orchestration-detail.mdc +0 -206
- package/rules/hatch3r-agent-orchestration.md +0 -376
- package/rules/hatch3r-agent-orchestration.mdc +0 -371
- package/rules/hatch3r-iteration-summary.md +0 -90
- package/rules/hatch3r-iteration-summary.mdc +0 -85
- package/rules/hatch3r-learning-consult.md +0 -42
- package/rules/hatch3r-learning-consult.mdc +0 -38
- package/rules/hatch3r-observability-tracing-detail.md +0 -20
- package/rules/hatch3r-observability-tracing-detail.mdc +0 -14
- package/rules/hatch3r-observability.md +0 -20
- package/rules/hatch3r-observability.mdc +0 -14
- package/skills/hatch3r-agent-customize/SKILL.md +0 -23
- package/skills/hatch3r-cli-aichat/SKILL.md +0 -84
- package/skills/hatch3r-cli-ast-grep/SKILL.md +0 -85
- package/skills/hatch3r-cli-az-devops/SKILL.md +0 -89
- package/skills/hatch3r-cli-bat/SKILL.md +0 -85
- package/skills/hatch3r-cli-comby/SKILL.md +0 -85
- package/skills/hatch3r-cli-csvkit/SKILL.md +0 -84
- package/skills/hatch3r-cli-delta/SKILL.md +0 -86
- package/skills/hatch3r-cli-difftastic/SKILL.md +0 -84
- package/skills/hatch3r-cli-docker/SKILL.md +0 -89
- package/skills/hatch3r-cli-duckdb/SKILL.md +0 -84
- package/skills/hatch3r-cli-gh/SKILL.md +0 -90
- package/skills/hatch3r-cli-glab/SKILL.md +0 -89
- package/skills/hatch3r-cli-lazygit/SKILL.md +0 -78
- package/skills/hatch3r-cli-llm/SKILL.md +0 -84
- package/skills/hatch3r-cli-miller/SKILL.md +0 -84
- package/skills/hatch3r-cli-mods/SKILL.md +0 -84
- package/skills/hatch3r-cli-overview/SKILL.md +0 -60
- package/skills/hatch3r-cli-playwright/SKILL.md +0 -89
- package/skills/hatch3r-cli-podman/SKILL.md +0 -84
- package/skills/hatch3r-cli-qsv/SKILL.md +0 -91
- package/skills/hatch3r-cli-rtk/SKILL.md +0 -91
- package/skills/hatch3r-cli-sd/SKILL.md +0 -85
- package/skills/hatch3r-cli-stagehand/SKILL.md +0 -111
- package/skills/hatch3r-cli-taplo/SKILL.md +0 -84
- package/skills/hatch3r-cli-yq/SKILL.md +0 -85
- package/skills/hatch3r-cli-zstd/SKILL.md +0 -85
- package/skills/hatch3r-command-customize/SKILL.md +0 -23
- package/skills/hatch3r-cost-tracking/SKILL.md +0 -92
- package/skills/hatch3r-incident-response/SKILL.md +0 -115
- package/skills/hatch3r-recipe/SKILL.md +0 -91
- package/skills/hatch3r-release/SKILL.md +0 -120
- package/skills/hatch3r-rule-customize/SKILL.md +0 -23
- package/skills/hatch3r-skill-customize/SKILL.md +0 -23
- /package/{agents → dist/content/agents}/modes/architecture.md +0 -0
- /package/{agents → dist/content/agents}/modes/boundary-analysis.md +0 -0
- /package/{agents → dist/content/agents}/modes/codebase-impact.md +0 -0
- /package/{agents → dist/content/agents}/modes/complexity-risk.md +0 -0
- /package/{agents → dist/content/agents}/modes/coverage-analysis.md +0 -0
- /package/{agents → dist/content/agents}/modes/current-state.md +0 -0
- /package/{agents → dist/content/agents}/modes/feature-design.md +0 -0
- /package/{agents → dist/content/agents}/modes/impact-analysis.md +0 -0
- /package/{agents → dist/content/agents}/modes/library-docs.md +0 -0
- /package/{agents → dist/content/agents}/modes/migration-path.md +0 -0
- /package/{agents → dist/content/agents}/modes/prior-art.md +0 -0
- /package/{agents → dist/content/agents}/modes/refactoring-strategy.md +0 -0
- /package/{agents → dist/content/agents}/modes/regression.md +0 -0
- /package/{agents → dist/content/agents}/modes/risk-assessment.md +0 -0
- /package/{agents → dist/content/agents}/modes/risk-prioritization.md +0 -0
- /package/{agents → dist/content/agents}/modes/root-cause.md +0 -0
- /package/{agents → dist/content/agents}/modes/similar-implementation.md +0 -0
- /package/{agents → dist/content/agents}/modes/symptom-trace.md +0 -0
- /package/{agents → dist/content/agents}/modes/test-pattern.md +0 -0
- /package/{commands → dist/content/commands}/board/shared-board-overview.md +0 -0
- /package/{commands → dist/content/commands}/revision/revision-board-integration.md +0 -0
- /package/{skills → dist/content/skills}/hatch3r-issue-workflow/references/delegation-patterns.md +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: Security patterns including input validation, auth enforcement, and AI/agentic security for the project
|
|
3
|
-
globs: ["**/
|
|
3
|
+
globs: ["**/security/**", "**/*guard*", "**/*policy*", "**/*permission*", "**/*sanitiz*", "**/*validat*"]
|
|
4
4
|
alwaysApply: false
|
|
5
|
+
precedence: critical
|
|
5
6
|
---
|
|
6
7
|
# Security Patterns
|
|
7
8
|
|
|
@@ -24,12 +25,7 @@ alwaysApply: false
|
|
|
24
25
|
|
|
25
26
|
## Authentication Enforcement
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
- Token validation: pin allowed algorithms (reject `none`), enforce expiry (`exp`), verify audience (`aud`) and issuer (`iss`) claims. Reject tokens failing any check.
|
|
29
|
-
- Session security: `HttpOnly`, `Secure`, `SameSite=Strict` (or `Lax` with justification) cookies. Rotate session ID on privilege change (login, role switch).
|
|
30
|
-
- Multi-factor authentication for sensitive operations: admin actions, payment, account deletion, API key generation.
|
|
31
|
-
- Rate-limit authentication endpoints (login, token refresh, password reset). Lock accounts or add progressive delays after repeated failures.
|
|
32
|
-
- Invalidate all sessions on password change. Provide "sign out everywhere" capability.
|
|
28
|
+
Authentication and authorization patterns (auth middleware, token validation, session security, MFA/AAL mapping, rate-limiting auth endpoints) are owned canonically by `rules/hatch3r-auth-patterns.md`. That rule activates on `**/auth/**`, `**/login/**`, `**/session/**`, `**/middleware/**`, and related globs; this rule no longer restates them, so the two no longer double-fire on the same files. For OWASP A07 in the web-app context see the §A07 section below.
|
|
33
29
|
|
|
34
30
|
## Fail-Closed Defaults
|
|
35
31
|
|
|
@@ -133,6 +129,8 @@ alwaysApply: false
|
|
|
133
129
|
|
|
134
130
|
## OWASP Top 10 2025 (Web Application Security)
|
|
135
131
|
|
|
132
|
+
Subsection order and titles follow the official OWASP Top 10:2025 release (https://owasp.org/Top10/2025/, accessed 2026-06-05). The 2025 list reorders the 2021 set: Security Misconfiguration rises to A02, A03 becomes Software Supply Chain Failures (an expansion of 2021's Vulnerable and Outdated Components), and Injection moves to A05.
|
|
133
|
+
|
|
136
134
|
### A01 — Broken Access Control
|
|
137
135
|
|
|
138
136
|
- Enforce access control server-side. Client-side checks are UX, not security.
|
|
@@ -142,7 +140,32 @@ alwaysApply: false
|
|
|
142
140
|
- Rate-limit API access to minimize automated IDOR scanning and credential stuffing.
|
|
143
141
|
- Log access control failures and alert on repeated violations from the same identity.
|
|
144
142
|
|
|
145
|
-
### A02 —
|
|
143
|
+
### A02 — Security Misconfiguration
|
|
144
|
+
|
|
145
|
+
- Harden all environments: remove default accounts, disable unused features/ports/services, remove sample applications.
|
|
146
|
+
- Use identical security configuration across development, staging, and production. Differences in security settings between environments mask vulnerabilities.
|
|
147
|
+
- Automate configuration verification: infrastructure-as-code with security baselines, configuration scanning in CI.
|
|
148
|
+
- Send security headers on every response (HSTS, CSP, X-Content-Type-Options, X-Frame-Options). Centralize in middleware.
|
|
149
|
+
- Review cloud permissions quarterly. Remove unused IAM roles, security groups, and service accounts.
|
|
150
|
+
- Disable detailed error messages in production. Use generic error responses with correlation IDs for debugging.
|
|
151
|
+
|
|
152
|
+
### A03 — Software Supply Chain Failures
|
|
153
|
+
|
|
154
|
+
Expands 2021's Vulnerable and Outdated Components to cover the full dependency, build, and distribution chain — third-party code, build tools, CI/CD systems, and package registries.
|
|
155
|
+
|
|
156
|
+
- Maintain a software bill of materials (SBOM) for all direct and transitive dependencies.
|
|
157
|
+
- Run `npm audit` (or equivalent) in CI on every build. Block merges with critical or high vulnerabilities.
|
|
158
|
+
- Subscribe to security advisories for all critical dependencies using the platform's built-in tools or third-party equivalents:
|
|
159
|
+
- **GitHub:** Dependabot alerts and security advisories
|
|
160
|
+
- **Azure DevOps:** Microsoft Defender for DevOps or WhiteSource/Mend integration
|
|
161
|
+
- **GitLab:** GitLab Dependency Scanning CI template, or Snyk integration
|
|
162
|
+
- Remove unused dependencies. Unused code with known vulnerabilities is still a risk.
|
|
163
|
+
- Pin dependency versions in lockfiles. Review lockfile changes in PRs with the same scrutiny as code changes.
|
|
164
|
+
- Verify package provenance: prefer signed packages, scoped registries, and `npm ci` over `npm install`. Reject `npx -y` on untrusted names (typosquatting / dependency confusion).
|
|
165
|
+
- Harden the build pipeline itself: pin CI actions by commit SHA, restrict who can modify pipeline config, and treat build secrets as production credentials.
|
|
166
|
+
- Establish SLAs for vulnerability remediation: critical within 24 hours, high within 1 week, moderate within 1 sprint.
|
|
167
|
+
|
|
168
|
+
### A04 — Cryptographic Failures
|
|
146
169
|
|
|
147
170
|
- Classify data by sensitivity (PII, financial, health, credentials). Apply encryption requirements per classification.
|
|
148
171
|
- Encrypt data in transit (TLS 1.2+ mandatory, prefer 1.3) and at rest (AES-256 or equivalent).
|
|
@@ -151,7 +174,7 @@ alwaysApply: false
|
|
|
151
174
|
- Generate cryptographic keys with secure random sources (`crypto.randomBytes`, not `Math.random`). Never hard-code keys or IVs.
|
|
152
175
|
- Disable caching for responses containing sensitive data (`Cache-Control: no-store`).
|
|
153
176
|
|
|
154
|
-
###
|
|
177
|
+
### A05 — Injection
|
|
155
178
|
|
|
156
179
|
- Use parameterized queries or prepared statements for all database operations. Zero tolerance for string concatenation with user input in queries.
|
|
157
180
|
- Apply context-aware output encoding: HTML entities, URL encoding, JavaScript escaping, CSS escaping, LDAP escaping — matched to the output context.
|
|
@@ -159,7 +182,7 @@ alwaysApply: false
|
|
|
159
182
|
- Use `LIMIT` and pagination in queries to prevent mass data disclosure via injection.
|
|
160
183
|
- For OS command execution: avoid entirely if possible. If necessary, use parameterized APIs (not shell interpolation) with strict input validation.
|
|
161
184
|
|
|
162
|
-
###
|
|
185
|
+
### A06 — Insecure Design
|
|
163
186
|
|
|
164
187
|
- Use threat modeling during design phase (STRIDE, attack trees, or equivalent). Identify trust boundaries and abuse cases before writing code.
|
|
165
188
|
- Establish and enforce secure design patterns: separation of concerns, defense in depth, least privilege, fail-closed.
|
|
@@ -167,28 +190,7 @@ alwaysApply: false
|
|
|
167
190
|
- Design rate limiting, resource quotas, and cost controls into the architecture — not as afterthoughts.
|
|
168
191
|
- Establish secure development lifecycle (SDL) practices: security requirements, design review, code review, testing.
|
|
169
192
|
|
|
170
|
-
###
|
|
171
|
-
|
|
172
|
-
- Harden all environments: remove default accounts, disable unused features/ports/services, remove sample applications.
|
|
173
|
-
- Use identical security configuration across development, staging, and production. Differences in security settings between environments mask vulnerabilities.
|
|
174
|
-
- Automate configuration verification: infrastructure-as-code with security baselines, configuration scanning in CI.
|
|
175
|
-
- Send security headers on every response (HSTS, CSP, X-Content-Type-Options, X-Frame-Options). Centralize in middleware.
|
|
176
|
-
- Review cloud permissions quarterly. Remove unused IAM roles, security groups, and service accounts.
|
|
177
|
-
- Disable detailed error messages in production. Use generic error responses with correlation IDs for debugging.
|
|
178
|
-
|
|
179
|
-
### A06 — Vulnerable and Outdated Components
|
|
180
|
-
|
|
181
|
-
- Maintain a software bill of materials (SBOM) for all direct and transitive dependencies.
|
|
182
|
-
- Run `npm audit` (or equivalent) in CI on every build. Block merges with critical or high vulnerabilities.
|
|
183
|
-
- Subscribe to security advisories for all critical dependencies using the platform's built-in tools or third-party equivalents:
|
|
184
|
-
- **GitHub:** Dependabot alerts and security advisories
|
|
185
|
-
- **Azure DevOps:** Microsoft Defender for DevOps or WhiteSource/Mend integration
|
|
186
|
-
- **GitLab:** GitLab Dependency Scanning CI template, or Snyk integration
|
|
187
|
-
- Remove unused dependencies. Unused code with known vulnerabilities is still a risk.
|
|
188
|
-
- Pin dependency versions in lockfiles. Review lockfile changes in PRs with the same scrutiny as code changes.
|
|
189
|
-
- Establish SLAs for vulnerability remediation: critical within 24 hours, high within 1 week, moderate within 1 sprint.
|
|
190
|
-
|
|
191
|
-
### A07 — Identification and Authentication Failures
|
|
193
|
+
### A07 — Authentication Failures
|
|
192
194
|
|
|
193
195
|
- Implement multi-factor authentication for privileged accounts and sensitive operations.
|
|
194
196
|
- Enforce password complexity requirements: minimum 8 characters, check against breached password databases (Have I Been Pwned API).
|
|
@@ -197,7 +199,7 @@ alwaysApply: false
|
|
|
197
199
|
- Never expose session IDs in URLs. Use secure, HttpOnly, SameSite cookies.
|
|
198
200
|
- Implement account lockout with notification after repeated failed attempts.
|
|
199
201
|
|
|
200
|
-
### A08 — Software
|
|
202
|
+
### A08 — Software or Data Integrity Failures
|
|
201
203
|
|
|
202
204
|
- Verify integrity of all software updates, dependencies, and CI/CD pipeline artifacts using digital signatures or checksums.
|
|
203
205
|
- Use lockfiles and verify their integrity. `npm ci` (not `npm install`) in CI for deterministic builds that fail on lockfile drift.
|
|
@@ -209,7 +211,7 @@ alwaysApply: false
|
|
|
209
211
|
- **Azure DevOps:** Pin pipeline tasks by exact version (e.g., `task@2`)
|
|
210
212
|
- **GitLab CI:** Pin included templates by SHA or tag reference
|
|
211
213
|
|
|
212
|
-
### A09 — Security Logging and
|
|
214
|
+
### A09 — Security Logging and Alerting Failures
|
|
213
215
|
|
|
214
216
|
- Log all authentication events (success, failure, lockout), access control failures, input validation failures, and security-relevant business events.
|
|
215
217
|
- Use structured logging with correlation IDs. Include: timestamp, severity, event type, user identity (if available), source IP, resource accessed, outcome.
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: hatch3r-security-rule
|
|
3
|
+
type: rule
|
|
4
|
+
description: CQ3 Security Quality measurement rule — supply-chain integrity, auth depth, secret hygiene, OWASP ASI controls; specialist routing to hatch3r-security
|
|
5
|
+
scope: conditional
|
|
6
|
+
globs: "src/**,**/auth/**,**/.github/workflows/**,**/Dockerfile*,**/package.json,**/package-lock.json,**/pnpm-lock.yaml,**/yarn.lock"
|
|
7
|
+
tags: [floor:security, floor:content-quality, security]
|
|
8
|
+
precedence: high
|
|
9
|
+
quality_charter: agents/shared/quality-charter.md
|
|
10
|
+
cache_friendly: true
|
|
11
|
+
---
|
|
12
|
+
# Security Quality (CQ3)
|
|
13
|
+
|
|
14
|
+
**Pillars:** P6 (Security & Trust), CQ3 (Security Quality)
|
|
15
|
+
|
|
16
|
+
## Scope
|
|
17
|
+
|
|
18
|
+
This rule binds the CQ3 measurement set across end-user code that hatch3r generates AND the framework's own source tree. It complements (does not duplicate) two adjacent rules:
|
|
19
|
+
|
|
20
|
+
- `rules/hatch3r-security-patterns.md` (critical precedence) — input-validation + auth-enforcement patterns at the code level.
|
|
21
|
+
- `rules/hatch3r-secrets-management.md` (critical precedence) — secret detection, env-var hygiene, lockfile policy.
|
|
22
|
+
|
|
23
|
+
This rule owns the CQ3 threshold set, the specialist agent routing, and the per-finding escalation pathway.
|
|
24
|
+
|
|
25
|
+
## CQ3 Threshold Set
|
|
26
|
+
|
|
27
|
+
Source: pillar CQ3 (see `agents/shared/principles.md`). Every threshold below is measurable per audit cycle; missing measurement is a Medium finding minimum.
|
|
28
|
+
|
|
29
|
+
| Threshold | Target | Measurement source |
|
|
30
|
+
|-----------|--------|--------------------|
|
|
31
|
+
| npm provenance | 100% on release artifacts | `npm publish --provenance`; verify via `npm view {pkg} --json | jq .provenance` |
|
|
32
|
+
| SBOM (CycloneDX 1.6 or SPDX 3.0.1) | Attached to every release | CI artifact; `syft` or `cyclonedx-npm` output |
|
|
33
|
+
| SHA-pinned GitHub Actions | 100% — 40-char commit SHA | `.github/workflows/*.yml` grep for `uses: .*@[a-f0-9]{40}` |
|
|
34
|
+
| Cosign-signed containers | 100% on published images | `cosign verify --certificate-identity-regexp` against issuer + Rekor entry |
|
|
35
|
+
| OAuth 2.1 conformance | 100% on auth-bearing services | PKCE on public + confidential clients; refresh-token rotation with reuse detection; implicit + ROPC absent |
|
|
36
|
+
| OIDC ID-token validation | 100% — `iss`, `aud`, `azp`, `exp`, `nonce`, JWKS signature | Code audit per `rules/hatch3r-auth-patterns.md` |
|
|
37
|
+
| DPoP sender-constraint (RFC 9449) | 100% on browser tokens | `htm`, `htu`, `iat`, `jti` validation; key-thumbprint binding |
|
|
38
|
+
| WebAuthn server ceremony | 100% on passwordless flows | Challenge TTL + single-use; RP-ID hash; signature; counter strictly greater; opaque `user.id` |
|
|
39
|
+
| Hardcoded secrets count | 0 per cycle | `gitleaks detect --redact`, `trufflehog filesystem`, `detect-secrets scan` |
|
|
40
|
+
| OWASP ASI01-10 coverage | 100% on agent-produced code | Per-control verification against the current agentic-security domain checklist |
|
|
41
|
+
| CVE advisory acknowledgement | ≤90-day staleness | `npm audit --audit-level=high`; `osv-scanner -r .`; GHSA inspection |
|
|
42
|
+
|
|
43
|
+
## Specialist Agent Routing
|
|
44
|
+
|
|
45
|
+
The CQ3 envelope is owned by a single specialist. Route every trigger below to it:
|
|
46
|
+
|
|
47
|
+
| Trigger | Route to |
|
|
48
|
+
|---------|----------|
|
|
49
|
+
| Auth-flow PR (sign-in, refresh, step-up, logout, token introspection, M2M) | `agents/hatch3r-security.md` (CQ3 specialist) |
|
|
50
|
+
| Release-touching PR (workflow YAML, Dockerfile, package manifest, container manifest, SBOM tooling) | `agents/hatch3r-security.md` (CQ3 specialist) |
|
|
51
|
+
| Project-specific deep audit (database rules, cloud functions, data flows, OWASP Top 10) | `agents/hatch3r-security.md` (CQ3 specialist — deep-audit mode) |
|
|
52
|
+
| CVE response — advisory ≤90 days old matches `package.json` lockfile or SHA-pinned action | `agents/hatch3r-security.md` (CQ3 specialist) + framework-owner escalation per CONSTITUTION §2 P6 |
|
|
53
|
+
| Container hardening (rootless, distroless, non-root UID, capabilities dropped) | `rules/hatch3r-container-hardening.md` (rule) + `agents/hatch3r-security.md` (review) |
|
|
54
|
+
|
|
55
|
+
The CQ3 specialist gates the floor, emits `progress_toward_pillar: content-quality.CQ3+<delta>` per finding, AND performs deep project-specific audits when invoked in deep-audit mode. One agent, one routing surface.
|
|
56
|
+
|
|
57
|
+
## Severity Mapping
|
|
58
|
+
|
|
59
|
+
The Specialist-Status to canonical-severity map (`CRITICAL` → Critical, `FINDINGS` → High + Medium, `PASS` → Low + Info) is the shared CQ frame per `rules/hatch3r-cq-rule-frame.md` → Specialist-Status to Canonical-Severity Map, sourced from `agents/shared/severity-mapping.md`. CQ3 Action per status:
|
|
60
|
+
|
|
61
|
+
- `CRITICAL`: Block release; framework-owner escalation; ≤7d resolution per CONSTITUTION §2 P6.
|
|
62
|
+
- `FINDINGS`: Block merge on `floor:security` paths; ≤14d resolution for High.
|
|
63
|
+
- `PASS`: Surface in iteration summary; no merge block.
|
|
64
|
+
|
|
65
|
+
## Per-Finding Output Format
|
|
66
|
+
|
|
67
|
+
Every finding emitted under this rule uses the CQ per-finding rigor-field schema per `rules/hatch3r-cq-rule-frame.md` → Per-Finding Output Format (rigor-contract fields per `agents/shared/rigor-contract.md`), with `<N>` = CQ3. The `proof_trace` excerpt is the command-output for the measurement that produced the finding (e.g. `npm audit`, `gitleaks`, SHA-pin grep).
|
|
68
|
+
|
|
69
|
+
## Per-Tier Floor Admission
|
|
70
|
+
|
|
71
|
+
Decision 4 (CONSTITUTION §6) admits CQ3 floor items per maturity tier:
|
|
72
|
+
|
|
73
|
+
| Tier | Floor admission |
|
|
74
|
+
|------|-----------------|
|
|
75
|
+
| solo | npm audit clean; no hardcoded secrets; PKCE on OAuth public clients |
|
|
76
|
+
| team | + SBOM attached to release; SHA-pinned actions on release workflow |
|
|
77
|
+
| scaleup | + DPoP on browser tokens; refresh-token rotation; OIDC strict validation |
|
|
78
|
+
| enterprise | + WebAuthn server ceremony; cosign on containers; OWASP ASI01-10 100%; CVE acknowledgement ≤7d for Critical |
|
|
79
|
+
|
|
80
|
+
Tier escalation tightens the floor; previous baselines do not survive a tier bump without re-measurement.
|
|
81
|
+
|
|
82
|
+
## When to Invoke
|
|
83
|
+
|
|
84
|
+
- Every PR touching `src/auth/*`, JWT verification, cookie wiring, OAuth client config, WebAuthn ceremony, or `.github/workflows/*.yml`.
|
|
85
|
+
- Every release-prep gate before publishing — SBOM, provenance, SHA-pin, cosign on all release artifacts.
|
|
86
|
+
- Every dependency update PR — `npm audit`, `osv-scanner`, GHSA inspection; populate `securityNote` per `rules/hatch3r-tool-currency.md` if a CLI tool is affected.
|
|
87
|
+
- Quarterly OWASP ASI revision review — the ASI revision number changes; rerun the 100% coverage gate against the current revision.
|
|
88
|
+
|
|
89
|
+
## References
|
|
90
|
+
|
|
91
|
+
- Pillar CQ3 (measurement set + specialist owner; see `agents/shared/principles.md`).
|
|
92
|
+
- The agentic-security audit domain (OWASP ASI controls + supply-chain audit checklists).
|
|
93
|
+
- `agents/hatch3r-security.md` (CQ3 specialist agent — auth + supply-chain + ASI scope).
|
|
94
|
+
- `agents/hatch3r-security.md` (CQ3 specialist — deep-audit mode for project-specific audits).
|
|
95
|
+
- `rules/hatch3r-security-patterns.md` (input-validation + auth enforcement at code level).
|
|
96
|
+
- `rules/hatch3r-secrets-management.md` (secret detection + env-var hygiene + lockfile policy).
|
|
97
|
+
- `rules/hatch3r-container-hardening.md` (rootless / distroless / non-root UID / capability discipline).
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: CQ3 Security Quality measurement rule — supply-chain integrity, auth depth, secret hygiene, OWASP ASI controls; specialist routing to hatch3r-security
|
|
3
|
+
globs: ["src/**", "**/auth/**", "**/.github/workflows/**", "**/Dockerfile*", "**/package.json", "**/package-lock.json", "**/pnpm-lock.yaml", "**/yarn.lock"]
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
precedence: high
|
|
6
|
+
---
|
|
7
|
+
# Security Quality (CQ3)
|
|
8
|
+
|
|
9
|
+
**Pillars:** P6 (Security & Trust), CQ3 (Security Quality)
|
|
10
|
+
|
|
11
|
+
## Scope
|
|
12
|
+
|
|
13
|
+
This rule binds the CQ3 measurement set across end-user code that hatch3r generates AND the framework's own source tree. It complements (does not duplicate) two adjacent rules:
|
|
14
|
+
|
|
15
|
+
- `rules/hatch3r-security-patterns.md` (critical precedence) — input-validation + auth-enforcement patterns at the code level.
|
|
16
|
+
- `rules/hatch3r-secrets-management.md` (critical precedence) — secret detection, env-var hygiene, lockfile policy.
|
|
17
|
+
|
|
18
|
+
This rule owns the CQ3 threshold set, the specialist agent routing, and the per-finding escalation pathway.
|
|
19
|
+
|
|
20
|
+
## CQ3 Threshold Set
|
|
21
|
+
|
|
22
|
+
Source: pillar CQ3 (see `agents/shared/principles.md`). Every threshold below is measurable per audit cycle; missing measurement is a Medium finding minimum.
|
|
23
|
+
|
|
24
|
+
| Threshold | Target | Measurement source |
|
|
25
|
+
|-----------|--------|--------------------|
|
|
26
|
+
| npm provenance | 100% on release artifacts | `npm publish --provenance`; verify via `npm view {pkg} --json | jq .provenance` |
|
|
27
|
+
| SBOM (CycloneDX 1.6 or SPDX 3.0.1) | Attached to every release | CI artifact; `syft` or `cyclonedx-npm` output |
|
|
28
|
+
| SHA-pinned GitHub Actions | 100% — 40-char commit SHA | `.github/workflows/*.yml` grep for `uses: .*@[a-f0-9]{40}` |
|
|
29
|
+
| Cosign-signed containers | 100% on published images | `cosign verify --certificate-identity-regexp` against issuer + Rekor entry |
|
|
30
|
+
| OAuth 2.1 conformance | 100% on auth-bearing services | PKCE on public + confidential clients; refresh-token rotation with reuse detection; implicit + ROPC absent |
|
|
31
|
+
| OIDC ID-token validation | 100% — `iss`, `aud`, `azp`, `exp`, `nonce`, JWKS signature | Code audit per `rules/hatch3r-auth-patterns.md` |
|
|
32
|
+
| DPoP sender-constraint (RFC 9449) | 100% on browser tokens | `htm`, `htu`, `iat`, `jti` validation; key-thumbprint binding |
|
|
33
|
+
| WebAuthn server ceremony | 100% on passwordless flows | Challenge TTL + single-use; RP-ID hash; signature; counter strictly greater; opaque `user.id` |
|
|
34
|
+
| Hardcoded secrets count | 0 per cycle | `gitleaks detect --redact`, `trufflehog filesystem`, `detect-secrets scan` |
|
|
35
|
+
| OWASP ASI01-10 coverage | 100% on agent-produced code | Per-control verification against the current agentic-security domain checklist |
|
|
36
|
+
| CVE advisory acknowledgement | ≤90-day staleness | `npm audit --audit-level=high`; `osv-scanner -r .`; GHSA inspection |
|
|
37
|
+
|
|
38
|
+
## Specialist Agent Routing
|
|
39
|
+
|
|
40
|
+
The CQ3 envelope is owned by a single specialist. Route every trigger below to it:
|
|
41
|
+
|
|
42
|
+
| Trigger | Route to |
|
|
43
|
+
|---------|----------|
|
|
44
|
+
| Auth-flow PR (sign-in, refresh, step-up, logout, token introspection, M2M) | `agents/hatch3r-security.md` (CQ3 specialist) |
|
|
45
|
+
| Release-touching PR (workflow YAML, Dockerfile, package manifest, container manifest, SBOM tooling) | `agents/hatch3r-security.md` (CQ3 specialist) |
|
|
46
|
+
| Project-specific deep audit (database rules, cloud functions, data flows, OWASP Top 10) | `agents/hatch3r-security.md` (CQ3 specialist — deep-audit mode) |
|
|
47
|
+
| CVE response — advisory ≤90 days old matches `package.json` lockfile or SHA-pinned action | `agents/hatch3r-security.md` (CQ3 specialist) + framework-owner escalation per CONSTITUTION §2 P6 |
|
|
48
|
+
| Container hardening (rootless, distroless, non-root UID, capabilities dropped) | `rules/hatch3r-container-hardening.md` (rule) + `agents/hatch3r-security.md` (review) |
|
|
49
|
+
|
|
50
|
+
The CQ3 specialist gates the floor, emits `progress_toward_pillar: content-quality.CQ3+<delta>` per finding, AND performs deep project-specific audits when invoked in deep-audit mode. One agent, one routing surface.
|
|
51
|
+
|
|
52
|
+
## Severity Mapping
|
|
53
|
+
|
|
54
|
+
The Specialist-Status to canonical-severity map (`CRITICAL` → Critical, `FINDINGS` → High + Medium, `PASS` → Low + Info) is the shared CQ frame per `rules/hatch3r-cq-rule-frame.md` → Specialist-Status to Canonical-Severity Map, sourced from `agents/shared/severity-mapping.md`. CQ3 Action per status:
|
|
55
|
+
|
|
56
|
+
- `CRITICAL`: Block release; framework-owner escalation; ≤7d resolution per CONSTITUTION §2 P6.
|
|
57
|
+
- `FINDINGS`: Block merge on `floor:security` paths; ≤14d resolution for High.
|
|
58
|
+
- `PASS`: Surface in iteration summary; no merge block.
|
|
59
|
+
|
|
60
|
+
## Per-Finding Output Format
|
|
61
|
+
|
|
62
|
+
Every finding emitted under this rule uses the CQ per-finding rigor-field schema per `rules/hatch3r-cq-rule-frame.md` → Per-Finding Output Format (rigor-contract fields per `agents/shared/rigor-contract.md`), with `<N>` = CQ3. The `proof_trace` excerpt is the command-output for the measurement that produced the finding (e.g. `npm audit`, `gitleaks`, SHA-pin grep).
|
|
63
|
+
|
|
64
|
+
## Per-Tier Floor Admission
|
|
65
|
+
|
|
66
|
+
Decision 4 (CONSTITUTION §6) admits CQ3 floor items per maturity tier:
|
|
67
|
+
|
|
68
|
+
| Tier | Floor admission |
|
|
69
|
+
|------|-----------------|
|
|
70
|
+
| solo | npm audit clean; no hardcoded secrets; PKCE on OAuth public clients |
|
|
71
|
+
| team | + SBOM attached to release; SHA-pinned actions on release workflow |
|
|
72
|
+
| scaleup | + DPoP on browser tokens; refresh-token rotation; OIDC strict validation |
|
|
73
|
+
| enterprise | + WebAuthn server ceremony; cosign on containers; OWASP ASI01-10 100%; CVE acknowledgement ≤7d for Critical |
|
|
74
|
+
|
|
75
|
+
Tier escalation tightens the floor; previous baselines do not survive a tier bump without re-measurement.
|
|
76
|
+
|
|
77
|
+
## When to Invoke
|
|
78
|
+
|
|
79
|
+
- Every PR touching `src/auth/*`, JWT verification, cookie wiring, OAuth client config, WebAuthn ceremony, or `.github/workflows/*.yml`.
|
|
80
|
+
- Every release-prep gate before publishing — SBOM, provenance, SHA-pin, cosign on all release artifacts.
|
|
81
|
+
- Every dependency update PR — `npm audit`, `osv-scanner`, GHSA inspection; populate `securityNote` per `rules/hatch3r-tool-currency.md` if a CLI tool is affected.
|
|
82
|
+
- Quarterly OWASP ASI revision review — the ASI revision number changes; rerun the 100% coverage gate against the current revision.
|
|
83
|
+
|
|
84
|
+
## References
|
|
85
|
+
|
|
86
|
+
- Pillar CQ3 (measurement set + specialist owner; see `agents/shared/principles.md`).
|
|
87
|
+
- The agentic-security audit domain (OWASP ASI controls + supply-chain audit checklists).
|
|
88
|
+
- `agents/hatch3r-security.md` (CQ3 specialist agent — auth + supply-chain + ASI scope).
|
|
89
|
+
- `agents/hatch3r-security.md` (CQ3 specialist — deep-audit mode for project-specific audits).
|
|
90
|
+
- `rules/hatch3r-security-patterns.md` (input-validation + auth enforcement at code level).
|
|
91
|
+
- `rules/hatch3r-secrets-management.md` (secret detection + env-var hygiene + lockfile policy).
|
|
92
|
+
- `rules/hatch3r-container-hardening.md` (rootless / distroless / non-root UID / capability discipline).
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: hatch3r-swiftui-patterns
|
|
3
|
+
type: rule
|
|
4
|
+
description: SwiftUI and Swift conventions covering Swift 6 concurrency, @Observable + @Bindable, navigation stacks, Swift Package Manager, modular architecture, and XCTest
|
|
5
|
+
scope: conditional
|
|
6
|
+
globs: "**/*.swift,**/*.swiftinterface,**/Package.swift,**/Package.resolved,**/*.xcodeproj/**,**/*.xcworkspace/**,**/Info.plist,**/*.entitlements,**/Tuist/**,**/Project.swift,**/Workspace.swift,**/ios/**,**/macos/**,**/visionOS/**,**/watchOS/**,**/tvOS/**"
|
|
7
|
+
tags: [implementation]
|
|
8
|
+
quality_charter: agents/shared/quality-charter.md
|
|
9
|
+
cache_friendly: true
|
|
10
|
+
---
|
|
11
|
+
# SwiftUI Patterns
|
|
12
|
+
|
|
13
|
+
**Pillars:** P2 (Scientific & Practical Quality), CQ8 (Maintainability Quality)
|
|
14
|
+
|
|
15
|
+
> Applies when the project ships a SwiftUI/UIKit app or Swift package. Detection signals: `Package.swift`, `*.xcodeproj`, `*.xcworkspace`, or `*.swift` files at repo root.
|
|
16
|
+
|
|
17
|
+
## Swift Language Floor
|
|
18
|
+
|
|
19
|
+
- Target Swift 6.0+ with strict concurrency checking enabled (`SWIFT_STRICT_CONCURRENCY=complete`). Data-race-safety is the default; opt-out (`@unchecked Sendable`) requires a code comment justifying thread-safety reasoning.
|
|
20
|
+
- Adopt `async/await` throughout. Wrap legacy completion-handler APIs with `withCheckedThrowingContinuation` at the boundary; do not propagate completion-handler signatures into new code.
|
|
21
|
+
- Use `Sendable` conformance for types crossing actor boundaries. `actor` for shared mutable state; `MainActor`-isolated types for UI state.
|
|
22
|
+
- Strict typing: no `Any` outside of bridging code. Prefer `some Protocol` (opaque return types) over existential `any Protocol` when the concrete type is known at compile time.
|
|
23
|
+
|
|
24
|
+
## SwiftUI App Architecture
|
|
25
|
+
|
|
26
|
+
- Use `@Observable` macro (Swift 5.9+) for view-model state classes; `@Bindable` for two-way binding in views. `ObservableObject` + `@Published` is legacy — migrate during regular refactors.
|
|
27
|
+
- Pick ONE app-state pattern per app and document it in `docs/architecture.md`:
|
|
28
|
+
- **MV (Model–View) with `@Observable`** — recommended default. View-models are simple `@Observable` classes; views observe by reference.
|
|
29
|
+
- **TCA (The Composable Architecture)** — when the team wants unidirectional data flow with reducers + effects.
|
|
30
|
+
- **MVVM with Combine** — when the team already has heavy Combine investment. Avoid in greenfield code.
|
|
31
|
+
- View body is a pure function of state. Never perform side effects in `body`; use `.task { ... }` or `.onChange(of:) { ... }` modifiers.
|
|
32
|
+
- Compose small `View` types — a view exceeding 200 lines is a refactor signal. Extract subviews and use `@ViewBuilder` for conditional content.
|
|
33
|
+
|
|
34
|
+
## Navigation
|
|
35
|
+
|
|
36
|
+
- Use `NavigationStack` (iOS 16+) with path-driven navigation: bind a `[Destination]` path to the stack and push routes by appending to the array. `NavigationView` is deprecated — migrate.
|
|
37
|
+
- Type the navigation destination via `navigationDestination(for:)` modifiers. Avoid `NavigationLink(destination:)` for stack-pushed views — it bypasses path binding.
|
|
38
|
+
- Deep links: parse incoming URLs in the `.onOpenURL { ... }` modifier on the root view and update the navigation path. Test universal links on a real device — simulators do not honor associated-domains entitlements reliably.
|
|
39
|
+
- Sheets and popovers via `.sheet(item:)` with an `Identifiable` payload — never pass a `Bool` and a separate state variable.
|
|
40
|
+
|
|
41
|
+
## Concurrency
|
|
42
|
+
|
|
43
|
+
- Long-running work: `Task { ... }` for fire-and-forget, `await Task { ... }.value` for cancelable async work. Always check `Task.isCancelled` inside loops.
|
|
44
|
+
- Detached tasks (`Task.detached`) only when you need to escape MainActor isolation; document why in a comment. They inherit no priority or actor isolation.
|
|
45
|
+
- `TaskGroup` for parallel fan-out: prefer `withThrowingTaskGroup` for error propagation. Limit concurrency explicitly (`group.addTask` with a semaphore) when the workload could overload the network or disk.
|
|
46
|
+
- Use AsyncStream / AsyncSequence for event streams. Wrap delegate-based APIs (CLLocationManager, etc.) with `AsyncStream.makeStream(of:)` rather than maintaining ad-hoc callback caches.
|
|
47
|
+
|
|
48
|
+
## Modular Architecture
|
|
49
|
+
|
|
50
|
+
- Swift Package Manager (SPM) is the dependency floor. Vendor packages via local Swift packages, not CocoaPods or Carthage (both in maintenance for new projects).
|
|
51
|
+
- Project structure (Tuist or hand-rolled):
|
|
52
|
+
- `App/` — main app target (UI + composition root only).
|
|
53
|
+
- `Features/<Feature>/` — feature modules, each its own SwiftPM target.
|
|
54
|
+
- `Core/` — shared utilities, networking, persistence.
|
|
55
|
+
- Each feature module exports a public API via `public` types; everything else is `internal`. Cross-feature imports go through `Core/` interfaces.
|
|
56
|
+
- Tuist (`Project.swift`, `Workspace.swift`) for multi-target projects above 5 modules. Hand-managed `.xcodeproj` files are merge-conflict prone — Tuist regenerates them deterministically.
|
|
57
|
+
|
|
58
|
+
## Performance
|
|
59
|
+
|
|
60
|
+
- Profile with Instruments (Time Profiler, Allocations, SwiftUI). Target 60fps on the oldest supported device class.
|
|
61
|
+
- Avoid heavy work in `View.body`. Cache derived values with `@State` initialized via `init` or compute once in `.task { ... }`.
|
|
62
|
+
- Lists: `List` with stable `Identifiable` IDs and `id: \.id` explicit key paths. Use `LazyVStack` inside `ScrollView` for non-Sectioned lists.
|
|
63
|
+
- Images: `AsyncImage` for network images, `Image(systemName:)` for SF Symbols. For high-frequency reload, use `nuke` or `Kingfisher` with disk cache configured.
|
|
64
|
+
- View identity: stable IDs prevent SwiftUI from re-creating views on every state change. `ForEach(items, id: \.id)` — never use `ForEach(items.indices)` for mutable arrays.
|
|
65
|
+
|
|
66
|
+
## Accessibility
|
|
67
|
+
|
|
68
|
+
- Every interactive view has an `.accessibilityLabel(_:)`, `.accessibilityHint(_:)`, and an appropriate `.accessibilityIdentifier(_:)` for UI tests.
|
|
69
|
+
- Group decorative views with `.accessibilityElement(children: .ignore)` so VoiceOver does not stop on every visual element.
|
|
70
|
+
- Dynamic Type: prefer `.font(.body)` and the semantic font modifiers over fixed-point sizes. Test with the largest accessibility size (`accessibility5`).
|
|
71
|
+
- Reduced Motion: gate animations on `@Environment(\.accessibilityReduceMotion)` — disable parallax, springy bounces, and decorative transitions when set.
|
|
72
|
+
|
|
73
|
+
## Testing
|
|
74
|
+
|
|
75
|
+
- Unit tests with XCTest (`*Tests/`). Use `swift-testing` (Swift 6) for new test suites when you need parameterized tests, traits, or parallel execution semantics.
|
|
76
|
+
- UI tests with XCUITest under `*UITests/`. Use accessibility identifiers for query stability — never use text labels for selectors.
|
|
77
|
+
- Snapshot tests via `swift-snapshot-testing` (pointfreeco) for SwiftUI view regressions. Configure per-device snapshots in CI.
|
|
78
|
+
- Mock HTTP with `URLProtocol` subclass or `swift-openapi-generator` mock transport. Never hit real network in unit tests.
|
|
79
|
+
|
|
80
|
+
## Builds & Distribution
|
|
81
|
+
|
|
82
|
+
- Sign with App Store Connect API keys, not Apple ID password. Configure via `xcrun altool --apiKey` or fastlane `app_store_connect_api_key`.
|
|
83
|
+
- Bitcode is removed (Xcode 14+) — do not enable. dSYM archive every release for crash symbolication; upload to Crashlytics / Sentry / TestFlight automatically in CI.
|
|
84
|
+
- App size: enable `SWIFT_OPTIMIZATION_LEVEL=-O` for release builds. Track size via `xcodebuild -resultBundlePath` JSON output in CI.
|
|
85
|
+
- TestFlight for beta distribution. Use external groups for QA, internal groups for engineering — never share builds via plain `.ipa` files.
|
|
86
|
+
|
|
87
|
+
## References
|
|
88
|
+
|
|
89
|
+
- Swift 6 concurrency: https://www.swift.org/migration/documentation/migrationguide/ (accessed 2026-05-27, official-docs)
|
|
90
|
+
- SwiftUI `@Observable`: https://developer.apple.com/documentation/observation (accessed 2026-05-27, official-docs)
|
|
91
|
+
- NavigationStack: https://developer.apple.com/documentation/swiftui/navigationstack (accessed 2026-05-27, official-docs)
|
|
92
|
+
- swift-testing: https://developer.apple.com/xcode/swift-testing/ (accessed 2026-05-27, official-docs)
|
|
93
|
+
|
|
94
|
+
## Cross-References
|
|
95
|
+
|
|
96
|
+
- `rules/hatch3r-component-conventions.md` — four-state surface contract maps to SwiftUI `phase`-based async views.
|
|
97
|
+
- `rules/hatch3r-testing.md` — coverage thresholds and determinism rules apply to XCTest / swift-testing.
|
|
98
|
+
- `rules/hatch3r-accessibility-standards.md` — WCAG mapping for SwiftUI `accessibility*` modifiers.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: SwiftUI and Swift conventions covering Swift 6 concurrency, @Observable + @Bindable, navigation stacks, Swift Package Manager, modular architecture, and XCTest
|
|
3
|
+
globs: ["**/*.swift", "**/*.swiftinterface", "**/Package.swift", "**/Package.resolved", "**/*.xcodeproj/**", "**/*.xcworkspace/**", "**/Info.plist", "**/*.entitlements", "**/Tuist/**", "**/Project.swift", "**/Workspace.swift", "**/ios/**", "**/macos/**", "**/visionOS/**", "**/watchOS/**", "**/tvOS/**"]
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
# SwiftUI Patterns
|
|
7
|
+
|
|
8
|
+
**Pillars:** P2 (Scientific & Practical Quality), CQ8 (Maintainability Quality)
|
|
9
|
+
|
|
10
|
+
> Applies when the project ships a SwiftUI/UIKit app or Swift package. Detection signals: `Package.swift`, `*.xcodeproj`, `*.xcworkspace`, or `*.swift` files at repo root.
|
|
11
|
+
|
|
12
|
+
## Swift Language Floor
|
|
13
|
+
|
|
14
|
+
- Target Swift 6.0+ with strict concurrency checking enabled (`SWIFT_STRICT_CONCURRENCY=complete`). Data-race-safety is the default; opt-out (`@unchecked Sendable`) requires a code comment justifying thread-safety reasoning.
|
|
15
|
+
- Adopt `async/await` throughout. Wrap legacy completion-handler APIs with `withCheckedThrowingContinuation` at the boundary; do not propagate completion-handler signatures into new code.
|
|
16
|
+
- Use `Sendable` conformance for types crossing actor boundaries. `actor` for shared mutable state; `MainActor`-isolated types for UI state.
|
|
17
|
+
- Strict typing: no `Any` outside of bridging code. Prefer `some Protocol` (opaque return types) over existential `any Protocol` when the concrete type is known at compile time.
|
|
18
|
+
|
|
19
|
+
## SwiftUI App Architecture
|
|
20
|
+
|
|
21
|
+
- Use `@Observable` macro (Swift 5.9+) for view-model state classes; `@Bindable` for two-way binding in views. `ObservableObject` + `@Published` is legacy — migrate during regular refactors.
|
|
22
|
+
- Pick ONE app-state pattern per app and document it in `docs/architecture.md`:
|
|
23
|
+
- **MV (Model–View) with `@Observable`** — recommended default. View-models are simple `@Observable` classes; views observe by reference.
|
|
24
|
+
- **TCA (The Composable Architecture)** — when the team wants unidirectional data flow with reducers + effects.
|
|
25
|
+
- **MVVM with Combine** — when the team already has heavy Combine investment. Avoid in greenfield code.
|
|
26
|
+
- View body is a pure function of state. Never perform side effects in `body`; use `.task { ... }` or `.onChange(of:) { ... }` modifiers.
|
|
27
|
+
- Compose small `View` types — a view exceeding 200 lines is a refactor signal. Extract subviews and use `@ViewBuilder` for conditional content.
|
|
28
|
+
|
|
29
|
+
## Navigation
|
|
30
|
+
|
|
31
|
+
- Use `NavigationStack` (iOS 16+) with path-driven navigation: bind a `[Destination]` path to the stack and push routes by appending to the array. `NavigationView` is deprecated — migrate.
|
|
32
|
+
- Type the navigation destination via `navigationDestination(for:)` modifiers. Avoid `NavigationLink(destination:)` for stack-pushed views — it bypasses path binding.
|
|
33
|
+
- Deep links: parse incoming URLs in the `.onOpenURL { ... }` modifier on the root view and update the navigation path. Test universal links on a real device — simulators do not honor associated-domains entitlements reliably.
|
|
34
|
+
- Sheets and popovers via `.sheet(item:)` with an `Identifiable` payload — never pass a `Bool` and a separate state variable.
|
|
35
|
+
|
|
36
|
+
## Concurrency
|
|
37
|
+
|
|
38
|
+
- Long-running work: `Task { ... }` for fire-and-forget, `await Task { ... }.value` for cancelable async work. Always check `Task.isCancelled` inside loops.
|
|
39
|
+
- Detached tasks (`Task.detached`) only when you need to escape MainActor isolation; document why in a comment. They inherit no priority or actor isolation.
|
|
40
|
+
- `TaskGroup` for parallel fan-out: prefer `withThrowingTaskGroup` for error propagation. Limit concurrency explicitly (`group.addTask` with a semaphore) when the workload could overload the network or disk.
|
|
41
|
+
- Use AsyncStream / AsyncSequence for event streams. Wrap delegate-based APIs (CLLocationManager, etc.) with `AsyncStream.makeStream(of:)` rather than maintaining ad-hoc callback caches.
|
|
42
|
+
|
|
43
|
+
## Modular Architecture
|
|
44
|
+
|
|
45
|
+
- Swift Package Manager (SPM) is the dependency floor. Vendor packages via local Swift packages, not CocoaPods or Carthage (both in maintenance for new projects).
|
|
46
|
+
- Project structure (Tuist or hand-rolled):
|
|
47
|
+
- `App/` — main app target (UI + composition root only).
|
|
48
|
+
- `Features/<Feature>/` — feature modules, each its own SwiftPM target.
|
|
49
|
+
- `Core/` — shared utilities, networking, persistence.
|
|
50
|
+
- Each feature module exports a public API via `public` types; everything else is `internal`. Cross-feature imports go through `Core/` interfaces.
|
|
51
|
+
- Tuist (`Project.swift`, `Workspace.swift`) for multi-target projects above 5 modules. Hand-managed `.xcodeproj` files are merge-conflict prone — Tuist regenerates them deterministically.
|
|
52
|
+
|
|
53
|
+
## Performance
|
|
54
|
+
|
|
55
|
+
- Profile with Instruments (Time Profiler, Allocations, SwiftUI). Target 60fps on the oldest supported device class.
|
|
56
|
+
- Avoid heavy work in `View.body`. Cache derived values with `@State` initialized via `init` or compute once in `.task { ... }`.
|
|
57
|
+
- Lists: `List` with stable `Identifiable` IDs and `id: \.id` explicit key paths. Use `LazyVStack` inside `ScrollView` for non-Sectioned lists.
|
|
58
|
+
- Images: `AsyncImage` for network images, `Image(systemName:)` for SF Symbols. For high-frequency reload, use `nuke` or `Kingfisher` with disk cache configured.
|
|
59
|
+
- View identity: stable IDs prevent SwiftUI from re-creating views on every state change. `ForEach(items, id: \.id)` — never use `ForEach(items.indices)` for mutable arrays.
|
|
60
|
+
|
|
61
|
+
## Accessibility
|
|
62
|
+
|
|
63
|
+
- Every interactive view has an `.accessibilityLabel(_:)`, `.accessibilityHint(_:)`, and an appropriate `.accessibilityIdentifier(_:)` for UI tests.
|
|
64
|
+
- Group decorative views with `.accessibilityElement(children: .ignore)` so VoiceOver does not stop on every visual element.
|
|
65
|
+
- Dynamic Type: prefer `.font(.body)` and the semantic font modifiers over fixed-point sizes. Test with the largest accessibility size (`accessibility5`).
|
|
66
|
+
- Reduced Motion: gate animations on `@Environment(\.accessibilityReduceMotion)` — disable parallax, springy bounces, and decorative transitions when set.
|
|
67
|
+
|
|
68
|
+
## Testing
|
|
69
|
+
|
|
70
|
+
- Unit tests with XCTest (`*Tests/`). Use `swift-testing` (Swift 6) for new test suites when you need parameterized tests, traits, or parallel execution semantics.
|
|
71
|
+
- UI tests with XCUITest under `*UITests/`. Use accessibility identifiers for query stability — never use text labels for selectors.
|
|
72
|
+
- Snapshot tests via `swift-snapshot-testing` (pointfreeco) for SwiftUI view regressions. Configure per-device snapshots in CI.
|
|
73
|
+
- Mock HTTP with `URLProtocol` subclass or `swift-openapi-generator` mock transport. Never hit real network in unit tests.
|
|
74
|
+
|
|
75
|
+
## Builds & Distribution
|
|
76
|
+
|
|
77
|
+
- Sign with App Store Connect API keys, not Apple ID password. Configure via `xcrun altool --apiKey` or fastlane `app_store_connect_api_key`.
|
|
78
|
+
- Bitcode is removed (Xcode 14+) — do not enable. dSYM archive every release for crash symbolication; upload to Crashlytics / Sentry / TestFlight automatically in CI.
|
|
79
|
+
- App size: enable `SWIFT_OPTIMIZATION_LEVEL=-O` for release builds. Track size via `xcodebuild -resultBundlePath` JSON output in CI.
|
|
80
|
+
- TestFlight for beta distribution. Use external groups for QA, internal groups for engineering — never share builds via plain `.ipa` files.
|
|
81
|
+
|
|
82
|
+
## References
|
|
83
|
+
|
|
84
|
+
- Swift 6 concurrency: https://www.swift.org/migration/documentation/migrationguide/ (accessed 2026-05-27, official-docs)
|
|
85
|
+
- SwiftUI `@Observable`: https://developer.apple.com/documentation/observation (accessed 2026-05-27, official-docs)
|
|
86
|
+
- NavigationStack: https://developer.apple.com/documentation/swiftui/navigationstack (accessed 2026-05-27, official-docs)
|
|
87
|
+
- swift-testing: https://developer.apple.com/xcode/swift-testing/ (accessed 2026-05-27, official-docs)
|
|
88
|
+
|
|
89
|
+
## Cross-References
|
|
90
|
+
|
|
91
|
+
- `rules/hatch3r-component-conventions.md` — four-state surface contract maps to SwiftUI `phase`-based async views.
|
|
92
|
+
- `rules/hatch3r-testing.md` — coverage thresholds and determinism rules apply to XCTest / swift-testing.
|
|
93
|
+
- `rules/hatch3r-accessibility-standards.md` — WCAG mapping for SwiftUI `accessibility*` modifiers.
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: hatch3r-testability-rule
|
|
3
|
+
type: rule
|
|
4
|
+
description: CQ5 Testability Quality measurement rule — per-feature test-class mandate map, real-deal ratio floor, AI eval coverage, mutation kill rate, specialist routing to hatch3r-testability
|
|
5
|
+
scope: conditional
|
|
6
|
+
globs: "src/**,**/__tests__/**,**/tests/**,**/test/**,**/*.test.*,**/*.spec.*,**/vitest.config.*,**/jest.config.*,**/cypress.config.*"
|
|
7
|
+
tags: [review, testing, floor:content-quality]
|
|
8
|
+
precedence: high
|
|
9
|
+
quality_charter: agents/shared/quality-charter.md
|
|
10
|
+
cache_friendly: true
|
|
11
|
+
---
|
|
12
|
+
# Testability Quality (CQ5)
|
|
13
|
+
|
|
14
|
+
**Pillars:** P2 (Scientific & Practical Quality), CQ5 (Testability Quality)
|
|
15
|
+
|
|
16
|
+
## Scope
|
|
17
|
+
|
|
18
|
+
This rule binds the CQ5 measurement set across end-user code that hatch3r generates AND the framework's own test tree. It complements (does not duplicate) `rules/hatch3r-testing.md` (broad coverage + determinism + flaky-test policy). This rule owns:
|
|
19
|
+
|
|
20
|
+
- The per-feature test-class mandate map.
|
|
21
|
+
- The real-deal-first ratio floor.
|
|
22
|
+
- The AI feature eval coverage gate.
|
|
23
|
+
- The mutation-kill-rate gate on critical paths.
|
|
24
|
+
- Specialist routing to `agents/hatch3r-testability.md` (CQ5 reviewer / gate + test authoring).
|
|
25
|
+
|
|
26
|
+
## Per-Feature Test-Class Mandate Map
|
|
27
|
+
|
|
28
|
+
Source: pillar CQ5 (see `agents/shared/principles.md`) + `rules/hatch3r-testing.md` mandate table. Every changed feature is classified, and the mandated test class MUST be present. Missing the mandated class is a CRITICAL finding from the specialist.
|
|
29
|
+
|
|
30
|
+
| Feature class | Mandated test class | Tooling per ecosystem |
|
|
31
|
+
|---------------|---------------------|-----------------------|
|
|
32
|
+
| Parser (input deserialization, file format, protocol) | Fuzz | jazzer.js (JS), libfuzzer (Rust), atheris (Python), Jazzer (JVM) |
|
|
33
|
+
| Payment (settlement, refund, ledger) | Mutation | Stryker (JS/TS), Pitest (JVM), mutmut (Python), mutpy (Python) |
|
|
34
|
+
| RPC boundary (gRPC, GraphQL, REST consumer/provider) | Contract | Pact (cross-language), Schemathesis (OpenAPI), buf curl (protobuf) |
|
|
35
|
+
| State machine (workflow, transition graph) | Property | fast-check (JS/TS), Hypothesis (Python), ScalaCheck (JVM) |
|
|
36
|
+
| UI (component, page render) | Visual regression | Playwright with toHaveScreenshot, Percy, Chromatic, Loki |
|
|
37
|
+
| AI feature (prompt-driven, model-driven) | Golden + adversarial + regression eval | Inspect AI, promptfoo, Anthropic Workbench evals, Braintrust |
|
|
38
|
+
|
|
39
|
+
## Real-Deal-First Ratio
|
|
40
|
+
|
|
41
|
+
The floor: ≥80% of integration tests use real services (test database, in-process emulator, sandboxed external API) rather than mocks. Mocks are admitted only with a `// MOCK: <reason>` comment naming a specific reason from this allowlist:
|
|
42
|
+
|
|
43
|
+
- `// MOCK: External service has no sandbox (vendor confirmed)`
|
|
44
|
+
- `// MOCK: Network unreachable in CI (offline build)`
|
|
45
|
+
- `// MOCK: Time-source isolation (controlled clock)`
|
|
46
|
+
- `// MOCK: Side-effect quarantine (irreversible operation)`
|
|
47
|
+
- `// MOCK: Performance budget (test pack must run <5min)`
|
|
48
|
+
|
|
49
|
+
Reasons outside the allowlist fail the audit-checklist item 2. Framework-level mock helpers (`vi.mock`, `jest.mock`, `unittest.mock.patch`, `mockito.when`) are detected by import-statement grep against the per-language pattern map.
|
|
50
|
+
|
|
51
|
+
## AI Feature Eval Coverage
|
|
52
|
+
|
|
53
|
+
Every AI feature surface (prompt-driven, model-driven, agent-driven) MUST carry three eval sets per `rules/hatch3r-ai-evals.md`, at 100% coverage:
|
|
54
|
+
|
|
55
|
+
- **Golden set** — known-good inputs with expected outputs; regression marker on every model/prompt change.
|
|
56
|
+
- **Adversarial set** — prompt injections, boundary inputs, malformed payloads; verifies refusal + safe-failure behavior.
|
|
57
|
+
- **Regression set** — historical bug reproductions; ensures fixed bugs stay fixed.
|
|
58
|
+
|
|
59
|
+
CI wires the evals on prompt/model changes; the CI gate exits non-zero on regression. Hallucination is tracked as an SLI per Anthropic engineering guidance (cited under References on the source rule).
|
|
60
|
+
|
|
61
|
+
## Mutation Kill Rate
|
|
62
|
+
|
|
63
|
+
On critical paths (payment, auth, anything labelled `critical` per maturity tier), the mutation kill-rate floor is read from repo config (not from this rule's defaults). Default per-tier floors per CONSTITUTION §6 Decision 4:
|
|
64
|
+
|
|
65
|
+
| Tier | Mutation kill-rate floor on critical paths |
|
|
66
|
+
|------|--------------------------------------------|
|
|
67
|
+
| solo | Not required |
|
|
68
|
+
| team | ≥60% |
|
|
69
|
+
| scaleup | ≥75% |
|
|
70
|
+
| enterprise | ≥85% |
|
|
71
|
+
|
|
72
|
+
Tier escalation raises the floor; the previous baseline does not survive without re-measurement. Out-of-cycle floor changes require a documented baseline reset to keep wave-to-wave comparison valid.
|
|
73
|
+
|
|
74
|
+
## Specialist Agent Routing
|
|
75
|
+
|
|
76
|
+
| Trigger | Route to |
|
|
77
|
+
|---------|----------|
|
|
78
|
+
| Test code added, modified, or removed | `agents/hatch3r-testability.md` (CQ5 reviewer / gate) |
|
|
79
|
+
| New feature in a mandate-map class needs test authoring | `agents/hatch3r-testability.md` (author + gate) |
|
|
80
|
+
| Coverage threshold or test-runner config modified | `agents/hatch3r-testability.md` |
|
|
81
|
+
| AI feature surface added or model/prompt change | `agents/hatch3r-testability.md` + `rules/hatch3r-ai-evals.md` |
|
|
82
|
+
| Mutation kill-rate floor change proposed | `agents/hatch3r-testability.md` with baseline-reset documentation |
|
|
83
|
+
|
|
84
|
+
The CQ5 specialist authors mandated tests, reviews coverage, and gates releases; `agents/hatch3r-testability.md` writes tests AND measures mandate compliance, blocking releases that miss the floor.
|
|
85
|
+
|
|
86
|
+
## Per-Finding Output Format
|
|
87
|
+
|
|
88
|
+
Every finding emitted under this rule uses the CQ per-finding rigor-field schema per `rules/hatch3r-cq-rule-frame.md` → Per-Finding Output Format (rigor-contract fields per `agents/shared/rigor-contract.md`), with `<N>` = CQ5. The `proof_trace` excerpt is the test-file:line citation + runner-output for the measurement that produced the finding.
|
|
89
|
+
|
|
90
|
+
## Severity Mapping
|
|
91
|
+
|
|
92
|
+
The Specialist-Status to canonical-severity map (`CRITICAL` → Critical, `FINDINGS` → High + Medium, `PASS` → Low + Info) is the shared CQ frame per `rules/hatch3r-cq-rule-frame.md` → Specialist-Status to Canonical-Severity Map, sourced from `agents/shared/severity-mapping.md`. CQ5 Action per status:
|
|
93
|
+
|
|
94
|
+
- `CRITICAL`: Block release on mandate-map miss OR AI-eval-coverage <100%.
|
|
95
|
+
- `FINDINGS`: Block merge on real-deal-ratio drop, coverage threshold miss, mutation kill-rate floor breach, or unowned flaky test.
|
|
96
|
+
- `PASS`: Surface in iteration summary.
|
|
97
|
+
|
|
98
|
+
## When to Invoke
|
|
99
|
+
|
|
100
|
+
- Every PR that modifies test code, removes tests, or introduces a feature in a mandate-map class.
|
|
101
|
+
- Every Implementer pre-write check — confirms the mandated test class before writing so `agents/hatch3r-testability.md` produces the right shape on first pass.
|
|
102
|
+
- Every Verifier pre-merge gate immediately before `gh pr merge` on protected branches; status must be PASS to allow merge on auth/payment paths.
|
|
103
|
+
- D03 or D22 audit cycles, and any maturity-tier escalation per `hatch3r config maturity`.
|
|
104
|
+
- AI feature release gate before a prompt/model bump ships to production traffic.
|
|
105
|
+
- Quarterly audit on real-deal ratio drift — even with no PRs to test code, mock accretion over time silently degrades the ratio against the 80% floor.
|
|
106
|
+
|
|
107
|
+
## References
|
|
108
|
+
|
|
109
|
+
- Pillar CQ5 (measurement set + specialist owner; see `agents/shared/principles.md`).
|
|
110
|
+
- The test-coverage-quality audit domain (testability domain).
|
|
111
|
+
- `agents/hatch3r-testability.md` (CQ5 reviewer / gate).
|
|
112
|
+
- `agents/hatch3r-testability.md` (CQ5 test-authoring + gate agent — single owner).
|
|
113
|
+
- `rules/hatch3r-testing.md` (broad coverage + determinism + flaky policy).
|
|
114
|
+
- `rules/hatch3r-ai-evals.md` (golden + adversarial + regression eval requirements).
|
|
115
|
+
- `rules/hatch3r-contract-testing.md` (Pact + Schemathesis pattern).
|