hatch3r 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +437 -0
  3. package/agents/hatch3r-a11y-auditor.md +126 -0
  4. package/agents/hatch3r-architect.md +160 -0
  5. package/agents/hatch3r-ci-watcher.md +123 -0
  6. package/agents/hatch3r-context-rules.md +97 -0
  7. package/agents/hatch3r-dependency-auditor.md +164 -0
  8. package/agents/hatch3r-devops.md +138 -0
  9. package/agents/hatch3r-docs-writer.md +97 -0
  10. package/agents/hatch3r-implementer.md +162 -0
  11. package/agents/hatch3r-learnings-loader.md +108 -0
  12. package/agents/hatch3r-lint-fixer.md +104 -0
  13. package/agents/hatch3r-perf-profiler.md +123 -0
  14. package/agents/hatch3r-researcher.md +642 -0
  15. package/agents/hatch3r-reviewer.md +81 -0
  16. package/agents/hatch3r-security-auditor.md +119 -0
  17. package/agents/hatch3r-test-writer.md +134 -0
  18. package/commands/hatch3r-agent-customize.md +146 -0
  19. package/commands/hatch3r-api-spec.md +49 -0
  20. package/commands/hatch3r-benchmark.md +50 -0
  21. package/commands/hatch3r-board-fill.md +504 -0
  22. package/commands/hatch3r-board-init.md +315 -0
  23. package/commands/hatch3r-board-pickup.md +672 -0
  24. package/commands/hatch3r-board-refresh.md +198 -0
  25. package/commands/hatch3r-board-shared.md +369 -0
  26. package/commands/hatch3r-bug-plan.md +410 -0
  27. package/commands/hatch3r-codebase-map.md +1182 -0
  28. package/commands/hatch3r-command-customize.md +94 -0
  29. package/commands/hatch3r-context-health.md +112 -0
  30. package/commands/hatch3r-cost-tracking.md +139 -0
  31. package/commands/hatch3r-dep-audit.md +171 -0
  32. package/commands/hatch3r-feature-plan.md +379 -0
  33. package/commands/hatch3r-healthcheck.md +307 -0
  34. package/commands/hatch3r-hooks.md +282 -0
  35. package/commands/hatch3r-learn.md +217 -0
  36. package/commands/hatch3r-migration-plan.md +51 -0
  37. package/commands/hatch3r-onboard.md +56 -0
  38. package/commands/hatch3r-project-spec.md +1153 -0
  39. package/commands/hatch3r-recipe.md +179 -0
  40. package/commands/hatch3r-refactor-plan.md +426 -0
  41. package/commands/hatch3r-release.md +328 -0
  42. package/commands/hatch3r-roadmap.md +556 -0
  43. package/commands/hatch3r-rule-customize.md +114 -0
  44. package/commands/hatch3r-security-audit.md +370 -0
  45. package/commands/hatch3r-skill-customize.md +93 -0
  46. package/commands/hatch3r-workflow.md +377 -0
  47. package/dist/cli/hooks-ZOTFDEA3.js +59 -0
  48. package/dist/cli/index.d.ts +2 -0
  49. package/dist/cli/index.js +3584 -0
  50. package/github-agents/hatch3r-docs-agent.md +46 -0
  51. package/github-agents/hatch3r-lint-agent.md +41 -0
  52. package/github-agents/hatch3r-security-agent.md +54 -0
  53. package/github-agents/hatch3r-test-agent.md +66 -0
  54. package/hooks/hatch3r-ci-failure.md +10 -0
  55. package/hooks/hatch3r-file-save.md +11 -0
  56. package/hooks/hatch3r-post-merge.md +10 -0
  57. package/hooks/hatch3r-pre-commit.md +11 -0
  58. package/hooks/hatch3r-pre-push.md +10 -0
  59. package/hooks/hatch3r-session-start.md +10 -0
  60. package/mcp/mcp.json +62 -0
  61. package/package.json +84 -0
  62. package/prompts/hatch3r-bug-triage.md +155 -0
  63. package/prompts/hatch3r-code-review.md +131 -0
  64. package/prompts/hatch3r-pr-description.md +173 -0
  65. package/rules/hatch3r-accessibility-standards.md +77 -0
  66. package/rules/hatch3r-accessibility-standards.mdc +75 -0
  67. package/rules/hatch3r-agent-orchestration.md +160 -0
  68. package/rules/hatch3r-api-design.md +176 -0
  69. package/rules/hatch3r-api-design.mdc +176 -0
  70. package/rules/hatch3r-browser-verification.md +73 -0
  71. package/rules/hatch3r-browser-verification.mdc +73 -0
  72. package/rules/hatch3r-ci-cd.md +70 -0
  73. package/rules/hatch3r-ci-cd.mdc +68 -0
  74. package/rules/hatch3r-code-standards.md +102 -0
  75. package/rules/hatch3r-code-standards.mdc +100 -0
  76. package/rules/hatch3r-component-conventions.md +102 -0
  77. package/rules/hatch3r-component-conventions.mdc +102 -0
  78. package/rules/hatch3r-data-classification.md +85 -0
  79. package/rules/hatch3r-data-classification.mdc +83 -0
  80. package/rules/hatch3r-dependency-management.md +17 -0
  81. package/rules/hatch3r-dependency-management.mdc +15 -0
  82. package/rules/hatch3r-error-handling.md +17 -0
  83. package/rules/hatch3r-error-handling.mdc +15 -0
  84. package/rules/hatch3r-feature-flags.md +112 -0
  85. package/rules/hatch3r-feature-flags.mdc +112 -0
  86. package/rules/hatch3r-git-conventions.md +47 -0
  87. package/rules/hatch3r-git-conventions.mdc +45 -0
  88. package/rules/hatch3r-i18n.md +90 -0
  89. package/rules/hatch3r-i18n.mdc +90 -0
  90. package/rules/hatch3r-learning-consult.md +29 -0
  91. package/rules/hatch3r-learning-consult.mdc +27 -0
  92. package/rules/hatch3r-migrations.md +17 -0
  93. package/rules/hatch3r-migrations.mdc +15 -0
  94. package/rules/hatch3r-observability.md +165 -0
  95. package/rules/hatch3r-observability.mdc +165 -0
  96. package/rules/hatch3r-performance-budgets.md +109 -0
  97. package/rules/hatch3r-performance-budgets.mdc +109 -0
  98. package/rules/hatch3r-secrets-management.md +76 -0
  99. package/rules/hatch3r-secrets-management.mdc +74 -0
  100. package/rules/hatch3r-security-patterns.md +211 -0
  101. package/rules/hatch3r-security-patterns.mdc +211 -0
  102. package/rules/hatch3r-testing.md +89 -0
  103. package/rules/hatch3r-testing.mdc +87 -0
  104. package/rules/hatch3r-theming.md +51 -0
  105. package/rules/hatch3r-theming.mdc +51 -0
  106. package/rules/hatch3r-tooling-hierarchy.md +92 -0
  107. package/rules/hatch3r-tooling-hierarchy.mdc +79 -0
  108. package/skills/hatch3r-a11y-audit/SKILL.md +131 -0
  109. package/skills/hatch3r-agent-customize/SKILL.md +75 -0
  110. package/skills/hatch3r-api-spec/SKILL.md +66 -0
  111. package/skills/hatch3r-architecture-review/SKILL.md +96 -0
  112. package/skills/hatch3r-bug-fix/SKILL.md +129 -0
  113. package/skills/hatch3r-ci-pipeline/SKILL.md +76 -0
  114. package/skills/hatch3r-command-customize/SKILL.md +67 -0
  115. package/skills/hatch3r-context-health/SKILL.md +76 -0
  116. package/skills/hatch3r-cost-tracking/SKILL.md +65 -0
  117. package/skills/hatch3r-dep-audit/SKILL.md +82 -0
  118. package/skills/hatch3r-feature/SKILL.md +129 -0
  119. package/skills/hatch3r-gh-agentic-workflows/SKILL.md +150 -0
  120. package/skills/hatch3r-incident-response/SKILL.md +86 -0
  121. package/skills/hatch3r-issue-workflow/SKILL.md +139 -0
  122. package/skills/hatch3r-logical-refactor/SKILL.md +73 -0
  123. package/skills/hatch3r-migration/SKILL.md +76 -0
  124. package/skills/hatch3r-perf-audit/SKILL.md +114 -0
  125. package/skills/hatch3r-pr-creation/SKILL.md +85 -0
  126. package/skills/hatch3r-qa-validation/SKILL.md +86 -0
  127. package/skills/hatch3r-recipe/SKILL.md +67 -0
  128. package/skills/hatch3r-refactor/SKILL.md +86 -0
  129. package/skills/hatch3r-release/SKILL.md +93 -0
  130. package/skills/hatch3r-rule-customize/SKILL.md +70 -0
  131. package/skills/hatch3r-skill-customize/SKILL.md +67 -0
  132. package/skills/hatch3r-visual-refactor/SKILL.md +89 -0
@@ -0,0 +1,377 @@
1
+ ---
2
+ id: hatch3r-workflow
3
+ type: command
4
+ description: Guided development lifecycle with 4 phases (Analyze, Plan, Implement, Review) and scale-adaptive Quick Mode for small tasks.
5
+ ---
6
+ # Development Workflow -- Guided Lifecycle for Structured Implementation
7
+
8
+ Optional guided development lifecycle command that walks through structured phases — Analyze, Plan, Implement, Review — using hatch3r's existing agents and skills. Includes a Quick Mode that collapses phases for small tasks. Scale-adaptive: detects task complexity and recommends the appropriate mode. Works standalone or when invoked from `hatch3r-board-pickup`.
9
+
10
+ ---
11
+
12
+ ## Shared Context
13
+
14
+ **Read the `hatch3r-board-shared` command at the start of the run.** It contains Board Configuration, GitHub Context, Project Reference, Projects v2 sync procedure, and tooling directives. Cache all values for the duration of this run.
15
+
16
+ ## Global Rule Overrides
17
+
18
+ - **Git commands are fully permitted** during Phase 3 (Implement), including `git add`, `git commit`, and `git push`. This override applies to delegated skills and sub-agents invoked during implementation.
19
+
20
+ ## Token-Saving Directives
21
+
22
+ Follow the **Token-Saving Directives** in `hatch3r-board-shared`.
23
+
24
+ ---
25
+
26
+ ## Workflow
27
+
28
+ Execute these steps in order. **Do not skip any step.** Ask the user at every checkpoint marked with ASK.
29
+
30
+ ### Step 0: Mode Selection (Scale-Adaptive)
31
+
32
+ Assess the task to recommend a mode.
33
+
34
+ #### Complexity Signals for Full Mode
35
+
36
+ - Multiple files or modules affected
37
+ - Architectural decisions needed
38
+ - New dependencies or integrations
39
+ - Security-sensitive changes
40
+ - Cross-cutting concerns (database schema, API contracts, event schemas)
41
+ - Estimated effort > 1 day
42
+ - Task is an epic or has sub-issues
43
+
44
+ #### Complexity Signals for Quick Mode
45
+
46
+ - Single file change
47
+ - Bug fix with clear reproduction
48
+ - Small refactor (rename, extract function)
49
+ - Documentation update
50
+ - Test addition for existing code
51
+ - Estimated effort < 2 hours
52
+
53
+ #### Assessment
54
+
55
+ Evaluate the task against both signal sets. Count matching signals to determine recommendation.
56
+
57
+ **ASK:** "Task: {user's task description}. Complexity assessment: {assessment}. Recommended mode: {Full/Quick}. Proceed with {recommended}? (yes / switch to {other} / let me decide per phase)"
58
+
59
+ ---
60
+
61
+ ## Full Mode
62
+
63
+ ### Phase 1: Analyze
64
+
65
+ **Goal:** Fully understand the task, its context, and constraints before writing any code.
66
+
67
+ #### 1a. Parse the Task
68
+
69
+ - **GitHub issue:** Read issue body, acceptance criteria, labels, parent epic context using `gh issue view` (fall back to `issue_read` MCP).
70
+ - **User description:** Extract requirements, scope, constraints from the provided description.
71
+ - **Board-pickup invocation:** Use the issue context already gathered by board-pickup. Skip re-fetching.
72
+
73
+ #### 1b. Load Relevant Context
74
+
75
+ 1. Read project specs from `docs/specs/` — headers first (~30 lines), expand relevant sections only.
76
+ 2. Read ADRs that might constrain the approach.
77
+ 3. Scan existing code in the affected area using targeted file reads and searches.
78
+ 4. Use **Context7 MCP** (`resolve-library-id` then `query-docs`) for external library documentation referenced by the task.
79
+ 5. Use **web research** for current best practices, security advisories, or novel problems not covered by local docs or Context7.
80
+
81
+ #### 1c. Consult Learnings
82
+
83
+ If `/.agents/learnings/` exists:
84
+
85
+ 1. Search for learnings tagged with relevant areas or technologies.
86
+ 2. Surface any applicable past experiences that inform this task.
87
+
88
+ #### 1d. Present Analysis
89
+
90
+ ```
91
+ Task Analysis:
92
+ Scope: {what's in / what's out}
93
+ Affected files: {list}
94
+ Constraints: {from specs, ADRs}
95
+ Relevant learnings: {if any}
96
+ Open questions: {if any}
97
+ Risk: {low/med/high}
98
+ ```
99
+
100
+ **ASK:** "Analysis complete. Questions: {list}. Proceed to Plan phase? (yes / clarify questions first / adjust scope)"
101
+
102
+ ---
103
+
104
+ ### Phase 2: Plan
105
+
106
+ **Goal:** Design the solution before implementing.
107
+
108
+ #### 2a. Draft Implementation Plan
109
+
110
+ 1. List all files to create or modify.
111
+ 2. For each file: describe the specific changes.
112
+ 3. Identify test requirements (unit, integration, e2e).
113
+ 4. Note any dependency changes needed.
114
+ 5. Consider rollback strategy for risky changes.
115
+
116
+ #### 2b. Select hatch3r Agents and Skills
117
+
118
+ Map the task type to the appropriate skill:
119
+
120
+ | Task Type | Skill |
121
+ | ---------------- | ------------------------------ |
122
+ | Bug report | hatch3r-bug-fix |
123
+ | Feature request | hatch3r-feature-implementation |
124
+ | Code refactor | hatch3r-code-refactor |
125
+ | Logical refactor | hatch3r-logical-refactor |
126
+ | Visual refactor | hatch3r-visual-refactor |
127
+ | QA validation | hatch3r-qa-validation |
128
+
129
+ Identify supporting agents needed: test-writer, docs-writer, reviewer, security-auditor.
130
+
131
+ #### 2c. Identify Risks
132
+
133
+ - Breaking changes? Migration needed?
134
+ - Performance implications?
135
+ - Security implications?
136
+
137
+ #### 2d. Present Plan
138
+
139
+ ```
140
+ Implementation Plan:
141
+ Approach: {description}
142
+ Skill: {selected hatch3r skill}
143
+ Files to modify: {list with change descriptions}
144
+ New files: {list}
145
+ Tests: {what to test}
146
+ Risks: {list with mitigations}
147
+ Estimated effort: {time}
148
+ ```
149
+
150
+ **ASK:** "Plan ready. Proceed to Implement? (yes / revise plan / request review of plan first)"
151
+
152
+ ---
153
+
154
+ ### Phase 3: Implement
155
+
156
+ **Goal:** Execute the plan using the selected hatch3r skill, delegating to sub-agents per the Universal Sub-Agent Pipeline.
157
+
158
+ #### 3a. Context Gathering (Researcher Sub-Agent)
159
+
160
+ You MUST spawn a `hatch3r-researcher` sub-agent via the Task tool (`subagent_type: "generalPurpose"`) before implementation. Skip only for trivial single-line edits (typos, comment fixes, single-value config changes).
161
+
162
+ - Select research modes by task type (bug → symptom-trace/root-cause/codebase-impact, feature → codebase-impact/feature-design/architecture, refactor → current-state/refactoring-strategy/migration-path, QA → codebase-impact).
163
+ - Use depth `quick` for low-risk, `standard` for medium-risk, `deep` for high-risk.
164
+ - Await the researcher result. Use its structured output to inform Step 3b.
165
+
166
+ #### 3b. Core Implementation (Implementer Sub-Agent)
167
+
168
+ You MUST spawn a `hatch3r-implementer` sub-agent via the Task tool (`subagent_type: "generalPurpose"`). Do NOT implement inline — always delegate to a dedicated implementer.
169
+
170
+ 1. Read the matching hatch3r skill file and include it in the implementer prompt.
171
+ 2. Do NOT execute the skill's PR creation steps if invoked from `hatch3r-board-pickup` (board-pickup handles PR creation in its own Steps 7a–8).
172
+ 3. For tasks spanning multiple independent parts, spawn one `hatch3r-implementer` per independent module. Launch as many in parallel as the platform supports.
173
+ 4. Coordinate changes across files to avoid conflicts.
174
+
175
+ The implementer sub-agent prompt MUST include:
176
+ - The task description, acceptance criteria, and type.
177
+ - The researcher output from Step 3a (if not skipped).
178
+ - The selected hatch3r skill name and instructions.
179
+ - All `scope: always` rule directives from `/.agents/rules/`.
180
+ - Relevant learnings from `/.agents/learnings/`.
181
+ - Explicit instruction: do NOT create branches, commits, or PRs.
182
+
183
+ Await the implementer sub-agent. Collect its structured result.
184
+
185
+ #### 3c. Track Progress
186
+
187
+ 1. Mark completed items from the plan.
188
+ 2. Note any deviations from the plan and the reasoning.
189
+
190
+ #### 3d. Run Quality Checks
191
+
192
+ Run the project's quality checks (adapt to project conventions):
193
+
194
+ ```bash
195
+ npm run lint && npm run typecheck && npm run test
196
+ ```
197
+
198
+ Fix any issues before proceeding. If quality checks fail, loop back and resolve before advancing to Phase 4.
199
+
200
+ **ASK:** "Implementation complete. All quality checks pass. Proceed to Review? (yes / fix issues first)"
201
+
202
+ ---
203
+
204
+ ### Phase 4: Review (Sub-Agent Quality Pipeline)
205
+
206
+ **Goal:** Verify quality and completeness via specialist sub-agents before finalizing.
207
+
208
+ #### 4a. Spawn Quality Sub-Agents
209
+
210
+ You MUST spawn specialist sub-agents for quality assurance. Use the Task tool with `subagent_type: "generalPurpose"`. Launch as many independent sub-agents in parallel as the platform supports.
211
+
212
+ **Always spawn (mandatory for every code change):**
213
+
214
+ 1. **`hatch3r-reviewer`** — code review of all changes. Include the diff and acceptance criteria in the prompt.
215
+ 2. **`hatch3r-test-writer`** — tests for all code changes. Unit tests for new logic, regression tests for bug fixes, integration tests for cross-module changes.
216
+ 3. **`hatch3r-security-auditor`** — security review of all code changes. Audit data flows, access control, input validation, and secret management.
217
+
218
+ **Always evaluate (spawn when applicable):**
219
+
220
+ 4. **`hatch3r-docs-writer`** — spawn when changes affect public APIs, architectural patterns, user-facing behavior, or when specs/ADRs need updating. Skip silently if no documentation impact.
221
+
222
+ **Conditional specialists (spawn when triggered):**
223
+
224
+ 5. **`hatch3r-lint-fixer`** — when lint or type errors are present after implementation.
225
+ 6. **`hatch3r-a11y-auditor`** — when UI or accessibility changes are made.
226
+ 7. **`hatch3r-perf-profiler`** — when performance-sensitive changes are made.
227
+
228
+ Each specialist sub-agent prompt MUST include:
229
+ - The agent protocol to follow.
230
+ - All `scope: always` rule directives from `/.agents/rules/`.
231
+ - The diff or file changes to review.
232
+ - The task's acceptance criteria.
233
+
234
+ Await all specialist sub-agents. Apply their feedback (fixes, additional tests, documentation updates).
235
+
236
+ #### 4b. Verify Against Acceptance Criteria
237
+
238
+ Check each acceptance criterion from the original task or issue. Mark as met or not-met with evidence.
239
+
240
+ #### 4c. Present Review
241
+
242
+ ```
243
+ Review Results:
244
+ Acceptance Criteria: {N/M met}
245
+ Code Quality: {reviewer findings}
246
+ Security: {security-auditor findings}
247
+ Test Coverage: {test-writer results}
248
+ Documentation: {docs-writer results / not applicable}
249
+ Performance: {pass/issues}
250
+ ```
251
+
252
+ **ASK:** "Review complete. {summary}. Ready to finalize? (yes / address review issues / request human review)"
253
+
254
+ #### 4d. Capture Learnings
255
+
256
+ If `/.agents/learnings/` exists:
257
+
258
+ 1. Extract learnings from this implementation session (patterns discovered, pitfalls encountered, decisions made).
259
+ 2. Store in `/.agents/learnings/` with appropriate area tags.
260
+
261
+ ---
262
+
263
+ ## Quick Mode
264
+
265
+ Collapses the 4 phases into a streamlined flow for small, well-defined tasks. Sub-agent delegation is still mandatory — Quick Mode uses lighter prompts, not fewer sub-agents.
266
+
267
+ ### Quick Step 1: Rapid Analysis + Plan (Combined)
268
+
269
+ 1. Spawn `hatch3r-researcher` with depth `quick` for brief context gathering. Skip only for trivial single-line edits.
270
+ 2. Quick plan: list changes, identify the appropriate hatch3r skill.
271
+ 3. Skip ADR/spec review unless the task touches architecture.
272
+
273
+ **ASK:** "Quick analysis: {scope}, {approach}. Proceed? (yes / switch to Full Mode)"
274
+
275
+ ### Quick Step 2: Implement
276
+
277
+ 1. Spawn `hatch3r-implementer` sub-agent via the Task tool. Do NOT implement inline.
278
+ 2. Run quality checks (lint, typecheck, test).
279
+ 3. Fix any issues before proceeding.
280
+
281
+ ### Quick Step 3: Quick Review (Sub-Agent Quality Pipeline)
282
+
283
+ Spawn specialist sub-agents in parallel — same mandatory pipeline as Full Mode:
284
+
285
+ 1. **`hatch3r-reviewer`** — ALWAYS. Use a focused prompt covering correctness and quality.
286
+ 2. **`hatch3r-test-writer`** — ALWAYS for code changes.
287
+ 3. **`hatch3r-security-auditor`** — ALWAYS for code changes.
288
+ 4. **`hatch3r-docs-writer`** — evaluate; spawn when documentation impact exists.
289
+ 5. Verify acceptance criteria are met.
290
+ 6. Confirm lint/typecheck/test pass.
291
+
292
+ **ASK:** "Changes complete. Quality checks pass. Finalize? (yes / deeper review needed → switch to Full Mode Phase 4)"
293
+
294
+ ---
295
+
296
+ ## Integration with Board Workflow
297
+
298
+ ### Invoked from `hatch3r-board-pickup`
299
+
300
+ - Phase 1 uses the issue context already gathered by board-pickup — skip re-fetching.
301
+ - Phase 3 skips PR creation — board-pickup handles it in its own Steps 7a–8.
302
+ - Phase 4 results feed into board-pickup's quality verification (Step 7).
303
+
304
+ ### Invoked Standalone
305
+
306
+ - All phases run independently with full context loading.
307
+ - User decides whether to create a PR at the end of Phase 4.
308
+
309
+ ---
310
+
311
+ ## Auto-Advance Mode
312
+
313
+ When invoked with `--auto` or `--unattended`, the workflow operates with reduced human checkpoints for sustained autonomous operation. Compatible with both Full Mode and Quick Mode.
314
+
315
+ ### Behavior Changes in Auto Mode
316
+
317
+ | Checkpoint | Normal Mode | Auto Mode |
318
+ |-----------|-------------|-----------|
319
+ | Mode selection (Step 0) | ASK user to confirm | Auto-select based on complexity signals |
320
+ | Analysis review (Phase 1) | ASK user to proceed | Auto-proceed if no open questions |
321
+ | Plan review (Phase 2) | ASK user to approve | Auto-proceed with plan |
322
+ | Implementation review (Phase 3) | ASK user before Review | Auto-proceed if quality checks pass |
323
+ | Review finalization (Phase 4) | ASK user to finalize | Auto-finalize if all AC met |
324
+
325
+ ### Safety Guardrails (Always Active)
326
+
327
+ These checkpoints are NEVER skipped, even in auto mode:
328
+ - **Destructive operations**: Database migrations, file deletions, security rule changes always require confirmation
329
+ - **Breaking changes**: API contract changes, public interface modifications always require confirmation
330
+ - **Open questions**: If Phase 1 analysis surfaces unresolvable ambiguity, stop and ASK regardless of mode
331
+ - **Quality gate failures**: If lint/typecheck/test fail after 2 fix attempts, stop and ASK
332
+ - **Cost thresholds**: Stop if estimated token cost exceeds configured limit (default: $10 per task)
333
+
334
+ ### Activation
335
+
336
+ ```
337
+ /hatch3r workflow --auto
338
+ /hatch3r workflow --auto --mode=full
339
+ /hatch3r workflow --auto --mode=quick
340
+ ```
341
+
342
+ ### Auto Mode with Board Pickup
343
+
344
+ When invoked from `hatch3r board-pickup --auto`, the workflow inherits the auto flag. All non-safety ASK checkpoints are automatically resolved. The workflow reports its structured result back to board-pickup for PR creation.
345
+
346
+ ### Session Report
347
+
348
+ At the end of an auto workflow session, generate a summary:
349
+ - Mode used: {Full/Quick}
350
+ - Phases completed: {list}
351
+ - Quality checks: {pass/fail with details}
352
+ - Acceptance criteria: {N/M met}
353
+ - Learnings captured: {count}
354
+ - Time in auto mode: {duration}
355
+
356
+ ---
357
+
358
+ ## Error Handling
359
+
360
+ - **Quality check failure in Phase 3:** Loop back and fix before proceeding to Phase 4. Do not advance with failing checks.
361
+ - **Acceptance criteria not met in Phase 4:** Loop back to Phase 3 with specific items to address.
362
+ - **Sub-agent failure:** Retry once, then fall back to direct implementation.
363
+ - **Context degradation (>25 turns):** Suggest starting a fresh chat with a progress summary capturing completed work and remaining items.
364
+ - **Mode switch:** User can switch from Quick to Full (or vice versa) at any ASK checkpoint. State carries forward — no work is lost.
365
+
366
+ ## Guardrails
367
+
368
+ - **Never skip ASK checkpoints.**
369
+ - **Never skip Phase 4 (Review) in Full Mode** — even if implementation seems complete.
370
+ - **Quick Mode is opt-in** — user must confirm the mode selection in Step 0.
371
+ - **Always run quality checks** before declaring implementation complete.
372
+ - **Stay within the task scope** — note related work but do not implement it.
373
+ - **Recommend Full Mode** if the task grows beyond Quick Mode complexity during execution.
374
+ - **All phases produce structured output** that can feed into other hatch3r commands.
375
+ - **Respect the project's tooling hierarchy** for knowledge augmentation (Context7 MCP for library docs, web research for current events).
376
+ - **Never force a mode** — user always has final say at every ASK checkpoint.
377
+ - **This command composes existing hatch3r agents and skills** — it does not replace them.
@@ -0,0 +1,59 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/hooks/index.ts
4
+ import { readdir, readFile } from "fs/promises";
5
+ import { join } from "path";
6
+ import { parse as parseYaml } from "yaml";
7
+ async function readHookDefinitions(agentsDir) {
8
+ const hooksDir = join(agentsDir, "hooks");
9
+ let entries;
10
+ try {
11
+ const dirEntries = await readdir(hooksDir);
12
+ entries = dirEntries.filter((f) => f.endsWith(".md"));
13
+ } catch {
14
+ return [];
15
+ }
16
+ const hooks = [];
17
+ for (const entry of entries) {
18
+ const content = await readFile(join(hooksDir, entry), "utf-8");
19
+ const hook = parseHookFrontmatter(content);
20
+ if (hook) {
21
+ hooks.push(hook);
22
+ }
23
+ }
24
+ return hooks;
25
+ }
26
+ function parseHookFrontmatter(content) {
27
+ const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
28
+ if (!match) return null;
29
+ const parsed = parseYaml(match[1]);
30
+ if (!parsed || typeof parsed !== "object") return null;
31
+ if (!parsed.id || !parsed.event || !parsed.agent) return null;
32
+ const hook = {
33
+ id: String(parsed.id),
34
+ event: String(parsed.event),
35
+ agent: String(parsed.agent),
36
+ description: parsed.description ? String(parsed.description) : ""
37
+ };
38
+ const condition = {};
39
+ let hasCondition = false;
40
+ if (parsed.globs) {
41
+ condition.globs = String(parsed.globs).split(",").map((g) => g.trim());
42
+ hasCondition = true;
43
+ }
44
+ if (parsed.labels) {
45
+ condition.labels = String(parsed.labels).split(",").map((l) => l.trim());
46
+ hasCondition = true;
47
+ }
48
+ if (parsed.branches) {
49
+ condition.branches = String(parsed.branches).split(",").map((b) => b.trim());
50
+ hasCondition = true;
51
+ }
52
+ if (hasCondition) {
53
+ hook.condition = condition;
54
+ }
55
+ return hook;
56
+ }
57
+ export {
58
+ readHookDefinitions
59
+ };
@@ -0,0 +1,2 @@
1
+
2
+ export { }