hatch3r 1.0.0 → 1.2.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 (144) hide show
  1. package/README.md +93 -322
  2. package/agents/hatch3r-a11y-auditor.md +24 -6
  3. package/agents/hatch3r-architect.md +20 -1
  4. package/agents/hatch3r-ci-watcher.md +31 -8
  5. package/agents/hatch3r-context-rules.md +14 -2
  6. package/agents/hatch3r-dependency-auditor.md +21 -5
  7. package/agents/hatch3r-devops.md +37 -6
  8. package/agents/hatch3r-docs-writer.md +19 -3
  9. package/agents/hatch3r-fixer.md +171 -0
  10. package/agents/hatch3r-implementer.md +84 -11
  11. package/agents/hatch3r-learnings-loader.md +69 -13
  12. package/agents/hatch3r-lint-fixer.md +19 -14
  13. package/agents/hatch3r-perf-profiler.md +18 -1
  14. package/agents/hatch3r-researcher.md +440 -5
  15. package/agents/hatch3r-reviewer.md +97 -5
  16. package/agents/hatch3r-security-auditor.md +23 -5
  17. package/agents/hatch3r-test-writer.md +21 -10
  18. package/checks/README.md +49 -0
  19. package/checks/code-quality.md +49 -0
  20. package/checks/performance.md +58 -0
  21. package/checks/security.md +58 -0
  22. package/checks/testing.md +53 -0
  23. package/commands/board/pickup-azure-devops.md +81 -0
  24. package/commands/board/pickup-delegation-multi.md +197 -0
  25. package/commands/board/pickup-delegation.md +100 -0
  26. package/commands/board/pickup-github.md +82 -0
  27. package/commands/board/pickup-gitlab.md +81 -0
  28. package/commands/board/pickup-modes.md +143 -0
  29. package/commands/board/pickup-post-impl.md +120 -0
  30. package/commands/board/shared-azure-devops.md +149 -0
  31. package/commands/board/shared-board-overview.md +215 -0
  32. package/commands/board/shared-github.md +169 -0
  33. package/commands/board/shared-gitlab.md +142 -0
  34. package/commands/hatch3r-agent-customize.md +40 -2
  35. package/commands/hatch3r-api-spec.md +294 -32
  36. package/commands/hatch3r-benchmark.md +386 -32
  37. package/commands/hatch3r-board-fill.md +161 -25
  38. package/commands/hatch3r-board-groom.md +595 -0
  39. package/commands/hatch3r-board-init.md +203 -46
  40. package/commands/hatch3r-board-pickup.md +79 -457
  41. package/commands/hatch3r-board-refresh.md +98 -27
  42. package/commands/hatch3r-board-shared.md +87 -238
  43. package/commands/hatch3r-bug-plan.md +16 -3
  44. package/commands/hatch3r-codebase-map.md +43 -10
  45. package/commands/hatch3r-command-customize.md +6 -0
  46. package/commands/hatch3r-context-health.md +5 -0
  47. package/commands/hatch3r-cost-tracking.md +5 -0
  48. package/commands/hatch3r-debug.md +426 -0
  49. package/commands/hatch3r-dep-audit.md +7 -1
  50. package/commands/hatch3r-feature-plan.md +74 -12
  51. package/commands/hatch3r-healthcheck.md +17 -1
  52. package/commands/hatch3r-hooks.md +16 -10
  53. package/commands/hatch3r-learn.md +15 -9
  54. package/commands/hatch3r-migration-plan.md +333 -33
  55. package/commands/hatch3r-onboard.md +327 -38
  56. package/commands/hatch3r-project-spec.md +46 -10
  57. package/commands/hatch3r-quick-change.md +336 -0
  58. package/commands/hatch3r-recipe.md +6 -0
  59. package/commands/hatch3r-refactor-plan.md +29 -13
  60. package/commands/hatch3r-release.md +13 -3
  61. package/commands/hatch3r-revision.md +395 -0
  62. package/commands/hatch3r-roadmap.md +18 -3
  63. package/commands/hatch3r-rule-customize.md +6 -0
  64. package/commands/hatch3r-security-audit.md +17 -1
  65. package/commands/hatch3r-skill-customize.md +6 -0
  66. package/commands/hatch3r-test-plan.md +532 -0
  67. package/commands/hatch3r-workflow.md +113 -38
  68. package/dist/cli/index.js +5184 -2593
  69. package/dist/cli/index.js.map +1 -0
  70. package/github-agents/hatch3r-docs-agent.md +1 -0
  71. package/github-agents/hatch3r-lint-agent.md +1 -0
  72. package/github-agents/hatch3r-security-agent.md +1 -0
  73. package/github-agents/hatch3r-test-agent.md +1 -0
  74. package/hooks/hatch3r-ci-failure.md +30 -0
  75. package/hooks/hatch3r-file-save.md +22 -0
  76. package/hooks/hatch3r-post-merge.md +23 -0
  77. package/hooks/hatch3r-pre-commit.md +23 -0
  78. package/hooks/hatch3r-pre-push.md +22 -0
  79. package/hooks/hatch3r-session-start.md +22 -0
  80. package/mcp/mcp.json +22 -3
  81. package/package.json +4 -7
  82. package/prompts/hatch3r-bug-triage.md +1 -0
  83. package/prompts/hatch3r-code-review.md +1 -0
  84. package/prompts/hatch3r-pr-description.md +1 -0
  85. package/rules/hatch3r-accessibility-standards.md +1 -0
  86. package/rules/hatch3r-agent-orchestration.md +326 -53
  87. package/rules/hatch3r-agent-orchestration.mdc +225 -0
  88. package/rules/hatch3r-api-design.md +4 -1
  89. package/rules/hatch3r-browser-verification.md +33 -1
  90. package/rules/hatch3r-browser-verification.mdc +29 -0
  91. package/rules/hatch3r-ci-cd.md +5 -1
  92. package/rules/hatch3r-ci-cd.mdc +4 -1
  93. package/rules/hatch3r-code-standards.md +18 -0
  94. package/rules/hatch3r-code-standards.mdc +10 -1
  95. package/rules/hatch3r-component-conventions.md +4 -1
  96. package/rules/hatch3r-data-classification.md +1 -0
  97. package/rules/hatch3r-deep-context.md +94 -0
  98. package/rules/hatch3r-deep-context.mdc +69 -0
  99. package/rules/hatch3r-dependency-management.md +13 -0
  100. package/rules/hatch3r-feature-flags.md +4 -1
  101. package/rules/hatch3r-git-conventions.md +1 -0
  102. package/rules/hatch3r-i18n.md +4 -1
  103. package/rules/hatch3r-learning-consult.md +4 -2
  104. package/rules/hatch3r-learning-consult.mdc +3 -2
  105. package/rules/hatch3r-migrations.md +12 -0
  106. package/rules/hatch3r-observability.md +293 -1
  107. package/rules/hatch3r-performance-budgets.md +5 -2
  108. package/rules/hatch3r-performance-budgets.mdc +1 -1
  109. package/rules/hatch3r-secrets-management.md +11 -3
  110. package/rules/hatch3r-secrets-management.mdc +10 -3
  111. package/rules/hatch3r-security-patterns.md +23 -3
  112. package/rules/hatch3r-security-patterns.mdc +8 -2
  113. package/rules/hatch3r-testing.md +1 -0
  114. package/rules/hatch3r-theming.md +4 -1
  115. package/rules/hatch3r-tooling-hierarchy.md +42 -15
  116. package/rules/hatch3r-tooling-hierarchy.mdc +27 -4
  117. package/skills/hatch3r-a11y-audit/SKILL.md +1 -0
  118. package/skills/hatch3r-agent-customize/SKILL.md +3 -0
  119. package/skills/hatch3r-api-spec/SKILL.md +1 -0
  120. package/skills/hatch3r-architecture-review/SKILL.md +6 -2
  121. package/skills/hatch3r-bug-fix/SKILL.md +4 -1
  122. package/skills/hatch3r-ci-pipeline/SKILL.md +1 -0
  123. package/skills/hatch3r-command-customize/SKILL.md +1 -0
  124. package/skills/hatch3r-context-health/SKILL.md +2 -1
  125. package/skills/hatch3r-cost-tracking/SKILL.md +1 -0
  126. package/skills/hatch3r-dep-audit/SKILL.md +6 -2
  127. package/skills/hatch3r-feature/SKILL.md +9 -2
  128. package/skills/hatch3r-gh-agentic-workflows/SKILL.md +130 -21
  129. package/skills/hatch3r-incident-response/SKILL.md +11 -5
  130. package/skills/hatch3r-issue-workflow/SKILL.md +12 -7
  131. package/skills/hatch3r-logical-refactor/SKILL.md +1 -0
  132. package/skills/hatch3r-migration/SKILL.md +1 -0
  133. package/skills/hatch3r-perf-audit/SKILL.md +2 -1
  134. package/skills/hatch3r-pr-creation/SKILL.md +20 -10
  135. package/skills/hatch3r-qa-validation/SKILL.md +2 -1
  136. package/skills/hatch3r-recipe/SKILL.md +1 -0
  137. package/skills/hatch3r-refactor/SKILL.md +7 -1
  138. package/skills/hatch3r-release/SKILL.md +15 -11
  139. package/skills/hatch3r-rule-customize/SKILL.md +1 -0
  140. package/skills/hatch3r-skill-customize/SKILL.md +1 -0
  141. package/skills/hatch3r-visual-refactor/SKILL.md +1 -0
  142. package/dist/cli/hooks-ZOTFDEA3.js +0 -59
  143. package/rules/hatch3r-error-handling.md +0 -17
  144. package/rules/hatch3r-error-handling.mdc +0 -15
@@ -2,7 +2,13 @@
2
2
  id: hatch3r-hooks
3
3
  type: command
4
4
  description: Define and manage event-driven hooks that activate agents on project events
5
+ tags: [core, devops]
5
6
  ---
7
+
8
+ ## Agent Pipeline
9
+
10
+ This command runs as a single orchestrator without sub-agent delegation. Hook definition and management are performed inline.
11
+
6
12
  # Hooks — Event-Driven Agent Activation
7
13
 
8
14
  Define, edit, and manage event-driven hooks that automatically activate hatch3r agents when specific project events occur. Hook definitions are tool-agnostic — the adapter pipeline translates them into tool-native configurations during `npx hatch3r sync`.
@@ -15,8 +21,8 @@ Execute these steps in order. **Do not skip any step.** Ask the user at every ch
15
21
 
16
22
  ### Step 1: Discover Current State
17
23
 
18
- 1. Check `/.agents/hooks/` for existing hook definition files (`.md` files with frontmatter).
19
- 2. Read `/.agents/hatch.json` for configured tools and features.
24
+ 1. Check `.agents/hooks/` for existing hook definition files (`.md` files with frontmatter).
25
+ 2. Read `.agents/hatch.json` for configured tools and features.
20
26
  3. List existing hooks with their event, agent, and conditions.
21
27
 
22
28
  Present the current state:
@@ -76,7 +82,7 @@ Present available hatch3r agents:
76
82
  - `dependency-auditor` — Dependency security and update checks
77
83
  - `docs-writer` — Documentation generation and updates
78
84
 
79
- If the user wants a custom agent name not in this list, accept it but warn that the agent must exist in `/.agents/agents/`.
85
+ If the user wants a custom agent name not in this list, accept it but warn that the agent must exist in `.agents/agents/`.
80
86
 
81
87
  **ASK:** "Select an agent to activate when this event fires."
82
88
 
@@ -89,7 +95,7 @@ If the user wants a custom agent name not in this list, accept it but warn that
89
95
 
90
96
  #### 2d. Write Hook Definition File
91
97
 
92
- Generate the hook definition file at `/.agents/hooks/{event}-{agent-short-name}.md`:
98
+ Generate the hook definition file at `.agents/hooks/{event}-{agent-short-name}.md`:
93
99
 
94
100
  ```markdown
95
101
  ---
@@ -131,7 +137,7 @@ For editing an existing hook:
131
137
  1. List all hooks and ask which to edit.
132
138
  2. Show current definition.
133
139
  3. Ask what to change (event, agent, conditions, description).
134
- 4. Update the hook file in `/.agents/hooks/`.
140
+ 4. Update the hook file in `.agents/hooks/`.
135
141
 
136
142
  **ASK:** "Updated hook: {summary}. Save? (yes / revert / cancel)"
137
143
 
@@ -142,7 +148,7 @@ For editing an existing hook:
142
148
  1. List all hooks and ask which to remove.
143
149
  2. Show the hook definition.
144
150
 
145
- **ASK:** "Remove hook '{id}'? This will delete `/.agents/hooks/{filename}`. (yes / cancel)"
151
+ **ASK:** "Remove hook '{id}'? This will delete `.agents/hooks/{filename}`. (yes / cancel)"
146
152
 
147
153
  3. Delete the file. Warn that tool-specific generated files (e.g., `.cursor/rules/hatch3r-hook-*.mdc`) will be cleaned up on the next `npx hatch3r sync`.
148
154
 
@@ -150,7 +156,7 @@ For editing an existing hook:
150
156
 
151
157
  ### Step 5: Sync Hooks to Tools
152
158
 
153
- 1. Read all hook definitions from `/.agents/hooks/`.
159
+ 1. Read all hook definitions from `.agents/hooks/`.
154
160
  2. For each configured tool in `hatch.json`, describe what will be generated:
155
161
  - **Claude Code:** Hook documentation appended to managed section of `CLAUDE.md`
156
162
  - **Cursor:** Glob-based `.mdc` rule files in `.cursor/rules/hatch3r-hook-*.mdc`
@@ -190,7 +196,7 @@ In `hatch.json`:
190
196
  }
191
197
  ```
192
198
 
193
- Custom events follow the same hook definition format as built-in events — create a hook file in `/.agents/hooks/` with `event: custom:{domain}:{action}`.
199
+ Custom events follow the same hook definition format as built-in events — create a hook file in `.agents/hooks/` with `event: custom:{domain}:{action}`.
194
200
 
195
201
  ---
196
202
 
@@ -265,9 +271,9 @@ For `pre-commit` with three hooks:
265
271
 
266
272
  ## Error Handling
267
273
 
268
- - `/.agents/hooks/` doesn't exist: create it automatically.
274
+ - `.agents/hooks/` doesn't exist: create it automatically.
269
275
  - Invalid event type: warn and show the valid events table.
270
- - Agent not found in `/.agents/agents/`: warn but allow (agent may be added later).
276
+ - Agent not found in `.agents/agents/`: warn but allow (agent may be added later).
271
277
  - Adapter doesn't support hooks: generate hook definition file anyway, warn that sync for that tool is a no-op.
272
278
  - Duplicate hook ID: warn and ask the user to choose a different name or overwrite.
273
279
 
@@ -2,7 +2,13 @@
2
2
  id: hatch3r-learn
3
3
  type: command
4
4
  description: Capture learnings from development sessions into reusable knowledge files for future consultation.
5
+ tags: [core, maintenance]
5
6
  ---
7
+
8
+ ## Agent Pipeline
9
+
10
+ This command runs as a single orchestrator without sub-agent delegation. Learning extraction and file management are performed inline.
11
+
6
12
  # Learning Capture -- Extract and Store Development Insights
7
13
 
8
14
  Capture learnings from completed development sessions. Can be invoked manually after finishing work, automatically by board-pickup after PR merge, or with a specific issue number for targeted reflection.
@@ -41,9 +47,9 @@ Execute these steps in order. **Do not skip any step.** Ask the user at every ch
41
47
 
42
48
  ### Step 3: Write Learning Files
43
49
 
44
- For each confirmed learning, create a file in `/.agents/learnings/`.
50
+ For each confirmed learning, create a file in `.agents/learnings/`.
45
51
 
46
- If `/.agents/learnings/` does not exist, create it.
52
+ If `.agents/learnings/` does not exist, create it.
47
53
 
48
54
  **Filename:** `{YYYY-MM-DD}_{short-slug}.md`
49
55
 
@@ -89,8 +95,8 @@ Present all saved learnings with file paths.
89
95
 
90
96
  ```
91
97
  Learnings Captured:
92
- /.agents/learnings/{filename1}.md -- {category}: {one-line summary}
93
- /.agents/learnings/{filename2}.md -- {category}: {one-line summary}
98
+ .agents/learnings/{filename1}.md -- {category}: {one-line summary}
99
+ .agents/learnings/{filename2}.md -- {category}: {one-line summary}
94
100
  ```
95
101
 
96
102
  Remind user that these will be auto-consulted during future board-pickup and board-fill runs.
@@ -129,7 +135,7 @@ superseded_by: {learning-id} # reference when deprecated
129
135
 
130
136
  ### Archival
131
137
 
132
- Archived learnings are moved to `/.agents/learnings/archived/` with their original filename. An archival notice is prepended:
138
+ Archived learnings are moved to `.agents/learnings/archived/` with their original filename. An archival notice is prepended:
133
139
 
134
140
  ```markdown
135
141
  > **Archived on {date}**: {reason — expired | deprecated | superseded by {id}}
@@ -155,7 +161,7 @@ Archived learnings are moved to `/.agents/learnings/archived/` with their origin
155
161
  ```
156
162
  Learnings matching "{query}":
157
163
  [{confidence}] {title} ({date}, tags: {tags})
158
- /.agents/learnings/{filename}.md
164
+ .agents/learnings/{filename}.md
159
165
  Applies when: {trigger summary}
160
166
  ```
161
167
 
@@ -197,8 +203,8 @@ When writing learning files, validate:
197
203
 
198
204
  ## Error Handling
199
205
 
200
- - `/.agents/learnings/` directory doesn't exist: create it silently.
201
- - `/.agents/learnings/archived/` directory doesn't exist: create it when first archival occurs.
206
+ - `.agents/learnings/` directory doesn't exist: create it silently.
207
+ - `.agents/learnings/archived/` directory doesn't exist: create it when first archival occurs.
202
208
  - Duplicate learning detected: warn and **ASK** whether to merge or create separate.
203
209
  - No learnings identified: **ASK** user directly what they learned. If still nothing, skip silently.
204
210
  - Learning exceeds quality thresholds: warn user with specific violations and suggest fixes.
@@ -211,7 +217,7 @@ When writing learning files, validate:
211
217
  - **Never delete learnings.** Use archival (move to `archived/`) instead of deletion.
212
218
  - **Learnings must be specific and actionable.** Reject generic advice like "write better tests."
213
219
  - **Always include trigger conditions** in the "Applies When" section.
214
- - **Tags must match project vocabulary** -- use area labels from `/.agents/hatch.json`.
220
+ - **Tags must match project vocabulary** -- use area labels from `.agents/hatch.json`.
215
221
  - **Max ~20 lines per learning** file body (excluding frontmatter).
216
222
  - **Learnings without evidence must be `hypothesis`.** Do not allow `proven` or `experimental` without evidence.
217
223
  - **Expired learnings are archived, not deleted.** Preserve institutional knowledge.
@@ -2,50 +2,350 @@
2
2
  id: hatch3r-migration-plan
3
3
  type: command
4
4
  description: Create a phased migration plan for a major dependency or framework upgrade. Analyzes breaking changes and produces an actionable plan with rollback procedures.
5
+ tags: [planning, brownfield]
5
6
  ---
6
- # Migration Plan Generator
7
7
 
8
- ## Inputs
8
+ ## Agent Pipeline
9
9
 
10
- - **Migration target:** dependency name and target version, or framework/platform change description
11
- - **Current version:** auto-detected from lockfile or specified manually
12
- - **Scope:** `full` (default) or `assessment-only` (just the analysis, no plan)
10
+ | Stage | Agent(s) | Parallel | Required |
11
+ |-------|----------|----------|----------|
12
+ | 1. Research | `hatch3r-researcher` (2 parallel: dependency-analysis, breaking-changes) | Yes | Yes |
13
+ | 2. Impact Analysis | `hatch3r-architect` | No | Yes |
14
+ | 3. Plan Generation | `hatch3r-docs-writer` | No | Yes |
13
15
 
14
- ## Procedure
16
+ # Migration Plan — Dependency or Framework Upgrade from Assessment to Phased Execution
15
17
 
16
- 1. **Detect current state:**
17
- - Read `package.json`, lockfile, or equivalent for current version
18
- - Identify all direct and transitive dependents of the migration target
19
- - Count usage sites in the codebase (imports, API calls)
18
+ Take a dependency or framework upgrade target and produce a complete migration plan (`docs/migrations/`), rollback procedures for each phase, and structured `todo.md` entries ready for `hatch3r-board-fill`. Spawns parallel researcher sub-agents (dependency changelog analysis, breaking change inventory) followed by an architect for codebase impact mapping, then a docs-writer for plan generation. AI proposes all outputs; user confirms before any files are written. Optionally chains into `hatch3r-board-fill` to create GitHub issues immediately.
20
19
 
21
- 2. **Research breaking changes:**
22
- - Read the changelog/release notes between current and target versions
23
- - Use web research for migration guides, known issues, and community solutions
24
- - Identify deprecated APIs, removed features, and behavioral changes
20
+ ---
21
+
22
+ ## Shared Context
23
+
24
+ **Read the `hatch3r-board-shared` command at the start of the run** if it exists. While this command does not perform board operations directly, it establishes patterns and context (GitHub owner/repo, tooling directives) that downstream commands like `hatch3r-board-fill` rely on. Cache any values found.
25
+
26
+ ## Token-Saving Directives
27
+
28
+ 1. **Do not re-read files already cached.** Once researcher outputs are collected, reference them in memory — do not re-invoke sub-agents.
29
+ 2. **Limit changelog reads.** When reading changelogs spanning many versions, extract only breaking changes and deprecations — skip patch-level entries unless security-relevant.
30
+ 3. **Structured output only.** All sub-agent prompts require structured markdown output — no prose dumps.
31
+ 4. **Batch file scanning.** When mapping breaking changes to codebase files, use targeted grep/glob patterns rather than reading entire file trees.
32
+
33
+ ---
34
+
35
+ ## Workflow
36
+
37
+ Execute these steps in order. **Do not skip any step.** Ask the user at every checkpoint marked with ASK.
38
+
39
+ ### Step 1: Gather Migration Target
40
+
41
+ 1. **ASK:** "Tell me about the migration you're planning. I need:
42
+ - **Dependency / framework name** (e.g., `react`, `prisma`, `next`, `typescript`)
43
+ - **Target version** (e.g., `v19`, `^6.0.0`, `latest`)
44
+ - **Motivation** (why now? — end-of-life, security, new feature needed, performance, ecosystem pressure)
45
+ - **Known constraints** (timeline, downstream consumers, deployment windows, feature freezes)
46
+
47
+ I'll auto-detect the current version from your lockfile. If this is a framework migration (e.g., CRA → Vite, Express → Fastify), describe the source and target instead of versions."
48
+
49
+ 2. Auto-detect the current version from `package.json`, lockfile (`package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`), `Cargo.toml`, `go.mod`, `pyproject.toml`, or equivalent. Identify the package manager and count direct/transitive dependents.
50
+
51
+ 3. Present a structured summary:
52
+
53
+ ```
54
+ Migration Brief:
55
+ Target: {dependency} {current} → {target}
56
+ Package Manager: {npm/yarn/pnpm/cargo/go/pip}
57
+ Motivation: {user-provided reason}
58
+ Constraints: {list}
59
+ Direct Dependents: {N} packages depend on this
60
+ Usage Sites: {N} imports / API call sites in codebase
61
+ Version Gap: {N} major versions / {M} minor versions
62
+ ```
63
+
64
+ **ASK:** "Does this capture the migration correctly? Adjust anything before I proceed to analysis."
65
+
66
+ #### Step 1b: Dimension Probing
67
+
68
+ After the migration brief is confirmed, probe for missing context. Analyze the brief for unstated assumptions and generate 4–8 targeted questions from the most relevant dimensions:
69
+ - **Data migrations**: Does the upgrade require database schema changes, data transformations, or format conversions?
70
+ - **Feature flags**: Should the migration be gated behind feature flags for gradual rollout?
71
+ - **Backward compatibility**: Must the old and new versions coexist during transition (e.g., dual-write, adapter pattern)?
72
+ - **Downstream consumers**: Are there other services, packages, or teams consuming APIs that will change?
73
+ - **CI/CD impact**: Will build tooling, test runners, or deployment pipelines need updates?
74
+ - **Runtime environment**: Does the target version require a newer Node.js, Python, Go, or OS version?
75
+ - **Bundle/binary size**: Are there known size regressions in the target version?
76
+ - **Type system**: Does the upgrade introduce stricter types or remove type exports?
77
+
78
+ Skip dimensions that the migration brief already addresses clearly.
79
+
80
+ **ASK:** "Before research begins, I have {N} questions to ensure we don't miss anything:
81
+ {numbered question list — each with the dimension label and why the answer matters}
82
+
83
+ Answer these now, or say 'use defaults' for any where you're comfortable with a reasonable default."
84
+
85
+ Record the user's answers as **Resolved Requirements** (passed to researchers and architect). For defaults, note the assumed value explicitly.
86
+
87
+ ---
88
+
89
+ ### Step 2: Research Phase — Spawn Parallel Researcher Sub-Agents
90
+
91
+ Spawn two sub-agents concurrently, each following the **hatch3r-researcher agent protocol**. Each receives the confirmed migration brief, the Resolved Requirements from Step 1b, and uses depth level `deep`.
92
+
93
+ | Sub-Agent | Focus | Output |
94
+ |-----------|-------|--------|
95
+ | 1. Dependency Analysis | Changelog between current → target, deprecated APIs, removed exports, new required config, peer dependency changes, transitive dependency conflicts | Structured breaking change inventory with severity tags |
96
+ | 2. Breaking Changes & Community | Community migration guides, known issues, common pitfalls, workarounds, codemods available, official migration tools | Curated list of migration resources with applicability assessment |
97
+
98
+ **Each sub-agent uses the project's tooling hierarchy:** project docs first, then codebase exploration, then Context7 MCP for library documentation, then web research for community guides.
99
+
100
+ If the version gap spans multiple major versions (e.g., v2 → v5), instruct the dependency-analysis researcher to produce a per-major-version breakdown, noting which changes compound or are superseded.
101
+
102
+ Wait for both sub-agents to complete before proceeding.
103
+
104
+ ---
105
+
106
+ ### Step 3: Impact Analysis — Spawn Architect
107
+
108
+ Spawn the **hatch3r-architect** agent with the combined researcher outputs. The architect maps each breaking change to the actual codebase.
109
+
110
+ **Architect receives:** the breaking change inventory, community migration resources, Resolved Requirements from Step 1b, and full codebase context (file tree, import graph for the target dependency).
111
+
112
+ **Architect produces:**
113
+
114
+ | Output | Description |
115
+ |--------|-------------|
116
+ | **Breaking Change Map** | Each breaking change → list of affected files, line ranges, and code patterns that must change |
117
+ | **Severity Classification** | Each change classified: `trivial` (find-replace / codemod), `moderate` (logic rewrite), `significant` (architectural rework) |
118
+ | **Effort Estimates** | Hours per change, with confidence level (high/medium/low based on how well the change is understood) |
119
+ | **Risk Register** | Data-loss risks, security implications, performance regressions, behavioral changes that tests may not catch |
120
+ | **Codemod Candidates** | Changes amenable to automated codemods — AST transforms, regex replacements, or official migration tools |
121
+
122
+ Wait for the architect to complete before proceeding.
123
+
124
+ ---
125
+
126
+ ### Step 4: Synthesize & Review Analysis
127
+
128
+ 1. Present a **merged summary** combining findings from all agents:
129
+
130
+ ```
131
+ Migration Analysis:
132
+
133
+ Target: {dependency} {current} → {target}
134
+ Breaking Changes: {N} total ({X} trivial, {Y} moderate, {Z} significant)
135
+ Affected Files: {N} files across {M} modules
136
+ Codemod Candidates: {N} changes automatable
137
+ Estimated Effort: {total hours} ({confidence})
138
+ Risks: {N} risks ({X} high, {Y} medium, {Z} low)
139
+ Data-Loss Risk: {yes/no — details if yes}
140
+ Coexistence Required:{yes/no — dual-version period needed}
141
+ Peer Dep Conflicts: {N} ({list if any})
142
+ ```
143
+
144
+ 2. **Highlight high-severity items** — any `significant` breaking change, data-loss risk, or change without a clear migration path.
145
+
146
+ 3. If the version gap spans multiple major versions, recommend incremental vs. direct migration with trade-offs for each.
147
+
148
+ **ASK:** "Here is the migration analysis. High-severity items are highlighted above. Options:
149
+ - **Confirm** to proceed with phased plan generation
150
+ - **Adjust** specific findings (tell me what to change)
151
+ - **Re-run** a specific researcher or the architect with updated parameters
152
+ - **Descope** to target an intermediate version instead"
153
+
154
+ ---
155
+
156
+ ### Step 5: Generate Phased Migration Plan
157
+
158
+ From the merged analysis, generate a phased migration plan. Present all content for review before writing any files.
159
+
160
+ #### Migration Plan — `docs/migrations/{dependency}_{current}_to_{target}.md`
161
+
162
+ ```markdown
163
+ # Migration Plan: {Dependency} {current} → {target}
164
+
165
+ ## Overview
166
+
167
+ {2-3 sentence summary of the migration scope, motivation, and approach}
25
168
 
26
- 3. **Impact analysis:**
27
- - Map each breaking change to affected files in the codebase
28
- - Classify impact: `trivial` (find-replace), `moderate` (logic change), `significant` (architectural change)
29
- - Estimate effort per change (hours)
30
- - Identify risk areas (data loss potential, security implications, performance impact)
169
+ ## Migration Summary
170
+
171
+ | Metric | Value |
172
+ |--------|-------|
173
+ | Breaking changes | {N} |
174
+ | Affected files | {N} |
175
+ | Estimated effort | {hours} |
176
+ | Recommended approach | {incremental / direct} |
177
+ | Coexistence period | {yes/no — duration if yes} |
178
+ | Rollback complexity | {low/medium/high} |
179
+
180
+ ## Phase 0: Preparation
181
+
182
+ **Goal:** Create safety nets before any migration work begins.
183
+
184
+ | # | Task | Files | Effort | Validation |
185
+ |---|------|-------|--------|------------|
186
+ | 0.1 | Add test coverage for migration-affected code paths | {files} | {hours} | All new tests pass |
187
+ | 0.2 | Pin transitive dependencies to prevent drift | {files} | {hours} | Lockfile updated |
188
+ | 0.3 | Create compatibility shims / adapter layer (if coexistence needed) | {files} | {hours} | Shims compile, existing tests pass |
189
+ | 0.4 | Document current behavior for regression comparison | — | {hours} | Snapshot saved |
190
+
191
+ **Rollback:** No codebase changes to roll back. Remove new tests only if abandoning migration entirely.
192
+
193
+ ## Phase 1: Non-Breaking Updates
194
+
195
+ **Goal:** Apply changes that are backward-compatible with the current version.
196
+
197
+ | # | Task | Files | Effort | Validation |
198
+ |---|------|-------|--------|------------|
199
+ | 1.1 | Update configuration to support both versions | {files} | {hours} | Config valid for both versions |
200
+ | 1.2 | Add new imports alongside deprecated ones | {files} | {hours} | No runtime changes |
201
+ | 1.3 | Run available codemods for trivial changes | {files} | {hours} | Codemod output reviewed, tests pass |
202
+
203
+ **Rollback:** `git revert` the Phase 1 commits. No data or state changes to undo.
204
+
205
+ ## Phase 2: Migrate Consumers
206
+
207
+ **Goal:** Update application code to use new APIs, patterns, and behaviors.
208
+
209
+ | # | Task | Breaking Change | Severity | Files | Effort | Validation |
210
+ |---|------|----------------|----------|-------|--------|------------|
211
+ | 2.1 | {task description} | {breaking change ref} | {trivial/moderate/significant} | {files} | {hours} | {how to verify} |
212
+
213
+ **Rollback:** Revert Phase 2 commits. If data migrations occurred, run reverse migration script `{script}`.
214
+
215
+ ## Phase 3: Cleanup
216
+
217
+ **Goal:** Remove backward-compatibility code, old imports, shims, and dead dependencies.
218
+
219
+ | # | Task | Files | Effort | Validation |
220
+ |---|------|-------|--------|------------|
221
+ | 3.1 | Remove compatibility shims | {files} | {hours} | No references to shim modules |
222
+ | 3.2 | Remove old dependency version from lockfile | {files} | {hours} | Only target version remains |
223
+ | 3.3 | Remove deprecated API usage suppressions | {files} | {hours} | No suppression comments remain |
224
+ | 3.4 | Update documentation and READMEs | {files} | {hours} | Docs reflect new version |
225
+
226
+ **Rollback:** Re-add shims from Phase 0 if a late regression surfaces.
227
+
228
+ ## Risk Register
229
+
230
+ | Risk | Severity | Phase | Mitigation | Detection |
231
+ |------|----------|-------|------------|-----------|
232
+ | {risk} | High/Med/Low | {phase} | {strategy} | {how to detect early} |
233
+
234
+ ## Validation Checklist
235
+
236
+ - [ ] All existing tests pass after each phase
237
+ - [ ] No new lint warnings or type errors
238
+ - [ ] Performance benchmarks within {X}% of baseline
239
+ - [ ] No runtime deprecation warnings or console errors
240
+ - [ ] CI pipeline passes on migration branch
241
+ - [ ] Manual smoke test of critical user flows
242
+
243
+ ---
244
+
245
+ **Owner / Reviewers / Last updated**
246
+ Owner: {tbd}
247
+ Reviewers: {tbd}
248
+ Last updated: {today's date}
249
+ ```
250
+
251
+ **ASK:** "Here is the phased migration plan. Review the content before I write the file:
252
+ - `{dependency}_{current}_to_{target}.md` — {phase count} phases, {task count} tasks, {risk count} risks
253
+
254
+ Confirm, or tell me what to adjust."
255
+
256
+ ---
257
+
258
+ ### Step 6: Generate todo.md Entries
259
+
260
+ From the phased migration plan, generate structured `todo.md` entries in the format that `hatch3r-board-fill` expects. One **epic-level entry** referencing the migration plan, followed by **one entry per phase**:
261
+
262
+ ```markdown
263
+ - [ ] **Migrate {dependency} {current} → {target}**: {Migration overview with scope and effort summary}. Ref: docs/migrations/{dependency}_{current}_to_{target}.md.
264
+ - [ ] **{dependency} migration Phase 0 — Preparation**: {Phase 0 task summary}. Ref: docs/migrations/{dependency}_{current}_to_{target}.md.
265
+ - [ ] **{dependency} migration Phase 1 — Non-breaking updates**: {Phase 1 task summary}. Ref: docs/migrations/{dependency}_{current}_to_{target}.md.
266
+ - [ ] **{dependency} migration Phase 2 — Migrate consumers**: {Phase 2 task summary with breaking change count}. Ref: docs/migrations/{dependency}_{current}_to_{target}.md.
267
+ - [ ] **{dependency} migration Phase 3 — Cleanup**: {Phase 3 task summary}. Ref: docs/migrations/{dependency}_{current}_to_{target}.md.
268
+ ```
269
+
270
+ #### Placement
271
+
272
+ Determine the appropriate priority header based on the migration motivation. Security and EOL migrations default to P0; feature-driven migrations default to P1; ecosystem-pressure migrations default to P2.
273
+
274
+ #### If `todo.md` Already Exists
275
+
276
+ **ASK:** "todo.md already exists with {N} items. How should I add the migration entries?
277
+ - **(a) Append** under the appropriate priority header
278
+ - **(b) Merge** — deduplicate against existing items and reorganize
279
+ - **(c) Show me the entries** and I'll place them manually"
280
+
281
+ #### If `todo.md` Does Not Exist
282
+
283
+ Create a new `todo.md` with the appropriate priority header and the new entries.
284
+
285
+ Present the drafted entries for review.
286
+
287
+ **ASK:** "Here are the todo.md entries for this migration ({N} items — 1 epic + {M} phase items). Review before I write:
288
+
289
+ {entries}
290
+
291
+ Confirm, or tell me what to adjust."
292
+
293
+ ---
294
+
295
+ ### Step 7: Write All Files
296
+
297
+ After all content is confirmed:
298
+
299
+ 1. Write the migration plan to `docs/migrations/{dependency}_{current}_to_{target}.md`. Create the directory if needed.
300
+ 2. Write or update `todo.md` at the project root.
301
+ 3. Present a summary:
302
+
303
+ ```
304
+ Files Created/Updated:
305
+ docs/migrations/
306
+ {dependency}_{current}_to_{target}.md — {phase count} phases, {task count} tasks
307
+ todo.md — {N} entries added (1 epic + {M} phases)
308
+ ```
309
+
310
+ ---
311
+
312
+ ### Step 8 (Optional): Chain into Board-Fill
313
+
314
+ **ASK:** "All files written. Run `hatch3r-board-fill` to create GitHub issues from the new todo.md entries? (yes / not now)"
315
+
316
+ If yes, instruct the user to invoke the `hatch3r-board-fill` command. Board-fill will perform its own deduplication, grouping, and readiness assessment.
317
+
318
+ ---
31
319
 
32
- 4. **Generate phased plan:**
33
- - Phase 0: Preparation (add compatibility shims, increase test coverage on affected areas)
34
- - Phase 1: Non-breaking updates (update config, add new imports alongside old)
35
- - Phase 2: Migrate consumers (update code to use new APIs)
36
- - Phase 3: Remove old code (delete shims, deprecated usage, old dependencies)
37
- - Each phase includes: files to change, validation criteria, rollback steps
320
+ ## Error Handling
38
321
 
39
- 5. **Output the plan** as a markdown document or GitHub issue(s).
322
+ - **No changelog available:** Fall back to git diff of the source repository between version tags. If unavailable, rely on community migration guide researcher output only and warn the user that the breaking change inventory may be incomplete.
323
+ - **Breaking changes unmappable to codebase:** Flag as a **runtime risk** in the risk register with detection strategy (test, monitoring, canary) when a breaking change has no API signature difference to grep for.
324
+ - **Version gap too large:** If the migration spans 3+ major versions, recommend incremental migration (one major at a time) and generate a plan for the first hop only. ASK whether to plan just the first hop or attempt the full jump.
325
+ - **Sub-agent failure:** Retry once. If it fails again, present partial results and ask the user how to proceed (continue with partial analysis / provide missing information manually / abort).
326
+ - **Conflicting researcher outputs:** Present both sides with trade-offs. Ask the user to decide. Do not silently pick one.
327
+ - **File write failure:** Report the error and provide full file content so the user can create the file manually.
328
+ - **Missing project context:** Proceed without board context — this command does not require board configuration.
329
+ - **Peer dependency conflicts:** Enumerate conflicts in the analysis and include resolution tasks in Phase 0.
330
+ - **No codebase usage found:** Warn that the dependency may be transitive-only and adjust the plan scope accordingly.
40
331
 
41
- ## Output
332
+ ## Guardrails
42
333
 
43
- - Migration assessment with breaking change inventory
44
- - Phased migration plan with effort estimates
45
- - Rollback procedure for each phase
46
- - Checklist of validation steps
334
+ - **Never auto-execute migration steps.** This command produces a plan — it never runs install, upgrade, or codemod commands.
335
+ - **Never skip ASK checkpoints.** Every step with an ASK must pause for user confirmation.
336
+ - **Never write files without user review and confirmation.** All generated content is presented first.
337
+ - **Preserve rollback ability at each phase.** Every phase must include a rollback procedure. If a phase cannot be rolled back (e.g., irreversible data migration), flag it with **⚠ IRREVERSIBLE** and require explicit user acknowledgment.
338
+ - **Flag data-loss risks prominently.** Any data-loss risk must appear in the risk register with `High` severity and a dedicated mitigation strategy.
339
+ - **Always delegate research to the hatch3r-researcher agent protocol.** Researcher sub-agents handle Context7 MCP, web research, and the tooling hierarchy internally.
340
+ - **Respect the project's tooling hierarchy:** project docs → codebase exploration → Context7 MCP → web research.
341
+ - **todo.md must be compatible with board-fill format** — markdown checklist with bold titles, grouped by priority, referencing source specs.
342
+ - **Preserve existing todo.md content.** Never overwrite or reorganize existing items without explicit user approval.
343
+ - **Scope to the declared target.** Do not opportunistically upgrade other dependencies. Flag sibling upgrades as follow-up recommendations.
47
344
 
48
345
  ## Related
49
346
 
50
- - **Skill:** `hatch3r-migration` — execution workflow for the plan
51
- - **Skill:** `hatch3r-dep-audit` — dependency health check
347
+ - **Command:** `hatch3r-dep-audit` — dependency health check; run before migration planning
348
+ - **Command:** `hatch3r-refactor-plan` — structural refactoring that accompanies a migration
349
+ - **Command:** `hatch3r-board-fill` — create GitHub issues from generated todo.md entries
350
+ - **Command:** `hatch3r-feature-plan` — plan features that depend on the migration target's new capabilities
351
+ - **Skill:** `hatch3r-refactor` — execution workflow for migration phases involving code restructuring