hatch3r 1.3.0 → 1.5.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 +12 -7
- package/agents/hatch3r-a11y-auditor.md +18 -11
- package/agents/hatch3r-architect.md +27 -12
- package/agents/hatch3r-ci-watcher.md +30 -9
- package/agents/hatch3r-context-rules.md +18 -8
- package/agents/hatch3r-dependency-auditor.md +30 -15
- package/agents/hatch3r-devops.md +18 -13
- package/agents/hatch3r-docs-writer.md +33 -12
- package/agents/hatch3r-fixer.md +46 -9
- package/agents/hatch3r-implementer.md +21 -9
- package/agents/hatch3r-learnings-loader.md +24 -7
- package/agents/hatch3r-lint-fixer.md +18 -9
- package/agents/hatch3r-perf-profiler.md +26 -10
- package/agents/hatch3r-researcher.md +57 -919
- package/agents/hatch3r-reviewer.md +29 -10
- package/agents/hatch3r-security-auditor.md +25 -10
- package/agents/hatch3r-test-writer.md +29 -9
- package/agents/modes/architecture.md +1 -0
- package/agents/modes/boundary-analysis.md +2 -1
- package/agents/modes/codebase-impact.md +1 -0
- package/agents/modes/complexity-risk.md +1 -0
- package/agents/modes/coverage-analysis.md +1 -0
- package/agents/modes/current-state.md +1 -0
- package/agents/modes/feature-design.md +1 -0
- package/agents/modes/impact-analysis.md +1 -0
- package/agents/modes/library-docs.md +2 -1
- package/agents/modes/migration-path.md +1 -0
- package/agents/modes/prior-art.md +1 -0
- package/agents/modes/refactoring-strategy.md +1 -0
- package/agents/modes/regression.md +1 -0
- package/agents/modes/requirements-elicitation.md +1 -0
- package/agents/modes/risk-assessment.md +1 -0
- package/agents/modes/risk-prioritization.md +1 -0
- package/agents/modes/root-cause.md +1 -0
- package/agents/modes/similar-implementation.md +2 -1
- package/agents/modes/symptom-trace.md +1 -0
- package/agents/modes/test-pattern.md +2 -1
- package/agents/shared/external-knowledge.md +31 -0
- package/agents/shared/quality-charter.md +96 -0
- package/checks/README.md +1 -0
- package/checks/accessibility.md +55 -0
- package/commands/board/pickup-azure-devops.md +5 -0
- package/commands/board/pickup-delegation-multi.md +9 -1
- package/commands/board/pickup-delegation.md +4 -0
- package/commands/board/pickup-github.md +5 -0
- package/commands/board/pickup-gitlab.md +5 -0
- package/commands/board/pickup-modes.md +1 -0
- package/commands/board/pickup-post-impl.md +9 -1
- package/commands/board/shared-azure-devops.md +14 -3
- package/commands/board/shared-board-overview.md +1 -0
- package/commands/board/shared-github.md +2 -0
- package/commands/board/shared-gitlab.md +10 -2
- package/commands/hatch3r-agent-customize.md +6 -1
- package/commands/hatch3r-api-spec.md +1 -0
- package/commands/hatch3r-benchmark.md +4 -3
- package/commands/hatch3r-board-fill.md +52 -9
- package/commands/hatch3r-board-groom.md +124 -7
- package/commands/hatch3r-board-init.md +7 -3
- package/commands/hatch3r-board-pickup.md +1 -0
- package/commands/hatch3r-board-refresh.md +1 -0
- package/commands/hatch3r-board-shared.md +71 -5
- package/commands/hatch3r-bug-plan.md +2 -1
- package/commands/hatch3r-codebase-map.md +4 -3
- package/commands/hatch3r-command-customize.md +6 -1
- package/commands/hatch3r-context-health.md +1 -0
- package/commands/hatch3r-cost-tracking.md +1 -0
- package/commands/hatch3r-debug.md +4 -3
- package/commands/hatch3r-dep-audit.md +3 -0
- package/commands/hatch3r-feature-plan.md +3 -2
- package/commands/hatch3r-healthcheck.md +1 -0
- package/commands/hatch3r-hooks.md +6 -1
- package/commands/hatch3r-learn.md +1 -0
- package/commands/hatch3r-migration-plan.md +3 -2
- package/commands/hatch3r-onboard.md +2 -1
- package/commands/hatch3r-project-spec.md +4 -3
- package/commands/hatch3r-quick-change.md +31 -3
- package/commands/hatch3r-recipe.md +1 -0
- package/commands/hatch3r-refactor-plan.md +2 -1
- package/commands/hatch3r-release.md +4 -1
- package/commands/hatch3r-revision.md +138 -17
- package/commands/hatch3r-roadmap.md +5 -4
- package/commands/hatch3r-rule-customize.md +5 -0
- package/commands/hatch3r-security-audit.md +1 -0
- package/commands/hatch3r-skill-customize.md +5 -0
- package/commands/hatch3r-test-plan.md +3 -2
- package/commands/hatch3r-workflow.md +15 -1
- package/dist/cli/index.js +7595 -4548
- package/dist/cli/index.js.map +1 -1
- package/hooks/hatch3r-ci-failure.md +1 -0
- package/hooks/hatch3r-file-save.md +1 -0
- package/hooks/hatch3r-post-merge.md +1 -0
- package/hooks/hatch3r-pre-commit.md +1 -0
- package/hooks/hatch3r-pre-push.md +1 -0
- package/hooks/hatch3r-session-start.md +1 -0
- package/package.json +30 -12
- package/rules/hatch3r-accessibility-standards.md +2 -1
- package/rules/hatch3r-accessibility-standards.mdc +1 -1
- package/rules/hatch3r-agent-orchestration-detail.md +207 -0
- package/rules/hatch3r-agent-orchestration-detail.mdc +202 -0
- package/rules/hatch3r-agent-orchestration.md +161 -318
- package/rules/hatch3r-agent-orchestration.mdc +212 -154
- package/rules/hatch3r-api-design.md +2 -1
- package/rules/hatch3r-api-design.mdc +1 -1
- package/rules/hatch3r-browser-verification.md +4 -2
- package/rules/hatch3r-browser-verification.mdc +1 -0
- package/rules/hatch3r-ci-cd.md +2 -1
- package/rules/hatch3r-ci-cd.mdc +1 -1
- package/rules/hatch3r-code-standards.md +15 -2
- package/rules/hatch3r-code-standards.mdc +22 -2
- package/rules/hatch3r-component-conventions.md +2 -1
- package/rules/hatch3r-component-conventions.mdc +1 -1
- package/rules/hatch3r-data-classification.md +2 -1
- package/rules/hatch3r-data-classification.mdc +1 -1
- package/rules/hatch3r-deep-context.md +26 -1
- package/rules/hatch3r-deep-context.mdc +54 -8
- package/rules/hatch3r-dependency-management.md +2 -1
- package/rules/hatch3r-dependency-management.mdc +17 -5
- package/rules/hatch3r-feature-flags.md +2 -0
- package/rules/hatch3r-feature-flags.mdc +1 -0
- package/rules/hatch3r-git-conventions.md +2 -1
- package/rules/hatch3r-git-conventions.mdc +2 -1
- package/rules/hatch3r-i18n.md +2 -1
- package/rules/hatch3r-i18n.mdc +1 -1
- package/rules/hatch3r-learning-consult.md +11 -1
- package/rules/hatch3r-learning-consult.mdc +11 -1
- package/rules/hatch3r-migrations.md +2 -1
- package/rules/hatch3r-migrations.mdc +12 -1
- package/rules/hatch3r-observability-logging.md +34 -0
- package/rules/hatch3r-observability-logging.mdc +30 -0
- package/rules/hatch3r-observability-metrics.md +74 -0
- package/rules/hatch3r-observability-metrics.mdc +70 -0
- package/rules/hatch3r-observability-tracing-detail.md +160 -0
- package/rules/hatch3r-observability-tracing-detail.mdc +63 -0
- package/rules/hatch3r-observability-tracing.md +86 -0
- package/rules/hatch3r-observability-tracing.mdc +77 -0
- package/rules/hatch3r-observability.md +9 -448
- package/rules/hatch3r-observability.mdc +7 -159
- package/rules/hatch3r-performance-budgets.md +2 -0
- package/rules/hatch3r-performance-budgets.mdc +1 -0
- package/rules/hatch3r-secrets-management.md +2 -1
- package/rules/hatch3r-secrets-management.mdc +1 -1
- package/rules/hatch3r-security-patterns.md +3 -2
- package/rules/hatch3r-security-patterns.mdc +12 -1
- package/rules/hatch3r-testing.md +12 -2
- package/rules/hatch3r-testing.mdc +11 -2
- package/rules/hatch3r-theming.md +3 -2
- package/rules/hatch3r-theming.mdc +1 -1
- package/rules/hatch3r-tooling-hierarchy.md +3 -2
- package/rules/hatch3r-tooling-hierarchy.mdc +19 -5
- package/skills/hatch3r-a11y-audit/SKILL.md +11 -4
- package/skills/hatch3r-agent-customize/SKILL.md +5 -72
- package/skills/hatch3r-api-spec/SKILL.md +9 -2
- package/skills/hatch3r-architecture-review/SKILL.md +7 -0
- package/skills/hatch3r-bug-fix/SKILL.md +16 -7
- package/skills/hatch3r-ci-pipeline/SKILL.md +8 -1
- package/skills/hatch3r-command-customize/SKILL.md +5 -62
- package/skills/hatch3r-context-health/SKILL.md +23 -2
- package/skills/hatch3r-cost-tracking/SKILL.md +16 -6
- package/skills/hatch3r-customize/SKILL.md +124 -0
- package/skills/hatch3r-dep-audit/SKILL.md +9 -2
- package/skills/hatch3r-feature/SKILL.md +12 -4
- package/skills/hatch3r-gh-agentic-workflows/SKILL.md +7 -0
- package/skills/hatch3r-incident-response/SKILL.md +7 -0
- package/skills/hatch3r-issue-workflow/SKILL.md +8 -1
- package/skills/hatch3r-logical-refactor/SKILL.md +8 -1
- package/skills/hatch3r-migration/SKILL.md +7 -0
- package/skills/hatch3r-perf-audit/SKILL.md +9 -2
- package/skills/hatch3r-pr-creation/SKILL.md +8 -1
- package/skills/hatch3r-qa-validation/SKILL.md +8 -1
- package/skills/hatch3r-recipe/SKILL.md +8 -1
- package/skills/hatch3r-refactor/SKILL.md +10 -2
- package/skills/hatch3r-release/SKILL.md +8 -1
- package/skills/hatch3r-rule-customize/SKILL.md +5 -65
- package/skills/hatch3r-skill-customize/SKILL.md +5 -62
- package/skills/hatch3r-visual-refactor/SKILL.md +12 -5
|
@@ -4,222 +4,280 @@ alwaysApply: true
|
|
|
4
4
|
---
|
|
5
5
|
# Agent Orchestration
|
|
6
6
|
|
|
7
|
-
This rule governs when and how to delegate work to hatch3r agents, load skills, and spawn subagents. These directives are mandatory — not suggestions.
|
|
7
|
+
This rule governs when and how to delegate work to hatch3r agents, load skills, and spawn subagents. These directives are mandatory — not suggestions. For extended reference on pipeline context schemas, resilience/failure handling, and observability, see `hatch3r-agent-orchestration-detail`.
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Orchestration Differentiation
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Hatch3r's orchestration uses a **phase-gated pipeline** (Research, Implement, Review, Quality) with **structured handoffs** via `PipelineContext` and a **mandatory review gate** before the quality phase. This is not free-form agent chat.
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
- **Workflow command** (full mode and quick mode)
|
|
15
|
-
- **Plain chat** (single task or multiple tasks)
|
|
16
|
-
- **Issue references** (e.g., "implement #5")
|
|
17
|
-
- **Natural language requests** (e.g., "add a dark mode toggle")
|
|
13
|
+
## Universal Applicability
|
|
18
14
|
|
|
19
|
-
|
|
15
|
+
This rule applies to EVERY context without exception: board-pickup (epic, sub-issue, standalone, batch), workflow command (full/quick), plain chat, issue references, and natural language requests. The full sub-agent pipeline is mandatory — never implement code inline without sub-agents.
|
|
20
16
|
|
|
21
17
|
## Universal Sub-Agent Pipeline
|
|
22
18
|
|
|
23
|
-
Every task MUST follow this four-phase pipeline:
|
|
24
|
-
|
|
25
|
-
**Phase 1 — Research:** Spawn `hatch3r-researcher` for context gathering. Skip only for trivial single-line edits (typos, comment fixes, single-value config changes). All other tasks require researcher context. **Before spawning researchers, score the task's complexity per the `hatch3r-deep-context` rule** and add the tier-appropriate researcher modes alongside the standard task-type modes (see Deep Context Integration below).
|
|
26
|
-
|
|
27
|
-
**Phase 2 — Implement:** Spawn `hatch3r-implementer` for ALL code changes. One dedicated implementer per task. Never implement inline — always delegate via the Task tool. **Include reference conventions, resolved requirements, and blast radius data** from Phase 1 in the implementer prompt when available (see Deep Context Integration below).
|
|
28
|
-
|
|
29
|
-
**Phase 3 — Review Loop:**
|
|
30
|
-
|
|
31
|
-
- 3a. Spawn `hatch3r-reviewer` to review the implementation.
|
|
32
|
-
- 3b. If Critical or Warning findings exist: spawn `hatch3r-fixer` with the reviewer output. When fixes touch shared or public interfaces, also include blast radius data and reference conventions from Phase 1 (if available).
|
|
33
|
-
- 3c. Re-review: spawn `hatch3r-reviewer` on the fixed code.
|
|
34
|
-
- 3d. Repeat 3b–3c until the reviewer reports 0 Critical + 0 Warning, or max 3 iterations reached.
|
|
35
|
-
- 3e. If max iterations reached with remaining findings: surface to user for manual resolution.
|
|
36
|
-
|
|
37
|
-
**Phase 4 — Final Quality** (runs ONLY after the review loop is clean):
|
|
38
|
-
|
|
39
|
-
Spawn all applicable specialists in parallel:
|
|
40
|
-
|
|
41
|
-
| Specialist | When | Mandatory? |
|
|
42
|
-
|-----------|------|------------|
|
|
43
|
-
| `hatch3r-test-writer` | After every code change | YES — always for code changes |
|
|
44
|
-
| `hatch3r-security-auditor` | After every code change | YES — always for code changes |
|
|
45
|
-
| `hatch3r-docs-writer` | After every implementation | EVALUATE — spawn when changes affect APIs, architecture, user-facing behavior, or when specs/ADRs need updating |
|
|
46
|
-
| `hatch3r-lint-fixer` | When lint errors present | Conditional |
|
|
47
|
-
| `hatch3r-a11y-auditor` | When UI/accessibility changes | Conditional |
|
|
48
|
-
| `hatch3r-perf-profiler` | When performance-sensitive changes | Conditional |
|
|
49
|
-
| `hatch3r-dependency-auditor` | When dependencies change | Conditional |
|
|
50
|
-
| `hatch3r-ci-watcher` | When CI fails | Conditional |
|
|
51
|
-
| `hatch3r-architect` | When architectural decisions are needed or system design review is requested | Conditional |
|
|
52
|
-
| `hatch3r-devops` | When CI/CD, deployment, or infrastructure tasks are involved | Conditional |
|
|
19
|
+
Every task MUST follow this four-phase pipeline: **Phase 1 — Research** (`hatch3r-researcher`), **Phase 2 — Implement** (`hatch3r-implementer`), **Phase 3 — Review Loop** (`hatch3r-reviewer` + `hatch3r-fixer`), **Phase 4 — Final Quality** (parallel specialists). See Mandatory Delegation Directives below.
|
|
53
20
|
|
|
54
21
|
## Agent Roster
|
|
55
22
|
|
|
56
23
|
| Agent | Purpose | Invoke When |
|
|
57
24
|
|-------|---------|-------------|
|
|
58
|
-
| `hatch3r-researcher` | Context gathering
|
|
59
|
-
| `hatch3r-implementer` |
|
|
60
|
-
| `hatch3r-reviewer` | Code review
|
|
61
|
-
| `hatch3r-fixer` |
|
|
62
|
-
| `hatch3r-test-writer` |
|
|
63
|
-
| `hatch3r-security-auditor` | Security
|
|
64
|
-
| `hatch3r-docs-writer` |
|
|
65
|
-
| `hatch3r-lint-fixer` |
|
|
66
|
-
| `hatch3r-a11y-auditor` | WCAG AA
|
|
67
|
-
| `hatch3r-perf-profiler` | Performance profiling
|
|
68
|
-
| `hatch3r-dependency-auditor` |
|
|
69
|
-
| `hatch3r-ci-watcher` | CI
|
|
70
|
-
| `hatch3r-architect` | Architecture design
|
|
71
|
-
| `hatch3r-devops` | CI/CD
|
|
25
|
+
| `hatch3r-researcher` | Context gathering (15 modes) | Always — before implementation (skip trivial edits) |
|
|
26
|
+
| `hatch3r-implementer` | Single-task implementation | Always — one per task |
|
|
27
|
+
| `hatch3r-reviewer` | Code review | Always — Phase 3 review loop |
|
|
28
|
+
| `hatch3r-fixer` | Fix reviewer findings | Phase 3 — Critical/Warning findings |
|
|
29
|
+
| `hatch3r-test-writer` | Tests | Always — Phase 4 (every code change) |
|
|
30
|
+
| `hatch3r-security-auditor` | Security review | Always — Phase 4 (every code change) |
|
|
31
|
+
| `hatch3r-docs-writer` | Documentation | Phase 4 — evaluate when APIs/architecture/UX affected |
|
|
32
|
+
| `hatch3r-lint-fixer` | Lint/type fixes | Conditional — lint errors present |
|
|
33
|
+
| `hatch3r-a11y-auditor` | WCAG AA checks | Conditional — UI/accessibility changes |
|
|
34
|
+
| `hatch3r-perf-profiler` | Performance profiling | Conditional — performance-sensitive changes |
|
|
35
|
+
| `hatch3r-dependency-auditor` | CVE/supply chain | Conditional — dependencies change |
|
|
36
|
+
| `hatch3r-ci-watcher` | CI failure diagnosis | Conditional — CI fails |
|
|
37
|
+
| `hatch3r-architect` | Architecture design | Conditional — architectural decisions needed |
|
|
38
|
+
| `hatch3r-devops` | CI/CD and deployment | Conditional — infrastructure tasks |
|
|
72
39
|
|
|
73
40
|
## Deep Context Integration
|
|
74
41
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
### Tier-Adjusted Research Modes
|
|
78
|
-
|
|
79
|
-
**Tier 1 (Light — score 0–2):** Use only the standard task-type modes below. No additional modes.
|
|
80
|
-
|
|
81
|
-
**Tier 2 (Standard — score 3–5):** Add these modes at `quick` depth alongside the task-type modes:
|
|
82
|
-
- `requirements-elicitation` — scan for top ambiguities, ask 3–5 clarifying questions
|
|
83
|
-
- `similar-implementation` — find 1 reference implementation, extract top-level patterns
|
|
42
|
+
Score task complexity per the `hatch3r-deep-context` rule before Phase 1. Apply the resulting tier:
|
|
84
43
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
**Tier 3 (Deep — score 6+):** Add these modes at `deep` depth alongside the task-type modes:
|
|
88
|
-
- `requirements-elicitation` — full 10-dimension ambiguity scan, dependency questions, cross-cutting concern checklist
|
|
89
|
-
- `similar-implementation` — find 2–3 references, full convention extraction, divergence analysis
|
|
90
|
-
- `codebase-impact` at `deep` depth (with transitive tracing, API consumer map, blast radius)
|
|
91
|
-
|
|
92
|
-
**Mandatory Tier 3 checkpoint:** Present a consolidated Pre-Implementation Summary to the user and ASK for confirmation. Do NOT proceed to Phase 2 until all unresolved questions are answered.
|
|
93
|
-
|
|
94
|
-
### Implementer Prompt Enrichment
|
|
95
|
-
|
|
96
|
-
When spawning `hatch3r-implementer` in Phase 2, include the following from Phase 1 results when available:
|
|
97
|
-
- **Reference Conventions**: `similar-implementation` output — the implementer uses this in its Convention Lock step (Step 1b)
|
|
98
|
-
- **Resolved Requirements**: User's answers to `requirements-elicitation` questions — explicit decisions the implementer should follow instead of guessing
|
|
99
|
-
- **Blast Radius**: Enhanced `codebase-impact` output with transitive traces and API consumer maps — informs which consumers and contracts must be preserved
|
|
44
|
+
- **Tier 2 (Standard):** Present elicitation questions inline. Await answers before Phase 2.
|
|
45
|
+
- **Tier 3 (Deep):** Present Pre-Implementation Summary and ASK for confirmation. Do NOT proceed until all unresolved questions are answered.
|
|
100
46
|
|
|
101
47
|
## Mandatory Delegation Directives
|
|
102
48
|
|
|
103
49
|
### Context Gathering (Before Implementation)
|
|
104
50
|
|
|
105
|
-
|
|
51
|
+
Spawn `hatch3r-researcher` before implementing any task. Skip only for trivial single-line edits. Select modes by task type, then add tier-appropriate modes per Deep Context Integration:
|
|
106
52
|
|
|
107
|
-
- **`type:bug`**:
|
|
108
|
-
- **`type:feature`**:
|
|
109
|
-
- **`type:refactor`**:
|
|
110
|
-
- **`type:qa`**:
|
|
53
|
+
- **`type:bug`**: `symptom-trace`, `root-cause`, `codebase-impact` + tier modes
|
|
54
|
+
- **`type:feature`**: `codebase-impact`, `feature-design`, `architecture` + tier modes
|
|
55
|
+
- **`type:refactor`**: `current-state`, `refactoring-strategy`, `migration-path` + tier modes
|
|
56
|
+
- **`type:qa`**: `codebase-impact` + tier modes
|
|
111
57
|
|
|
112
|
-
Use depth `quick` for low-risk
|
|
58
|
+
Use depth `quick` for low-risk, `standard` for medium-risk, `deep` for high-risk. Tier 3 always uses `deep` depth.
|
|
113
59
|
|
|
114
|
-
###
|
|
60
|
+
### Research Completeness Checklist
|
|
115
61
|
|
|
116
|
-
|
|
62
|
+
Before Phase 1 to Phase 2 handoff, verify:
|
|
117
63
|
|
|
118
|
-
- **
|
|
119
|
-
-
|
|
120
|
-
- **
|
|
121
|
-
-
|
|
64
|
+
- [ ] **All affected files identified** — files to be created, modified, or deleted are listed.
|
|
65
|
+
- [ ] **Blast radius assessed** — downstream consumers and integration points documented.
|
|
66
|
+
- [ ] **Existing tests located** — test files covering affected code identified (or absence noted).
|
|
67
|
+
- [ ] **Dependencies mapped** — internal and external dependencies enumerated.
|
|
122
68
|
|
|
123
|
-
|
|
124
|
-
- `similar-implementation` findings as "Reference Conventions" (triggers the implementer's Convention Lock step)
|
|
125
|
-
- Resolved `requirements-elicitation` answers as "Resolved Requirements"
|
|
126
|
-
- Enhanced `codebase-impact` blast radius data (Tier 3 only)
|
|
69
|
+
If any item is unconfirmed, re-run researcher with additional modes or surface to user.
|
|
127
70
|
|
|
128
|
-
###
|
|
71
|
+
### Implementation Delegation
|
|
129
72
|
|
|
130
|
-
|
|
73
|
+
Spawn `hatch3r-implementer` via Task tool for ALL code changes. Never implement inline.
|
|
131
74
|
|
|
132
|
-
**
|
|
75
|
+
- **Single issue**: One implementer. Orchestrator owns git/PR/board.
|
|
76
|
+
- **Plain chat task**: One implementer. Create synthetic issue context first.
|
|
77
|
+
- **Epics**: One implementer per sub-issue, level-by-level respecting dependency order.
|
|
78
|
+
- **Batch**: Group by dependency level, one implementer per issue, shared branch + combined PR.
|
|
133
79
|
|
|
134
|
-
|
|
135
|
-
2. If the reviewer reports Critical or Warning findings: spawn `hatch3r-fixer` with the full reviewer output (findings, file paths, line references, suggested fixes).
|
|
136
|
-
3. After fixes: spawn `hatch3r-reviewer` again to re-review the fixed code.
|
|
137
|
-
4. Repeat steps 2–3 until the reviewer reports 0 Critical + 0 Warning, or max 3 iterations reached.
|
|
138
|
-
5. If max iterations reached with remaining findings: surface to user for manual resolution. Do not proceed to Phase 4 until the user acknowledges.
|
|
80
|
+
**Implementer prompt enrichment (Tier 2+):** Include `similar-implementation` findings as "Reference Conventions", resolved `requirements-elicitation` answers as "Resolved Requirements", and blast radius data (Tier 3 only).
|
|
139
81
|
|
|
140
|
-
|
|
82
|
+
### Mid-Implementation Research Gap Checkpoint
|
|
141
83
|
|
|
142
|
-
|
|
84
|
+
At the midpoint of Phase 2 (after initial files are modified but before completion), the implementer MUST evaluate whether research gaps exist. This prevents discovering missing context too late in the pipeline.
|
|
143
85
|
|
|
144
|
-
**
|
|
86
|
+
**Checkpoint triggers:**
|
|
87
|
+
1. Implementation requires modifying a file not listed in `researchFindings.affectedFiles`.
|
|
88
|
+
2. An undocumented dependency or integration point is discovered.
|
|
89
|
+
3. The implementer's confidence drops below "medium" for any sub-task.
|
|
90
|
+
4. A test file expected from research does not exist or covers different behavior.
|
|
145
91
|
|
|
146
|
-
|
|
147
|
-
|
|
92
|
+
**Actions when gaps are detected:**
|
|
93
|
+
- Log the gap in `PipelineContext.researchGaps`.
|
|
94
|
+
- If the gap is blocking (cannot proceed without the missing context): pause implementation, surface the gap to the orchestrator, and request a targeted re-run of `hatch3r-researcher` with the specific modes needed.
|
|
95
|
+
- If the gap is non-blocking (can proceed with assumptions): document the assumption, continue implementation, and flag for reviewer attention in Phase 3.
|
|
148
96
|
|
|
149
|
-
|
|
97
|
+
### Per-Task Mini-Review
|
|
150
98
|
|
|
151
|
-
|
|
99
|
+
For multi-sub-task implementations, the implementer performs a lightweight mini-review after each sub-task: verify correctness, check interface contracts, validate no regressions, gate progression. Mini-reviews are internal (no separate reviewer agent).
|
|
152
100
|
|
|
153
|
-
|
|
101
|
+
### Post-Implementation Quality Pipeline
|
|
154
102
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
103
|
+
**Phase 3 — Review Loop:**
|
|
104
|
+
|
|
105
|
+
1. Spawn `hatch3r-reviewer` with diff and acceptance criteria. Reviewer includes blast radius summary.
|
|
106
|
+
2. Critical/Warning findings: spawn `hatch3r-fixer` with full reviewer output.
|
|
107
|
+
3. Re-review after fixes. Repeat until 0 Critical + 0 Warning, or max 3 iterations.
|
|
108
|
+
4. **Confirmation pass** after clean review: lightweight re-review for fix-driven regressions and acceptance criteria completeness. The confirmation pass checks only: (a) no new test failures compared to Phase 2 baseline, (b) no type errors introduced, (c) acceptance criteria from the issue are still met. It does not re-run the full review checklist.
|
|
109
|
+
5. Max iterations reached: surface to user with a structured summary: iteration count, remaining Critical findings (with file:line), remaining Warning findings, and a recommendation (fix manually vs. accept risk). Never present raw reviewer output without summarization.
|
|
110
|
+
|
|
111
|
+
**Phase 4 — Final Quality** (after review loop is clean):
|
|
112
|
+
|
|
113
|
+
Launch parallel subagents -- no artificial concurrency limit.
|
|
114
|
+
|
|
115
|
+
- **Always:** `hatch3r-test-writer`, `hatch3r-security-auditor`
|
|
116
|
+
- **Evaluate:** `hatch3r-docs-writer` (when APIs/architecture/UX affected)
|
|
117
|
+
- **Conditional:** `hatch3r-lint-fixer`, `hatch3r-a11y-auditor`, `hatch3r-perf-profiler`, `hatch3r-dependency-auditor`, `hatch3r-architect`, `hatch3r-devops`
|
|
118
|
+
|
|
119
|
+
**Specialist Prompt Enrichment:** When spawning Phase 4 specialists, include:
|
|
120
|
+
- The `filesChanged` list from Phase 2 so specialists focus on affected code.
|
|
121
|
+
- The review verdict summary from Phase 3 so specialists do not re-flag already-reviewed issues.
|
|
122
|
+
- The `researchFindings.blastRadius` so specialists can assess downstream impact of their changes.
|
|
123
|
+
|
|
124
|
+
**Phase 4 Specialist Trigger Table:**
|
|
125
|
+
|
|
126
|
+
| Specialist | Mode | Trigger Conditions |
|
|
127
|
+
|-----------|------|--------------------|
|
|
128
|
+
| `hatch3r-test-writer` | Always | Any code change |
|
|
129
|
+
| `hatch3r-security-auditor` | Always | Any code change |
|
|
130
|
+
| `hatch3r-docs-writer` | Evaluate | Public API, architecture, or UX changes |
|
|
131
|
+
| `hatch3r-lint-fixer` | Conditional | Lint/type errors present |
|
|
132
|
+
| `hatch3r-a11y-auditor` | Conditional | UI/accessibility changes |
|
|
133
|
+
| `hatch3r-perf-profiler` | Conditional | Performance-sensitive changes |
|
|
134
|
+
| `hatch3r-dependency-auditor` | Conditional | Dependency files modified (package.json, go.mod, Cargo.toml, requirements.txt, Gemfile, pom.xml, pubspec.yaml, mix.exs, composer.json, and their lockfiles) |
|
|
135
|
+
| `hatch3r-architect` | Conditional | Architectural decisions, new modules/services |
|
|
136
|
+
| `hatch3r-devops` | Conditional | CI/CD or infrastructure changes |
|
|
137
|
+
|
|
138
|
+
**Project-Type-Aware Specialist Selection:**
|
|
139
|
+
|
|
140
|
+
When `PipelineContext.projectType` is available (populated from repo analysis), use the detected languages and frameworks to enrich specialist prompts with language-specific hints. For example:
|
|
141
|
+
- **TypeScript/JavaScript:** Include strict mode checks for lint-fixer, framework-specific test patterns for test-writer.
|
|
142
|
+
- **Python:** Include ruff/mypy hints for lint-fixer, pytest patterns for test-writer, SSTI/SQLi checks for security-auditor.
|
|
143
|
+
- **Go:** Include golangci-lint for lint-fixer, govulncheck for security-auditor, table-driven test patterns for test-writer.
|
|
144
|
+
- **Rust:** Include clippy lints for lint-fixer, cargo-audit for security-auditor.
|
|
145
|
+
|
|
146
|
+
See `src/pipeline/pipelineContext.ts` for the full `LANGUAGE_SPECIALIST_CONFIGS` mapping.
|
|
147
|
+
|
|
148
|
+
### Phase 4 Validation Pass
|
|
149
|
+
|
|
150
|
+
After all Phase 4 specialists complete, run a validation pass to catch regressions:
|
|
151
|
+
|
|
152
|
+
1. Run test suite and type checker. Compare against Phase 3 baseline cached in `PipelineContext`.
|
|
153
|
+
2. No new failures: proceed to completion.
|
|
154
|
+
3. New failures: identify causing specialist, spawn `hatch3r-fixer`, re-validate (max 2 iterations).
|
|
155
|
+
4. Persistent regressions: surface to user. Do not silently accept.
|
|
156
|
+
5. If any specialist produced code fixes (not just findings), spawn a lightweight `hatch3r-reviewer` re-review scoped to files modified by Phase 4 specialists. This prevents specialist fixes from bypassing the Phase 3 review gate. Max 1 re-review iteration; Critical findings trigger a single fixer pass.
|
|
157
|
+
|
|
158
|
+
### Specialist Success Criteria
|
|
159
|
+
|
|
160
|
+
| Specialist | Success Criterion |
|
|
161
|
+
|-----------|-------------------|
|
|
162
|
+
| `hatch3r-test-writer` | All new/modified code paths have tests; no untested branches in changed files. |
|
|
163
|
+
| `hatch3r-security-auditor` | No HIGH/CRITICAL findings unresolved; MEDIUM findings documented with plan. |
|
|
164
|
+
| `hatch3r-docs-writer` | Affected APIs, architecture, and UX changes reflected in docs. |
|
|
165
|
+
| `hatch3r-lint-fixer` | Zero lint/type errors in changed files. |
|
|
166
|
+
| `hatch3r-a11y-auditor` | WCAG AA compliance; no new a11y violations. |
|
|
167
|
+
| `hatch3r-perf-profiler` | No performance regressions; new hot paths benchmarked. |
|
|
168
|
+
| `hatch3r-dependency-auditor` | No known CVEs; license compatibility verified. |
|
|
169
|
+
| `hatch3r-architect` | ADRs documented; design aligns with patterns or divergence justified. |
|
|
170
|
+
| `hatch3r-devops` | CI/CD passes end-to-end; deployment config validated. |
|
|
161
171
|
|
|
162
172
|
## Skill Loading Directives
|
|
163
173
|
|
|
164
|
-
|
|
174
|
+
Load the matching skill before implementation:
|
|
165
175
|
|
|
166
176
|
| Task Type | Skill |
|
|
167
177
|
|-----------|-------|
|
|
168
178
|
| `type:bug` | `hatch3r-bug-fix` |
|
|
169
|
-
| `type:feature` | `hatch3r-feature`
|
|
179
|
+
| `type:feature` | `hatch3r-feature` |
|
|
170
180
|
| `type:refactor` + `area:ui` | `hatch3r-visual-refactor` |
|
|
171
181
|
| `type:refactor` + behavior change | `hatch3r-logical-refactor` |
|
|
172
|
-
| `type:refactor` (other) | `hatch3r-refactor`
|
|
182
|
+
| `type:refactor` (other) | `hatch3r-refactor` |
|
|
173
183
|
| `type:qa` | `hatch3r-qa-validation` |
|
|
174
184
|
|
|
175
|
-
|
|
185
|
+
Skill-referenced agent delegations are mandatory.
|
|
176
186
|
|
|
177
187
|
## Subagent Spawning Protocol
|
|
178
188
|
|
|
179
|
-
|
|
189
|
+
1. Use `subagent_type: "generalPurpose"` for all delegations.
|
|
190
|
+
2. Include: agent protocol, applicable `scope: always` rules, tooling hierarchy, relevant learnings.
|
|
191
|
+
3. Launch independent subagents in parallel — maximum parallelism.
|
|
192
|
+
4. Await and review results. Surface BLOCKED or PARTIAL to user.
|
|
193
|
+
|
|
194
|
+
## Cross-Phase Error Propagation
|
|
195
|
+
|
|
196
|
+
When a phase produces a non-SUCCESS status, the orchestrator must propagate error context to downstream phases rather than silently dropping it:
|
|
197
|
+
|
|
198
|
+
1. **Phase 1 PARTIAL** (incomplete research): Include the `researchGaps` list in the implementer prompt so the implementer knows which areas lack verified context. Set implementer confidence expectations accordingly.
|
|
199
|
+
2. **Phase 2 PARTIAL** (incomplete implementation): Include the `reason` field and list of unimplemented acceptance criteria in the reviewer prompt. The reviewer must distinguish between "not done yet" and "done incorrectly."
|
|
200
|
+
3. **Phase 3 UNRESOLVED** (review loop exhausted): Include the unresolved findings list in the Phase 4 specialist prompts. Specialists must not introduce changes that conflict with known unresolved issues.
|
|
201
|
+
4. **Phase 4 specialist FAILED**: Include the failure reason when surfacing to the user. Never report "Phase 4 failed" without specifying which specialist failed and why.
|
|
202
|
+
|
|
203
|
+
## Correlation ID
|
|
204
|
+
|
|
205
|
+
Generate a UUID v4 per top-level task before Phase 1. Include in every subagent prompt as `correlation_id`. All subagents include it in logs, outputs, and status reports. Epic sub-issues get individual IDs; batch tasks share one ID with a sub-task index.
|
|
206
|
+
|
|
207
|
+
## Severity Scale
|
|
208
|
+
|
|
209
|
+
| Severity | Definition | Pipeline Action |
|
|
210
|
+
|----------|-----------|-----------------|
|
|
211
|
+
| **CRITICAL** | Blocks merge. Security vulnerabilities, data loss, broken core functionality. | Must resolve before Phase 3 exit. |
|
|
212
|
+
| **HIGH** | Should fix before merge. Significant bugs, performance regressions. | Fix or escalate to user. |
|
|
213
|
+
| **MEDIUM** | Fix in same sprint. Code quality, minor bugs. | Document with remediation plan. |
|
|
214
|
+
| **LOW** | Track for future. Style nits, minor improvements. | Log only. No merge gate. |
|
|
215
|
+
| **INFO** | Informational. Observations, suggestions. | Awareness only. |
|
|
216
|
+
|
|
217
|
+
All subagents MUST map findings to this scale.
|
|
218
|
+
|
|
219
|
+
## Status Codes
|
|
180
220
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
4. **Await and review results** before proceeding. If a subagent reports BLOCKED or PARTIAL, surface to the user.
|
|
221
|
+
| Status | Meaning |
|
|
222
|
+
|--------|---------|
|
|
223
|
+
| **SUCCESS** | Fully completed, all criteria met. |
|
|
224
|
+
| **PARTIAL** | Partially completed; include `reason` field. |
|
|
225
|
+
| **FAILED** | No usable output; include `reason` field. |
|
|
226
|
+
| **SKIPPED** | Intentionally not executed. |
|
|
227
|
+
| **TIMEOUT** | Time budget exceeded; forward partial output. |
|
|
189
228
|
|
|
190
|
-
##
|
|
229
|
+
## Phase Skip Criteria
|
|
191
230
|
|
|
192
|
-
|
|
231
|
+
Consistent criteria for when each pipeline phase can be safely skipped. All commands that use the pipeline MUST reference these criteria — do not invent command-specific skip rules.
|
|
193
232
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
- **GitLab:** `glab issue view`
|
|
233
|
+
| Phase | Can Skip When | Mandatory Minimum (even when skipped) |
|
|
234
|
+
|-------|--------------|--------------------------------------|
|
|
235
|
+
| **Phase 1 (Research)** | Trivial single-line edit (typo, comment, single-value config); Tier 1 single-file change with no cross-module impact; Research already cached in PipelineContext | Affected files identified (even via quick scan); existing tests noted |
|
|
236
|
+
| **Phase 2 (Implement)** | Never — implementation is always required for code changes | All changes via hatch3r-implementer (never inline except trivial items in quick-change) |
|
|
237
|
+
| **Phase 3 (Review)** | All items trivial (quick-change only); documentation-only change with no code | Quality checks (lint/typecheck/test) must pass; acceptance criteria verified |
|
|
238
|
+
| **Phase 4 (Quality)** | Review loop unresolved AND user chose manual resolution; documentation-only; all trivial + quality checks pass (quick-change only) | test-writer + security-auditor always required for code changes; quality checks must pass |
|
|
201
239
|
|
|
202
|
-
|
|
240
|
+
See `src/pipeline/pipelineContext.ts` for the programmatic `PHASE_SKIP_CRITERIA` constant.
|
|
203
241
|
|
|
204
|
-
##
|
|
242
|
+
## Root-Cause Depth Requirements
|
|
205
243
|
|
|
206
|
-
When
|
|
244
|
+
When a pipeline phase reports a failure or unexpected result, the orchestrator must perform root-cause classification before deciding the next action:
|
|
207
245
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
4
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
- **GitHub:** `gh issue view`
|
|
215
|
-
- **Azure DevOps:** `az boards work-item show --id`
|
|
216
|
-
- **GitLab:** `glab issue view`
|
|
217
|
-
7. **For natural language tasks**: create synthetic issue context (title, acceptance criteria, type) from the instruction. Pass this context to the implementer subagent.
|
|
218
|
-
8. **Run the review loop** (Phase 3) after all implementations complete: spawn reviewer, then fixer for Critical/Warning findings, re-review, repeat until clean (max 3 iterations).
|
|
219
|
-
9. **Spawn final quality subagents** (Phase 4, after review loop is clean): test-writer + security-auditor (always), plus docs-writer, auditors as applicable.
|
|
246
|
+
| Symptom | Shallow Fix (avoid) | Root-Cause Fix (required) |
|
|
247
|
+
|---------|---------------------|---------------------------|
|
|
248
|
+
| Test failure after Phase 2 | Disable or skip the failing test | Identify why the implementation breaks the test -- fix the code or update the test with justification |
|
|
249
|
+
| Lint errors after Phase 4 | Add `eslint-disable` comments | Fix the underlying code pattern that triggers the lint rule |
|
|
250
|
+
| Type errors after fixer changes | Cast with `as any` | Trace the type mismatch to its source and fix the type definition or usage |
|
|
251
|
+
| Review loop not converging | Surface to user after 3 iterations without analysis | Classify whether findings are oscillating (fixer A breaks what fixer B fixed) and surface the conflict pattern |
|
|
220
252
|
|
|
221
|
-
|
|
253
|
+
The orchestrator must reject superficial fixes from any subagent. If a fixer's output contains suppression patterns (disable comments, `any` casts, test skips without linked issues), classify as PARTIAL and re-run with an adjusted prompt that requests a root-cause fix.
|
|
254
|
+
|
|
255
|
+
## Task Context Protocols
|
|
256
|
+
|
|
257
|
+
**Single-task plain chat:** Classify task type, create synthetic issue context, run full pipeline. For issue references, fetch details via platform CLI.
|
|
258
|
+
|
|
259
|
+
**Multi-task plain chat:** Parse into discrete tasks, classify each, build dependency graph, parallelize researchers and implementers per dependency level, run review loop after all implementations, then Phase 4 specialists. When parallel implementers modify the same file: accept disjoint region edits, merge overlapping regions using the larger-scope change as base, and halt on semantic conflicts (contradictory interface/contract changes) for user resolution.
|
|
260
|
+
|
|
261
|
+
**Auto-mode guardrails:** In unattended execution, verify scope containment, no unapproved destructive operations, and output schema compliance after each phase. Halt on violation. See `hatch3r-agent-orchestration-detail` for full guardrail specifications.
|
|
222
262
|
|
|
223
263
|
## Rule Application
|
|
224
264
|
|
|
225
|
-
All
|
|
265
|
+
All `scope: always` rules apply to every task including subagent work. Include rule directives in subagent prompts.
|
|
266
|
+
|
|
267
|
+
### Tiered Rule Inclusion
|
|
268
|
+
|
|
269
|
+
**Tier 1 -- Always include (every subagent):**
|
|
270
|
+
- `hatch3r-security-patterns` -- security invariants
|
|
271
|
+
- `hatch3r-code-standards` -- code quality
|
|
272
|
+
|
|
273
|
+
**Tier 2 -- Include by phase:**
|
|
274
|
+
- `hatch3r-testing` -- test-writer, implementer, reviewer
|
|
275
|
+
- `hatch3r-accessibility-standards` -- a11y-auditor, reviewer (UI)
|
|
276
|
+
- `hatch3r-git-conventions` -- orchestrator git ops
|
|
277
|
+
- `hatch3r-ci-cd` -- ci-watcher, devops
|
|
278
|
+
- `hatch3r-dependency-management` -- dependency-auditor
|
|
279
|
+
|
|
280
|
+
**Tier 3 -- On-demand:**
|
|
281
|
+
- `hatch3r-api-design`, `hatch3r-secrets-management`, `hatch3r-data-classification`, `hatch3r-performance-budgets`, `hatch3r-browser-verification`, `hatch3r-component-conventions`, `hatch3r-i18n`, `hatch3r-theming`, `hatch3r-migrations`, `hatch3r-feature-flags`, `hatch3r-observability-logging`, `hatch3r-observability-metrics`, `hatch3r-observability-tracing`, `hatch3r-observability-tracing-detail`
|
|
282
|
+
|
|
283
|
+
For limited context windows, Tier 1 is mandatory. Tier 2/3 included selectively by agent role and task scope.
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
id: hatch3r-api-design
|
|
3
3
|
type: rule
|
|
4
4
|
description: API endpoint and contract design patterns for the project
|
|
5
|
-
scope:
|
|
5
|
+
scope: "**/api/**,**/routes/**,**/controllers/**,**/endpoints/**,**/*route*,**/*controller*,**/*endpoint*,**/*handler*,**/graphql/**,**/trpc/**"
|
|
6
6
|
tags: [planning]
|
|
7
|
+
quality_charter: agents/shared/quality-charter.md
|
|
7
8
|
---
|
|
8
9
|
# API Design
|
|
9
10
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: API endpoint and contract design patterns for the project
|
|
3
|
-
|
|
3
|
+
globs: ["**/api/**", "**/routes/**", "**/controllers/**", "**/endpoints/**", "**/*route*", "**/*controller*", "**/*endpoint*", "**/*handler*", "**/graphql/**", "**/trpc/**"]
|
|
4
4
|
---
|
|
5
5
|
# API Design
|
|
6
6
|
|
|
@@ -3,7 +3,9 @@ id: hatch3r-browser-verification
|
|
|
3
3
|
type: rule
|
|
4
4
|
description: Browser-based verification for UI and user-facing changes
|
|
5
5
|
scope: conditional
|
|
6
|
+
globs: "**/*.vue,**/*.jsx,**/*.tsx,**/*.svelte,**/components/**,**/*.html,**/*.css,**/*.scss"
|
|
6
7
|
tags: [review]
|
|
8
|
+
quality_charter: agents/shared/quality-charter.md
|
|
7
9
|
---
|
|
8
10
|
# Browser Verification
|
|
9
11
|
|
|
@@ -60,7 +62,7 @@ Commands in the "Does NOT Support" column are documentation-only, planning-only,
|
|
|
60
62
|
|
|
61
63
|
## Verification Protocol
|
|
62
64
|
|
|
63
|
-
### 1.
|
|
65
|
+
### 1. Confirm Dev Server is Running
|
|
64
66
|
|
|
65
67
|
- Check if the project's dev server is already running (check terminal output or process list).
|
|
66
68
|
- If not running, start it in the background using the project's dev command (e.g., `npm run dev`).
|
|
@@ -77,7 +79,7 @@ Commands in the "Does NOT Support" column are documentation-only, planning-only,
|
|
|
77
79
|
|
|
78
80
|
### 3. Capture Evidence
|
|
79
81
|
|
|
80
|
-
- Take screenshots of the affected surfaces showing the change
|
|
82
|
+
- Take screenshots of the affected surfaces showing the change produces the expected visual and interactive result.
|
|
81
83
|
- For before/after changes (visual refactors, bug fixes), capture both states when possible.
|
|
82
84
|
- Note any browser console errors or warnings in the verification summary.
|
|
83
85
|
- Include screenshots in the PR description or attach to the issue.
|
package/rules/hatch3r-ci-cd.md
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
id: hatch3r-ci-cd
|
|
3
3
|
type: rule
|
|
4
4
|
description: CI/CD pipeline standards covering stage gates, deployment strategies, and rollback procedures
|
|
5
|
-
scope:
|
|
5
|
+
scope: "**/.github/workflows/**,**/Dockerfile*,**/docker-compose*,**/.gitlab-ci*,**/Jenkinsfile,**/azure-pipelines*,**/.circleci/**,**/deploy/**,**/*pipeline*"
|
|
6
6
|
tags: [devops]
|
|
7
|
+
quality_charter: agents/shared/quality-charter.md
|
|
7
8
|
---
|
|
8
9
|
# CI/CD Standards
|
|
9
10
|
|
package/rules/hatch3r-ci-cd.mdc
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: CI/CD pipeline standards covering stage gates, deployment strategies, and rollback procedures
|
|
3
|
-
|
|
3
|
+
globs: ["**/.github/workflows/**", "**/Dockerfile*", "**/docker-compose*", "**/.gitlab-ci*", "**/Jenkinsfile", "**/azure-pipelines*", "**/.circleci/**", "**/deploy/**", "**/*pipeline*"]
|
|
4
4
|
---
|
|
5
5
|
# CI/CD Standards
|
|
6
6
|
|
|
@@ -3,7 +3,8 @@ id: hatch3r-code-standards
|
|
|
3
3
|
type: rule
|
|
4
4
|
description: Code quality and file naming conventions for the project
|
|
5
5
|
scope: always
|
|
6
|
-
tags: [core]
|
|
6
|
+
tags: [core, lang:typescript]
|
|
7
|
+
quality_charter: agents/shared/quality-charter.md
|
|
7
8
|
---
|
|
8
9
|
# Code Standards
|
|
9
10
|
|
|
@@ -29,7 +30,7 @@ tags: [core]
|
|
|
29
30
|
### Discriminated Unions
|
|
30
31
|
|
|
31
32
|
- Model domain variants with discriminated unions over polymorphic classes or `type` string checks. Every variant must share a common literal discriminant field (e.g., `kind`, `type`, `status`).
|
|
32
|
-
- Use exhaustive `switch` with a `never` default case
|
|
33
|
+
- Use exhaustive `switch` with a `never` default case so the compiler errors when a new variant is added but not handled.
|
|
33
34
|
|
|
34
35
|
### Branded Types
|
|
35
36
|
|
|
@@ -91,6 +92,18 @@ tags: [core]
|
|
|
91
92
|
- Include `correlationId` in all error logs for tracing across client and server.
|
|
92
93
|
- No secrets, tokens, or PII in error messages or logs.
|
|
93
94
|
|
|
95
|
+
### Error Handling Anti-Patterns (Prohibited)
|
|
96
|
+
|
|
97
|
+
The following patterns are always wrong and must be flagged in review:
|
|
98
|
+
|
|
99
|
+
| Anti-Pattern | Why It Is Wrong | Correct Alternative |
|
|
100
|
+
|-------------|-----------------|---------------------|
|
|
101
|
+
| `catch (e) {}` (empty catch) | Silently swallows errors; failures become invisible | `catch (e) { logger.error('context', e); throw e; }` or handle with Result type |
|
|
102
|
+
| `catch (e) { return null; }` in auth paths | Fail-open: returns "no user" instead of "auth failed" | `catch (e) { throw new AuthError('auth_failed', e); }` |
|
|
103
|
+
| `as any` to fix type errors | Bypasses type safety; hides real type mismatches | Fix the actual type or use a proper type guard |
|
|
104
|
+
| `// @ts-ignore` without linked issue | Permanent type-safety hole | Fix the type error or add `// @ts-expect-error` with issue link |
|
|
105
|
+
| `try { ... } catch { return defaultValue; }` for all errors | Treats transient errors (network) same as permanent ones (validation) | Discriminate error types: retry transient, fail permanent |
|
|
106
|
+
|
|
94
107
|
## Import Ordering
|
|
95
108
|
|
|
96
109
|
Enforce consistent import ordering via linter rules (e.g., `eslint-plugin-import`). The canonical order:
|