amazingteam 3.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 (164) hide show
  1. package/.ai-team/agents/architect.md +144 -0
  2. package/.ai-team/agents/ci-analyst.md +188 -0
  3. package/.ai-team/agents/developer.md +176 -0
  4. package/.ai-team/agents/planner.md +355 -0
  5. package/.ai-team/agents/qa.md +189 -0
  6. package/.ai-team/agents/reviewer.md +211 -0
  7. package/.ai-team/agents/triage.md +146 -0
  8. package/.ai-team/commands/ci-analyze.md +116 -0
  9. package/.ai-team/commands/design.md +100 -0
  10. package/.ai-team/commands/implement.md +108 -0
  11. package/.ai-team/commands/release-check.md +142 -0
  12. package/.ai-team/commands/review.md +142 -0
  13. package/.ai-team/commands/test.md +115 -0
  14. package/.ai-team/commands/triage.md +138 -0
  15. package/.ai-team/memory/architect/architecture_notes.md +67 -0
  16. package/.ai-team/memory/architect/design_rationale.md +113 -0
  17. package/.ai-team/memory/architect/module_map.md +84 -0
  18. package/.ai-team/memory/ci-analyst/failure_patterns.md +102 -0
  19. package/.ai-team/memory/ci-analyst/runbook_references.md +87 -0
  20. package/.ai-team/memory/developer/bug_investigation.md +102 -0
  21. package/.ai-team/memory/developer/build_issues.md +115 -0
  22. package/.ai-team/memory/developer/implementation_notes.md +83 -0
  23. package/.ai-team/memory/failures/failure_library.md +103 -0
  24. package/.ai-team/memory/planner/decomposition_notes.md +82 -0
  25. package/.ai-team/memory/planner/flow_rules.md +86 -0
  26. package/.ai-team/memory/planner/github_issue_patterns.md +229 -0
  27. package/.ai-team/memory/qa/regression_cases.md +101 -0
  28. package/.ai-team/memory/qa/test_strategy.md +138 -0
  29. package/.ai-team/memory/qa/validation_notes.md +110 -0
  30. package/.ai-team/memory/reviewer/quality_rules.md +105 -0
  31. package/.ai-team/memory/reviewer/recurring_risks.md +109 -0
  32. package/.ai-team/memory/reviewer/review_notes.md +124 -0
  33. package/.ai-team/memory/triage/classification_heuristics.md +82 -0
  34. package/.ai-team/memory/triage/debug_notes.md +87 -0
  35. package/.ai-team/opencode.template.jsonc +216 -0
  36. package/.ai-team/skills/bugfix-playbook/skill.md +174 -0
  37. package/.ai-team/skills/ci-failure-analysis/skill.md +176 -0
  38. package/.ai-team/skills/issue-triage/skill.md +163 -0
  39. package/.ai-team/skills/regression-checklist/skill.md +176 -0
  40. package/.ai-team/skills/release-readiness-check/skill.md +216 -0
  41. package/.ai-team/skills/repo-architecture-reader/skill.md +139 -0
  42. package/.ai-team/skills/safe-refactor-checklist/skill.md +215 -0
  43. package/.ai-team/skills/task-breakdown-and-dispatch/skill.md +151 -0
  44. package/.ai-team/skills/test-first-feature-dev/skill.md +205 -0
  45. package/.ai-team/workflows/ci.yml +81 -0
  46. package/.ai-team/workflows/nightly-ai-maintenance.yml +129 -0
  47. package/.ai-team/workflows/opencode.yml +33 -0
  48. package/.ai-team/workflows/pr-check.yml +41 -0
  49. package/.foundation/foundation.lock +38 -0
  50. package/.foundation/local-overrides.md +97 -0
  51. package/.foundation/upgrade-history.md +38 -0
  52. package/.opencode/agents/architect.md +38 -0
  53. package/.opencode/agents/ci-analyst.md +38 -0
  54. package/.opencode/agents/developer.md +43 -0
  55. package/.opencode/agents/planner.md +47 -0
  56. package/.opencode/agents/qa.md +34 -0
  57. package/.opencode/agents/reviewer.md +38 -0
  58. package/.opencode/agents/triage.md +37 -0
  59. package/.opencode/commands/auto.md +264 -0
  60. package/.opencode/commands/breakdown-issue.md +94 -0
  61. package/.opencode/commands/ci-analyze.md +15 -0
  62. package/.opencode/commands/close-parent-task.md +122 -0
  63. package/.opencode/commands/design.md +15 -0
  64. package/.opencode/commands/dispatch-next.md +102 -0
  65. package/.opencode/commands/implement.md +16 -0
  66. package/.opencode/commands/release-check.md +16 -0
  67. package/.opencode/commands/resume.md +88 -0
  68. package/.opencode/commands/review.md +15 -0
  69. package/.opencode/commands/show-blockers.md +97 -0
  70. package/.opencode/commands/summarize-parent.md +121 -0
  71. package/.opencode/commands/test.md +15 -0
  72. package/.opencode/commands/triage.md +109 -0
  73. package/.opencode/skills/bugfix-playbook/SKILL.md +81 -0
  74. package/.opencode/skills/ci-failure-analysis/SKILL.md +94 -0
  75. package/.opencode/skills/issue-triage/SKILL.md +80 -0
  76. package/.opencode/skills/regression-checklist/SKILL.md +81 -0
  77. package/.opencode/skills/release-readiness-check/SKILL.md +81 -0
  78. package/.opencode/skills/repo-architecture-reader/SKILL.md +65 -0
  79. package/.opencode/skills/safe-refactor-checklist/SKILL.md +76 -0
  80. package/.opencode/skills/task-breakdown-and-dispatch/SKILL.md +255 -0
  81. package/.opencode/skills/test-first-feature-dev/SKILL.md +78 -0
  82. package/AGENTS.md +879 -0
  83. package/CHANGELOG.md +261 -0
  84. package/LICENSE +21 -0
  85. package/README.md +1215 -0
  86. package/VERSION +1 -0
  87. package/action/__tests__/downloader.test.js +251 -0
  88. package/action/__tests__/merger.test.js +156 -0
  89. package/action/__tests__/path-resolver.test.js +199 -0
  90. package/action/__tests__/validator.test.js +310 -0
  91. package/action/action.yml +61 -0
  92. package/action/index.js +223 -0
  93. package/action/lib/downloader.js +344 -0
  94. package/action/lib/merger.js +170 -0
  95. package/action/lib/path-resolver.js +176 -0
  96. package/action/lib/setup.js +286 -0
  97. package/action/lib/validator.js +324 -0
  98. package/cli/__tests__/cli.test.js +270 -0
  99. package/cli/amazingteam.cjs +225 -0
  100. package/cli/commands/check-update.cjs +159 -0
  101. package/cli/commands/init.cjs +412 -0
  102. package/cli/commands/local.cjs +264 -0
  103. package/cli/commands/migrate.cjs +316 -0
  104. package/cli/commands/status.cjs +241 -0
  105. package/cli/commands/upgrade.cjs +213 -0
  106. package/cli/commands/validate.cjs +259 -0
  107. package/cli/commands/version.cjs +59 -0
  108. package/cli/sync.cjs +237 -0
  109. package/dist/index.js +35 -0
  110. package/docs/architecture/overview.md +138 -0
  111. package/docs/blocker_resolution_design.md +372 -0
  112. package/docs/bootstrap-model.md +356 -0
  113. package/docs/config-reference.md +458 -0
  114. package/docs/how-to-use.md +178 -0
  115. package/docs/migration-to-v3.md +355 -0
  116. package/docs/overlay-guide.md +156 -0
  117. package/docs/patterns/README.md +67 -0
  118. package/docs/quick-start-v3.md +330 -0
  119. package/docs/releases/README.md +64 -0
  120. package/docs/runbooks/ci/README.md +62 -0
  121. package/docs/runbooks/ci/build-debug.md +120 -0
  122. package/docs/runbooks/ci/flaky-tests.md +127 -0
  123. package/docs/runbooks/getting-started.md +81 -0
  124. package/docs/upgrade-policy.md +188 -0
  125. package/docs/versioning.md +199 -0
  126. package/overlays/README.md +30 -0
  127. package/overlays/ai-agent-product/.ai-team/skills/llm-integration/skill.md +99 -0
  128. package/overlays/ai-agent-product/docs/ai-agent-architecture.md +68 -0
  129. package/overlays/ai-agent-product/overlay.yaml +26 -0
  130. package/overlays/cpp-qt-desktop/.ai-team/skills/qt-signals-slots/skill.md +60 -0
  131. package/overlays/cpp-qt-desktop/docs/qt-conventions.md +64 -0
  132. package/overlays/cpp-qt-desktop/overlay.yaml +22 -0
  133. package/overlays/python-backend/.ai-team/skills/python-testing/skill.md +90 -0
  134. package/overlays/python-backend/docs/python-style.md +78 -0
  135. package/overlays/python-backend/overlay.yaml +22 -0
  136. package/overlays/web-fullstack/.ai-team/skills/frontend-testing/skill.md +70 -0
  137. package/overlays/web-fullstack/docs/frontend-conventions.md +68 -0
  138. package/overlays/web-fullstack/overlay.yaml +26 -0
  139. package/package.json +84 -0
  140. package/presets/default.yaml +161 -0
  141. package/presets/go.yaml +43 -0
  142. package/presets/python.yaml +43 -0
  143. package/presets/typescript.yaml +40 -0
  144. package/schemas/config.schema.json +239 -0
  145. package/scripts/diff_foundation_vs_project.sh +134 -0
  146. package/scripts/generate_docs.sh +200 -0
  147. package/scripts/init_project.sh +455 -0
  148. package/scripts/plan_upgrade.sh +268 -0
  149. package/scripts/upgrade_foundation.sh +365 -0
  150. package/scripts/validate-foundation.cjs +278 -0
  151. package/scripts/validate_foundation.sh +192 -0
  152. package/scripts/validate_project_setup.sh +171 -0
  153. package/tasks/README.md +94 -0
  154. package/tasks/_template/analysis.md +76 -0
  155. package/tasks/_template/design.md +121 -0
  156. package/tasks/_template/implementation.md +121 -0
  157. package/tasks/_template/release.md +119 -0
  158. package/tasks/_template/review.md +131 -0
  159. package/tasks/_template/subtasks/task.yaml +24 -0
  160. package/tasks/_template/task.yaml +75 -0
  161. package/tasks/_template/validation.md +128 -0
  162. package/templates/amazingteam.yml +81 -0
  163. package/templates/gitignore +14 -0
  164. package/templates/opencode.jsonc +216 -0
@@ -0,0 +1,330 @@
1
+ # AmazingTeam Foundation v3 - Quick Start (Draft)
2
+
3
+ ## Overview
4
+
5
+ This guide shows how to use AmazingTeam Foundation v3 in your project with minimal setup.
6
+
7
+ ---
8
+
9
+ ## Installation
10
+
11
+ ### Option 1: Initialize in Existing Project
12
+
13
+ ```bash
14
+ # Navigate to your project
15
+ cd my-project
16
+
17
+ # Initialize AmazingTeam
18
+ npx amazingteam init
19
+ ```
20
+
21
+ ### Option 2: Create New Project
22
+
23
+ ```bash
24
+ # Create new project with AmazingTeam
25
+ npx amazingteam init my-new-project
26
+ cd my-new-project
27
+ ```
28
+
29
+ ---
30
+
31
+ ## What Gets Created
32
+
33
+ ```
34
+ my-project/
35
+ ├── .github/
36
+ │ └── workflows/
37
+ │ └── amazingteam.yml # GitHub Action workflow
38
+ ├── amazingteam.config.yaml # Your configuration
39
+ └── .gitignore # Updated (ignores .ai-team-local/)
40
+ ```
41
+
42
+ **That's it!** Only 3 files added to your repository.
43
+
44
+ ---
45
+
46
+ ## Configuration
47
+
48
+ ### Minimal Configuration
49
+
50
+ ```yaml
51
+ # amazingteam.config.yaml
52
+ project:
53
+ name: "my-project"
54
+ language: "typescript"
55
+ ```
56
+
57
+ ### Full Configuration
58
+
59
+ ```yaml
60
+ # amazingteam.config.yaml
61
+ version: "1.0"
62
+
63
+ project:
64
+ name: "my-awesome-app"
65
+ description: "My awesome application"
66
+ language: "typescript"
67
+ framework: "react"
68
+
69
+ # Build commands (override defaults)
70
+ build:
71
+ command: "npm run build"
72
+ test: "npm test"
73
+ lint: "npm run lint"
74
+ typecheck: "npm run typecheck"
75
+
76
+ # Custom rules
77
+ rules:
78
+ test_coverage_threshold: 80
79
+ max_function_lines: 30
80
+ commit_convention: "conventional"
81
+
82
+ # Agent configuration
83
+ agents:
84
+ planner: true
85
+ architect: true
86
+ developer: true
87
+ qa: true
88
+ reviewer: true
89
+ triage: true
90
+ ci_analyst: true
91
+
92
+ # Technology overlay (optional)
93
+ overlay: "web-fullstack"
94
+ ```
95
+
96
+ ---
97
+
98
+ ## Usage
99
+
100
+ ### In GitHub (CI/CD)
101
+
102
+ 1. Push your code to GitHub
103
+ 2. Create an issue or comment on an issue
104
+ 3. Type a command like `/ai implement this feature`
105
+ 4. AmazingTeam will process your request
106
+
107
+ ### Local Development
108
+
109
+ ```bash
110
+ # Download foundation for local use
111
+ npx amazingteam local
112
+
113
+ # This creates .ai-team-local/ with all foundation files
114
+ # Now you can use OpenCode locally with full AmazingTeam capabilities
115
+ ```
116
+
117
+ ---
118
+
119
+ ## Upgrading
120
+
121
+ ### Check for Updates
122
+
123
+ ```bash
124
+ npx amazingteam check-update
125
+
126
+ # Output:
127
+ # Current version: 3.0.0
128
+ # Latest version: 3.1.0
129
+ #
130
+ # Changes in 3.1.0:
131
+ # - feat: New skill for API documentation
132
+ # - fix: Memory handling improvement
133
+ #
134
+ # Run `ai-team upgrade` to update
135
+ ```
136
+
137
+ ### Upgrade
138
+
139
+ ```bash
140
+ npx amazingteam upgrade
141
+
142
+ # Output:
143
+ # Upgrading from 3.0.0 to 3.1.0...
144
+ #
145
+ # Updated files:
146
+ # - .github/workflows/amazingteam.yml
147
+ #
148
+ # No breaking changes.
149
+ # Upgrade complete!
150
+ ```
151
+
152
+ ### Upgrade to Specific Version
153
+
154
+ ```bash
155
+ npx amazingteam upgrade --to 3.0.5
156
+ ```
157
+
158
+ ---
159
+
160
+ ## Available Commands
161
+
162
+ | Command | Description |
163
+ |---------|-------------|
164
+ | `init` | Initialize AmazingTeam in project |
165
+ | `version` | Show current foundation version |
166
+ | `check-update` | Check for available updates |
167
+ | `upgrade` | Upgrade to latest version |
168
+ | `local` | Download foundation for local dev |
169
+ | `validate` | Validate configuration |
170
+
171
+ ---
172
+
173
+ ## Workflow File
174
+
175
+ The generated `.github/workflows/amazingteam.yml`:
176
+
177
+ ```yaml
178
+ name: AmazingTeam
179
+
180
+ on:
181
+ issue_comment:
182
+ types: [created]
183
+ pull_request_review_comment:
184
+ types: [created]
185
+
186
+ jobs:
187
+ ai-team:
188
+ if: |
189
+ startsWith(github.event.comment.body, '/ai') ||
190
+ startsWith(github.event.comment.body, '/opencode')
191
+ runs-on: ubuntu-latest
192
+ permissions:
193
+ id-token: write
194
+ contents: write
195
+ pull-requests: write
196
+ issues: write
197
+ steps:
198
+ - name: Checkout
199
+ uses: actions/checkout@v4
200
+ with:
201
+ fetch-depth: 0
202
+ token: ${{ secrets.GITHUB_TOKEN }}
203
+
204
+ - name: Setup AmazingTeam
205
+ uses: your-org/amazingteam-action@v3.0.0 # Version is auto-managed
206
+ with:
207
+ config: 'amazingteam.config.yaml'
208
+
209
+ - name: Run OpenCode
210
+ uses: anomalyco/opencode/github@latest
211
+ env:
212
+ ALIBABA_CODING_PLAN_API_KEY: ${{ secrets.ALIBABA_CODING_PLAN_API_KEY }}
213
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
214
+ with:
215
+ model: alibaba-coding-plan/glm-5
216
+ ```
217
+
218
+ ---
219
+
220
+ ## Comparison: v2 vs v3
221
+
222
+ | Aspect | v2 | v3 |
223
+ |--------|----|----|
224
+ | Files in user repo | ~50+ files | 2-3 files |
225
+ | Upgrade method | Manual copy/merge | Single command |
226
+ | Foundation location | Committed to repo | Loaded at runtime |
227
+ | Local development | Files already present | `ai-team local` command |
228
+ | Version control | Hard to track | Explicit in workflow |
229
+
230
+ ---
231
+
232
+ ## Migration from v2
233
+
234
+ If you have an existing v2 project:
235
+
236
+ ```bash
237
+ # Run migration
238
+ npx amazingteam migrate
239
+
240
+ # This will:
241
+ # 1. Extract your customizations
242
+ # 2. Create amazingteam.config.yaml
243
+ # 3. Update workflow file
244
+ # 4. Add foundation files to .gitignore
245
+ # 5. Remove foundation files from git tracking
246
+ ```
247
+
248
+ ---
249
+
250
+ ## FAQ
251
+
252
+ ### Q: What if I need to customize AGENTS.md?
253
+
254
+ A: You can create a local `AGENTS.md` in your project root. It will override the foundation's AGENTS.md entirely, or you can use the overlay feature in `amazingteam.config.yaml` to add content.
255
+
256
+ ### Q: What if I need custom skills?
257
+
258
+ A: Create `.ai-team/skills/` in your project. These will be merged with foundation skills at runtime.
259
+
260
+ ### Q: What if CI fails to download foundation?
261
+
262
+ A: The action caches foundation downloads. If network fails, it uses cache. You can also run `ai-team local` and commit `.ai-team-local/` as fallback.
263
+
264
+ ### Q: Can I use a specific version?
265
+
266
+ A: Yes, specify version in workflow file or use `ai-team upgrade --to x.x.x`.
267
+
268
+ ### Q: How do I migrate from v2?
269
+
270
+ A: Run `npx amazingteam migrate`. See [Migration Guide](./migration-to-v3.md) for details.
271
+
272
+ ### Q: Can I use this with private repositories?
273
+
274
+ A: Yes. The GitHub Action uses `GITHUB_TOKEN` which has access to the current repo. For private foundation packages, use a private NPM registry.
275
+
276
+ ### Q: What happens to my agent memories?
277
+
278
+ A: Your memories in `.ai-team/memory/` are preserved during migration and upgrades. They are local to your project and not affected by foundation updates.
279
+
280
+ ### Q: Can I disable specific agents?
281
+
282
+ A: Yes, in your `amazingteam.config.yaml`:
283
+
284
+ ```yaml
285
+ agents:
286
+ planner: false
287
+ ci_analyst: false
288
+ ```
289
+
290
+ ### Q: How do I add custom build commands?
291
+
292
+ A: Override in your config:
293
+
294
+ ```yaml
295
+ build:
296
+ command: "npm run build:prod"
297
+ test: "npm run test:coverage"
298
+ ```
299
+
300
+ ---
301
+
302
+ ## Troubleshooting
303
+
304
+ ### "Foundation download failed"
305
+
306
+ ```bash
307
+ # Try downloading manually
308
+ npx amazingteam local
309
+
310
+ # If still fails, check network or use VPN
311
+ ```
312
+
313
+ ### "Configuration validation failed"
314
+
315
+ ```bash
316
+ # Validate your config
317
+ npx amazingteam validate
318
+
319
+ # Check for errors and fix
320
+ ```
321
+
322
+ ### "OpenCode can't find skills"
323
+
324
+ ```bash
325
+ # Ensure foundation is downloaded
326
+ npx amazingteam local
327
+
328
+ # Check opencode.jsonc references
329
+ cat opencode.jsonc
330
+ ```
@@ -0,0 +1,64 @@
1
+ # Releases
2
+
3
+ This directory contains release documentation, checklists, and history.
4
+
5
+ ## Purpose
6
+
7
+ - Document release procedures
8
+ - Track release history
9
+ - Provide release checklists
10
+ - Record release decisions
11
+
12
+ ## Contents
13
+
14
+ ### Release Procedures
15
+
16
+ - Release checklist
17
+ - Version bumping guide
18
+ - Deployment procedures
19
+ - Rollback procedures
20
+
21
+ ### Release History
22
+
23
+ - RELEASE_NOTES.md - Changelog of releases
24
+ - release-log/ - Detailed release records
25
+
26
+ ### Release Criteria
27
+
28
+ - Quality gates
29
+ - Security requirements
30
+ - Performance requirements
31
+ - Documentation requirements
32
+
33
+ ## Release Process
34
+
35
+ 1. **Prepare**
36
+ - Update CHANGELOG
37
+ - Update version numbers
38
+ - Run full test suite
39
+ - Complete security scan
40
+
41
+ 2. **Validate**
42
+ - Run release readiness check
43
+ - Get required approvals
44
+ - Verify documentation
45
+
46
+ 3. **Release**
47
+ - Create release branch/tag
48
+ - Deploy to staging
49
+ - Smoke test
50
+ - Deploy to production
51
+ - Monitor
52
+
53
+ 4. **Post-Release**
54
+ - Update documentation
55
+ - Announce release
56
+ - Monitor for issues
57
+
58
+ ## Version Numbering
59
+
60
+ We follow Semantic Versioning (MAJOR.MINOR.PATCH):
61
+
62
+ - **MAJOR**: Breaking changes
63
+ - **MINOR**: New features (backward compatible)
64
+ - **PATCH**: Bug fixes (backward compatible)
@@ -0,0 +1,62 @@
1
+ # CI Runbooks
2
+
3
+ This directory contains operational runbooks for CI/CD issues.
4
+
5
+ ## Purpose
6
+
7
+ - Provide step-by-step guides for common CI issues
8
+ - Enable quick resolution of CI failures
9
+ - Document infrastructure-specific procedures
10
+ - Share knowledge across the team
11
+
12
+ ## Available Runbooks
13
+
14
+ ### Build Issues
15
+
16
+ - `build-debug.md` - Debugging build failures
17
+ - `dependencies.md` - Dependency resolution issues
18
+ - `memory.md` - Out of memory issues
19
+
20
+ ### Test Issues
21
+
22
+ - `flaky-tests.md` - Investigating and fixing flaky tests
23
+ - `timeouts.md` - Test timeout issues
24
+ - `environment.md` - Test environment setup
25
+
26
+ ### Infrastructure Issues
27
+
28
+ - `resources.md` - Resource limit management
29
+ - `network.md` - Network connectivity issues
30
+ - `permissions.md` - Permission and access issues
31
+
32
+ ## Runbook Template
33
+
34
+ ```markdown
35
+ # [Runbook Title]
36
+
37
+ ## Symptoms
38
+ [How to identify this issue]
39
+
40
+ ## Investigation Steps
41
+ 1. [Step 1]
42
+ 2. [Step 2]
43
+ 3. [Step 3]
44
+
45
+ ## Resolution
46
+ [How to fix the issue]
47
+
48
+ ## Prevention
49
+ [How to prevent recurrence]
50
+
51
+ ## Escalation
52
+ [When and how to escalate]
53
+ ```
54
+
55
+ ## Using Runbooks
56
+
57
+ 1. Identify the issue type from symptoms
58
+ 2. Find the appropriate runbook
59
+ 3. Follow investigation steps
60
+ 4. Apply resolution
61
+ 5. Document any new findings
62
+ 6. Update runbook if needed
@@ -0,0 +1,120 @@
1
+ # Build Debug Runbook
2
+
3
+ ## Symptoms
4
+
5
+ - Build fails with compilation errors
6
+ - Build fails with dependency errors
7
+ - Build succeeds locally but fails in CI
8
+ - Build timing out
9
+
10
+ ## Investigation Steps
11
+
12
+ ### 1. Check Error Messages
13
+
14
+ ```bash
15
+ # Review the error output
16
+ # Look for:
17
+ # - Specific file and line numbers
18
+ # - Missing imports
19
+ # - Type mismatches
20
+ # - Module resolution failures
21
+ ```
22
+
23
+ ### 2. Check Environment Differences
24
+
25
+ ```bash
26
+ # Compare local and CI environments
27
+ node --version
28
+ npm --version
29
+
30
+ # Check lock file
31
+ git diff package-lock.json
32
+
33
+ # Check for environment-specific config
34
+ git diff .env.example
35
+ ```
36
+
37
+ ### 3. Dependency Issues
38
+
39
+ ```bash
40
+ # Clear caches and reinstall
41
+ rm -rf node_modules
42
+ rm package-lock.json
43
+ npm install
44
+
45
+ # Check for peer dependency issues
46
+ npm ls
47
+ ```
48
+
49
+ ### 4. Check for Missing Files
50
+
51
+ ```bash
52
+ # Verify all referenced files exist
53
+ # Check for case-sensitivity issues
54
+ # Verify import paths
55
+ ```
56
+
57
+ ## Common Issues and Fixes
58
+
59
+ ### TypeScript Errors
60
+
61
+ | Error | Cause | Fix |
62
+ |-------|-------|-----|
63
+ | Cannot find module | Missing import or file | Add import or create file |
64
+ | Type 'X' is not assignable | Type mismatch | Fix type or add assertion |
65
+ | Property does not exist | Missing property | Add property or fix access |
66
+
67
+ ### Dependency Errors
68
+
69
+ | Error | Cause | Fix |
70
+ |-------|-------|-----|
71
+ | ERESOLVE | Dependency conflict | Update dependencies or use --legacy-peer-deps |
72
+ | 404 Not Found | Package doesn't exist | Check package name |
73
+ | Permission denied | NPM registry auth | Check .npmrc |
74
+
75
+ ### Memory Issues
76
+
77
+ | Error | Cause | Fix |
78
+ |-------|-------|-----|
79
+ | JavaScript heap out of memory | Large build | Increase NODE_OPTIONS |
80
+ | FATAL ERROR | Process killed | Reduce parallelism |
81
+
82
+ ## Resolution
83
+
84
+ ### Fix Compilation Errors
85
+
86
+ 1. Identify error location from output
87
+ 2. Fix the specific issue
88
+ 3. Run build locally to verify
89
+ 4. Commit and push
90
+
91
+ ### Fix Dependency Issues
92
+
93
+ 1. Check package.json for conflicts
94
+ 2. Update lock file
95
+ 3. Test installation from scratch
96
+ 4. Commit lock file changes
97
+
98
+ ### Fix Environment Issues
99
+
100
+ 1. Update CI configuration
101
+ 2. Add missing environment variables
102
+ 3. Update Node.js version if needed
103
+ 4. Test in CI
104
+
105
+ ## Prevention
106
+
107
+ - Keep dependencies updated
108
+ - Use strict TypeScript config
109
+ - Run lint and typecheck in CI
110
+ - Keep build scripts simple
111
+ - Document build requirements
112
+
113
+ ## Escalation
114
+
115
+ If unable to resolve:
116
+
117
+ 1. Document all investigation steps
118
+ 2. Note exact error messages
119
+ 3. Check CI analyst memory for similar issues
120
+ 4. Create issue with full context
@@ -0,0 +1,127 @@
1
+ # Flaky Test Investigation
2
+
3
+ ## Symptoms
4
+
5
+ - Test passes sometimes, fails sometimes
6
+ - Failure not related to code changes
7
+ - Tests fail in CI but pass locally (or vice versa)
8
+ - Failures cluster around certain times or conditions
9
+
10
+ ## Common Causes
11
+
12
+ ### Race Conditions
13
+ - Async operations not properly awaited
14
+ - Shared mutable state
15
+ - Timing-dependent assertions
16
+
17
+ ### Test Isolation Issues
18
+ - Tests modifying shared state
19
+ - Order-dependent tests
20
+ - Resource cleanup not happening
21
+
22
+ ### Environment Issues
23
+ - Resource exhaustion
24
+ - Network timing
25
+ - External service availability
26
+
27
+ ## Investigation Steps
28
+
29
+ ### 1. Gather Information
30
+
31
+ ```bash
32
+ # Run the test multiple times
33
+ npm test -- --testNamePattern="test name" --runInBand --detectOpenHandles
34
+
35
+ # Run with verbose output
36
+ npm test -- --verbose --testNamePattern="test name"
37
+
38
+ # Check test isolation
39
+ npm test -- --testNamePattern="test name" --runInBand
40
+ ```
41
+
42
+ ### 2. Check for Race Conditions
43
+
44
+ - Look for unawaited promises
45
+ - Check for setTimeout/setInterval usage
46
+ - Review async/await usage
47
+ - Look for shared mutable state
48
+
49
+ ### 3. Check Test Isolation
50
+
51
+ - Verify beforeEach/afterEach cleanup
52
+ - Check for global state modifications
53
+ - Look for database/file side effects
54
+ - Verify mock reset
55
+
56
+ ### 4. Check Environment
57
+
58
+ - Review resource usage
59
+ - Check CI configuration
60
+ - Verify external service mocks
61
+ - Review timeout settings
62
+
63
+ ## Resolution Strategies
64
+
65
+ ### Fix the Root Cause
66
+
67
+ ```typescript
68
+ // Bad: Race condition
69
+ it('should work', () => {
70
+ doSomethingAsync();
71
+ expect(result).toBe('expected'); // Too early!
72
+ });
73
+
74
+ // Good: Properly await
75
+ it('should work', async () => {
76
+ await doSomethingAsync();
77
+ expect(result).toBe('expected');
78
+ });
79
+ ```
80
+
81
+ ### Improve Test Isolation
82
+
83
+ ```typescript
84
+ // Ensure cleanup
85
+ afterEach(() => {
86
+ jest.clearAllMocks();
87
+ // Reset any global state
88
+ });
89
+ ```
90
+
91
+ ### Add Retries (Last Resort)
92
+
93
+ ```typescript
94
+ // jest.config.js
95
+ module.exports = {
96
+ testRetry: {
97
+ maxRetries: 3,
98
+ retryDelay: 1000,
99
+ },
100
+ };
101
+ ```
102
+
103
+ ## Prevention
104
+
105
+ - Always properly await async operations
106
+ - Clean up in afterEach hooks
107
+ - Avoid shared mutable state
108
+ - Use deterministic test data
109
+ - Mock external services completely
110
+
111
+ ## Escalation
112
+
113
+ If unable to resolve:
114
+
115
+ 1. Add to flaky test registry
116
+ 2. Create issue with investigation notes
117
+ 3. Tag with `flaky-test` label
118
+ 4. Assign to CI Analyst
119
+
120
+ ## Quick Reference
121
+
122
+ | Symptom | Likely Cause | Quick Fix |
123
+ |---------|--------------|-----------|
124
+ | Random assertion failures | Race condition | Add await |
125
+ | State leaks between tests | Poor isolation | Add cleanup |
126
+ | CI-only failures | Environment | Check resources |
127
+ | Timeout failures | Slow operations | Increase timeout |