liteagents 2.4.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 (215) hide show
  1. package/CHANGELOG.md +441 -0
  2. package/LICENSE +21 -0
  3. package/README.md +179 -0
  4. package/cli.js +230 -0
  5. package/docs/.gitkeep +1 -0
  6. package/docs/CONTRIBUTING.md +739 -0
  7. package/docs/DUAL_PUBLISH_SUMMARY.md +177 -0
  8. package/docs/ERROR_HANDLING_IMPLEMENTATION.md +327 -0
  9. package/docs/GITHUB_PACKAGES.md +181 -0
  10. package/docs/GITHUB_SETUP.md +158 -0
  11. package/docs/INSTALLATION_DEMO.md +691 -0
  12. package/docs/INSTALLATION_LOCATIONS.md +299 -0
  13. package/docs/INSTALLER_GUIDE.md +1586 -0
  14. package/docs/INTEGRATION_ISSUES_9.1.md +341 -0
  15. package/docs/KNOWLEDGE_BASE.md +727 -0
  16. package/docs/MIGRATION.md +384 -0
  17. package/docs/PACKAGE_BASELINE.md +557 -0
  18. package/docs/PACKAGE_VALIDATION_REPORT.md +427 -0
  19. package/docs/PASS_INTEGRATION.md +307 -0
  20. package/docs/PASS_QUICK_START.md +150 -0
  21. package/docs/PRIVACY.md +203 -0
  22. package/docs/PUBLISHING.md +494 -0
  23. package/docs/QUICK-START.md +318 -0
  24. package/docs/RELEASE_NOTES_1.2.0.md +323 -0
  25. package/docs/SECURITY.md +317 -0
  26. package/docs/SILENT_MODE_GUIDE.md +526 -0
  27. package/docs/SKILLS_CONVERSION.md +154 -0
  28. package/docs/TESTING.md +582 -0
  29. package/docs/TEST_COVERAGE.md +347 -0
  30. package/docs/TROUBLESHOOTING.md +788 -0
  31. package/docs/UPDATED_VARIANT_CONFIGURATION.md +274 -0
  32. package/docs/VARIANT_CONFIGURATION.md +440 -0
  33. package/installer/cli.js +761 -0
  34. package/installer/installation-engine.js +1536 -0
  35. package/installer/package-manager.js +640 -0
  36. package/installer/path-manager.js +427 -0
  37. package/installer/report-template.js +298 -0
  38. package/installer/verification-system.js +274 -0
  39. package/package.json +83 -0
  40. package/packages/ampcode/AGENT.md +58 -0
  41. package/packages/ampcode/README.md +17 -0
  42. package/packages/ampcode/agents/1-create-prd.md +175 -0
  43. package/packages/ampcode/agents/2-generate-tasks.md +190 -0
  44. package/packages/ampcode/agents/3-process-task-list.md +225 -0
  45. package/packages/ampcode/agents/code-developer.md +198 -0
  46. package/packages/ampcode/agents/context-builder.md +142 -0
  47. package/packages/ampcode/agents/feature-planner.md +199 -0
  48. package/packages/ampcode/agents/market-researcher.md +89 -0
  49. package/packages/ampcode/agents/orchestrator.md +116 -0
  50. package/packages/ampcode/agents/quality-assurance.md +115 -0
  51. package/packages/ampcode/agents/system-architect.md +135 -0
  52. package/packages/ampcode/agents/ui-designer.md +184 -0
  53. package/packages/ampcode/commands/brainstorming.md +56 -0
  54. package/packages/ampcode/commands/code-review.md +107 -0
  55. package/packages/ampcode/commands/condition-based-waiting/example.ts +158 -0
  56. package/packages/ampcode/commands/condition-based-waiting.md +122 -0
  57. package/packages/ampcode/commands/debug.md +20 -0
  58. package/packages/ampcode/commands/docs-builder/templates.md +572 -0
  59. package/packages/ampcode/commands/docs-builder.md +106 -0
  60. package/packages/ampcode/commands/explain.md +18 -0
  61. package/packages/ampcode/commands/git-commit.md +14 -0
  62. package/packages/ampcode/commands/optimize.md +20 -0
  63. package/packages/ampcode/commands/refactor.md +21 -0
  64. package/packages/ampcode/commands/review.md +18 -0
  65. package/packages/ampcode/commands/root-cause-tracing/find-polluter.sh +63 -0
  66. package/packages/ampcode/commands/root-cause-tracing.md +176 -0
  67. package/packages/ampcode/commands/security.md +21 -0
  68. package/packages/ampcode/commands/ship.md +18 -0
  69. package/packages/ampcode/commands/skill-creator/scripts/init_skill.py +303 -0
  70. package/packages/ampcode/commands/skill-creator/scripts/package_skill.py +110 -0
  71. package/packages/ampcode/commands/skill-creator/scripts/quick_validate.py +65 -0
  72. package/packages/ampcode/commands/skill-creator.md +211 -0
  73. package/packages/ampcode/commands/stash.md +45 -0
  74. package/packages/ampcode/commands/systematic-debugging.md +297 -0
  75. package/packages/ampcode/commands/test-driven-development.md +390 -0
  76. package/packages/ampcode/commands/test-generate.md +18 -0
  77. package/packages/ampcode/commands/testing-anti-patterns.md +304 -0
  78. package/packages/ampcode/commands/verification-before-completion.md +152 -0
  79. package/packages/ampcode/settings.json +13 -0
  80. package/packages/ampcode/variants.json +8 -0
  81. package/packages/claude/CLAUDE.md +58 -0
  82. package/packages/claude/README.md +23 -0
  83. package/packages/claude/agents/1-create-prd.md +175 -0
  84. package/packages/claude/agents/2-generate-tasks.md +190 -0
  85. package/packages/claude/agents/3-process-task-list.md +225 -0
  86. package/packages/claude/agents/code-developer.md +198 -0
  87. package/packages/claude/agents/context-builder.md +142 -0
  88. package/packages/claude/agents/feature-planner.md +199 -0
  89. package/packages/claude/agents/market-researcher.md +89 -0
  90. package/packages/claude/agents/orchestrator.md +117 -0
  91. package/packages/claude/agents/quality-assurance.md +115 -0
  92. package/packages/claude/agents/system-architect.md +135 -0
  93. package/packages/claude/agents/ui-designer.md +184 -0
  94. package/packages/claude/commands/debug.md +20 -0
  95. package/packages/claude/commands/explain.md +18 -0
  96. package/packages/claude/commands/git-commit.md +14 -0
  97. package/packages/claude/commands/optimize.md +20 -0
  98. package/packages/claude/commands/refactor.md +21 -0
  99. package/packages/claude/commands/review.md +18 -0
  100. package/packages/claude/commands/security.md +21 -0
  101. package/packages/claude/commands/ship.md +18 -0
  102. package/packages/claude/commands/stash.md +45 -0
  103. package/packages/claude/commands/test-generate.md +18 -0
  104. package/packages/claude/skills/brainstorming/SKILL.md +56 -0
  105. package/packages/claude/skills/code-review/SKILL.md +107 -0
  106. package/packages/claude/skills/code-review/code-reviewer.md +146 -0
  107. package/packages/claude/skills/condition-based-waiting/SKILL.md +122 -0
  108. package/packages/claude/skills/condition-based-waiting/example.ts +158 -0
  109. package/packages/claude/skills/docs-builder/SKILL.md +106 -0
  110. package/packages/claude/skills/docs-builder/references/templates.md +572 -0
  111. package/packages/claude/skills/root-cause-tracing/SKILL.md +176 -0
  112. package/packages/claude/skills/root-cause-tracing/find-polluter.sh +63 -0
  113. package/packages/claude/skills/skill-creator/LICENSE.txt +202 -0
  114. package/packages/claude/skills/skill-creator/SKILL.md +211 -0
  115. package/packages/claude/skills/skill-creator/scripts/init_skill.py +303 -0
  116. package/packages/claude/skills/skill-creator/scripts/package_skill.py +110 -0
  117. package/packages/claude/skills/skill-creator/scripts/quick_validate.py +65 -0
  118. package/packages/claude/skills/systematic-debugging/CREATION-LOG.md +119 -0
  119. package/packages/claude/skills/systematic-debugging/SKILL.md +296 -0
  120. package/packages/claude/skills/systematic-debugging/test-academic.md +14 -0
  121. package/packages/claude/skills/systematic-debugging/test-pressure-1.md +58 -0
  122. package/packages/claude/skills/systematic-debugging/test-pressure-2.md +68 -0
  123. package/packages/claude/skills/systematic-debugging/test-pressure-3.md +69 -0
  124. package/packages/claude/skills/test-driven-development/SKILL.md +392 -0
  125. package/packages/claude/skills/testing-anti-patterns/SKILL.md +304 -0
  126. package/packages/claude/skills/verification-before-completion/SKILL.md +152 -0
  127. package/packages/claude/variants.json +9 -0
  128. package/packages/droid/AGENTS.md +52 -0
  129. package/packages/droid/README.md +17 -0
  130. package/packages/droid/change_settings.json +61 -0
  131. package/packages/droid/commands/brainstorming.md +56 -0
  132. package/packages/droid/commands/code-review.md +107 -0
  133. package/packages/droid/commands/condition-based-waiting/example.ts +158 -0
  134. package/packages/droid/commands/condition-based-waiting.md +122 -0
  135. package/packages/droid/commands/debug.md +20 -0
  136. package/packages/droid/commands/docs-builder/templates.md +572 -0
  137. package/packages/droid/commands/docs-builder.md +106 -0
  138. package/packages/droid/commands/explain.md +18 -0
  139. package/packages/droid/commands/git-commit.md +14 -0
  140. package/packages/droid/commands/optimize.md +20 -0
  141. package/packages/droid/commands/refactor.md +21 -0
  142. package/packages/droid/commands/review.md +18 -0
  143. package/packages/droid/commands/root-cause-tracing/find-polluter.sh +63 -0
  144. package/packages/droid/commands/root-cause-tracing.md +176 -0
  145. package/packages/droid/commands/security.md +21 -0
  146. package/packages/droid/commands/ship.md +18 -0
  147. package/packages/droid/commands/skill-creator/scripts/init_skill.py +303 -0
  148. package/packages/droid/commands/skill-creator/scripts/package_skill.py +110 -0
  149. package/packages/droid/commands/skill-creator/scripts/quick_validate.py +65 -0
  150. package/packages/droid/commands/skill-creator.md +211 -0
  151. package/packages/droid/commands/stash.md +45 -0
  152. package/packages/droid/commands/systematic-debugging.md +297 -0
  153. package/packages/droid/commands/test-driven-development.md +390 -0
  154. package/packages/droid/commands/test-generate.md +18 -0
  155. package/packages/droid/commands/testing-anti-patterns.md +304 -0
  156. package/packages/droid/commands/verification-before-completion.md +152 -0
  157. package/packages/droid/droids/1-create-prd.md +170 -0
  158. package/packages/droid/droids/2-generate-tasks.md +190 -0
  159. package/packages/droid/droids/3-process-task-list.md +225 -0
  160. package/packages/droid/droids/code-developer.md +198 -0
  161. package/packages/droid/droids/context-builder.md +142 -0
  162. package/packages/droid/droids/feature-planner.md +199 -0
  163. package/packages/droid/droids/market-researcher.md +89 -0
  164. package/packages/droid/droids/orchestrator.md +116 -0
  165. package/packages/droid/droids/quality-assurance.md +115 -0
  166. package/packages/droid/droids/system-architect.md +135 -0
  167. package/packages/droid/droids/ui-designer.md +184 -0
  168. package/packages/droid/variants.json +8 -0
  169. package/packages/opencode/AGENTS.md +52 -0
  170. package/packages/opencode/README.md +17 -0
  171. package/packages/opencode/agent/1-create-prd.md +179 -0
  172. package/packages/opencode/agent/2-generate-tasks.md +194 -0
  173. package/packages/opencode/agent/3-process-task-list.md +229 -0
  174. package/packages/opencode/agent/code-developer.md +202 -0
  175. package/packages/opencode/agent/context-builder.md +146 -0
  176. package/packages/opencode/agent/feature-planner.md +203 -0
  177. package/packages/opencode/agent/market-researcher.md +93 -0
  178. package/packages/opencode/agent/orchestrator.md +120 -0
  179. package/packages/opencode/agent/quality-assurance.md +119 -0
  180. package/packages/opencode/agent/system-architect.md +139 -0
  181. package/packages/opencode/agent/ui-designer.md +188 -0
  182. package/packages/opencode/command/brainstorming.md +56 -0
  183. package/packages/opencode/command/code-review.md +107 -0
  184. package/packages/opencode/command/condition-based-waiting/example.ts +158 -0
  185. package/packages/opencode/command/condition-based-waiting.md +122 -0
  186. package/packages/opencode/command/debug.md +20 -0
  187. package/packages/opencode/command/docs-builder/templates.md +572 -0
  188. package/packages/opencode/command/docs-builder.md +106 -0
  189. package/packages/opencode/command/explain.md +18 -0
  190. package/packages/opencode/command/git-commit.md +14 -0
  191. package/packages/opencode/command/optimize.md +20 -0
  192. package/packages/opencode/command/refactor.md +21 -0
  193. package/packages/opencode/command/review.md +18 -0
  194. package/packages/opencode/command/root-cause-tracing/find-polluter.sh +63 -0
  195. package/packages/opencode/command/root-cause-tracing.md +176 -0
  196. package/packages/opencode/command/security.md +21 -0
  197. package/packages/opencode/command/ship.md +18 -0
  198. package/packages/opencode/command/skill-creator/scripts/init_skill.py +303 -0
  199. package/packages/opencode/command/skill-creator/scripts/package_skill.py +110 -0
  200. package/packages/opencode/command/skill-creator/scripts/quick_validate.py +65 -0
  201. package/packages/opencode/command/skill-creator.md +211 -0
  202. package/packages/opencode/command/stash.md +45 -0
  203. package/packages/opencode/command/systematic-debugging.md +297 -0
  204. package/packages/opencode/command/test-driven-development.md +390 -0
  205. package/packages/opencode/command/test-generate.md +18 -0
  206. package/packages/opencode/command/testing-anti-patterns.md +304 -0
  207. package/packages/opencode/command/verification-before-completion.md +152 -0
  208. package/packages/opencode/opencode.jsonc +201 -0
  209. package/packages/opencode/variants.json +8 -0
  210. package/packages/subagentic-manual.md +349 -0
  211. package/postinstall.js +21 -0
  212. package/tools/ampcode/manifest-template.json +14 -0
  213. package/tools/claude/manifest-template.json +14 -0
  214. package/tools/droid/manifest-template.json +14 -0
  215. package/tools/opencode/manifest-template.json +14 -0
@@ -0,0 +1,582 @@
1
+ # Testing Documentation
2
+
3
+ Comprehensive testing guide for the Agentic Kit Interactive Multi-Tool Installer.
4
+
5
+ ## Table of Contents
6
+
7
+ 1. [Overview](#overview)
8
+ 2. [Test Suites](#test-suites)
9
+ 3. [Running Tests](#running-tests)
10
+ 4. [Test Reports](#test-reports)
11
+ 5. [CI/CD Integration](#cicd-integration)
12
+ 6. [Troubleshooting](#troubleshooting)
13
+
14
+ ---
15
+
16
+ ## Overview
17
+
18
+ The Agentic Kit installer includes a comprehensive test suite covering:
19
+ - ✅ Variant installation (Lite, Standard, Pro)
20
+ - ✅ Multi-tool installations (Claude, Opencode, Ampcode, Droid)
21
+ - ✅ Error handling and rollback
22
+ - ✅ Path validation and expansion
23
+ - ✅ Cross-platform compatibility (Linux tested, macOS/Windows documented)
24
+
25
+ **Total Test Coverage**: 348 tests with 99.1% pass rate
26
+
27
+ ---
28
+
29
+ ## Test Suites
30
+
31
+ ### 1. Variant Testing (92 tests)
32
+
33
+ **File**: `tests/installer/variant-testing.test.js`
34
+
35
+ **Purpose**: Tests all variants (Lite, Standard, Pro) for all 4 tools (Claude, Opencode, Ampcode, Droid)
36
+
37
+ **Coverage**:
38
+ - Component count verification (agents, skills, resources, hooks)
39
+ - Manifest generation and validation
40
+ - File structure verification
41
+ - Cleanup and isolation
42
+
43
+ **Run individually**:
44
+ ```bash
45
+ node tests/installer/variant-testing.test.js
46
+ ```
47
+
48
+ **Expected Results**:
49
+ - LITE: 4 agents, 7 skills, 6 resources, 2 hooks
50
+ - STANDARD: 9 agents, 11 skills, 6 resources, 2 hooks
51
+ - PRO: 13 agents, 22 skills, 6 resources, 2 hooks
52
+
53
+ ---
54
+
55
+ ### 2. Multi-Tool Installation (78 tests)
56
+
57
+ **File**: `tests/installer/multi-tool-testing.test.js`
58
+
59
+ **Purpose**: Tests simultaneous installation of multiple tools
60
+
61
+ **Coverage**:
62
+ - 2-tool combinations (Claude + Opencode)
63
+ - 4-tool combinations (all tools simultaneously)
64
+ - Mixed variants (Claude Standard + Droid Pro)
65
+ - Tool isolation (no file conflicts)
66
+ - Correct paths for each tool
67
+ - Individual manifest per tool
68
+
69
+ **Run individually**:
70
+ ```bash
71
+ node tests/installer/multi-tool-testing.test.js
72
+ ```
73
+
74
+ **Test Scenarios**:
75
+ 1. Claude + Opencode (Standard)
76
+ 2. All 4 tools (Standard)
77
+ 3. Claude Standard + Droid Pro (mixed)
78
+ 4. All 4 tools (mixed variants)
79
+ 5. All 4 tools (Lite)
80
+ 6. All 4 tools (Pro)
81
+
82
+ ---
83
+
84
+ ### 3. Error Scenario Testing (36 tests)
85
+
86
+ **File**: `tests/installer/error-scenario-testing.test.js`
87
+
88
+ **Purpose**: Tests error handling, validation, and rollback
89
+
90
+ **Coverage**:
91
+ - Corrupted variants.json parsing
92
+ - Missing package files detection
93
+ - Permission denied handling
94
+ - Partial installation rollback
95
+ - Disk space validation
96
+ - Path security (traversal prevention)
97
+ - Interrupted installation recovery
98
+
99
+ **Run individually**:
100
+ ```bash
101
+ node tests/installer/error-scenario-testing.test.js
102
+ ```
103
+
104
+ **Known Limitations**:
105
+ - 1 expected failure: Permission denied test (running as root bypasses read-only)
106
+
107
+ ---
108
+
109
+ ### 4. Path Handling Testing (76 tests)
110
+
111
+ **File**: `tests/installer/path-handling-testing.test.js`
112
+
113
+ **Purpose**: Tests path validation, expansion, conversion, and edge cases
114
+
115
+ **Coverage**:
116
+ - Tilde expansion (`~` to home directory)
117
+ - Custom path validation
118
+ - Relative to absolute path conversion
119
+ - Paths with spaces
120
+ - Paths with special characters
121
+ - Existing installation overwrite with backup
122
+ - Permission validation
123
+
124
+ **Run individually**:
125
+ ```bash
126
+ node tests/installer/path-handling-testing.test.js
127
+ ```
128
+
129
+ **Features Tested**:
130
+ - `~/.agentic-kit` → `/home/user/.agentic-kit`
131
+ - `./local` → `/current/directory/local`
132
+ - Path traversal prevention (`../../../etc/passwd` rejected)
133
+ - Unicode support (émoji, 中文, العربية)
134
+ - Backup creation with timestamp
135
+ - Rollback capability
136
+
137
+ ---
138
+
139
+ ### 5. Cross-Platform Testing (66 tests)
140
+
141
+ **File**: `tests/installer/cross-platform-testing.test.js`
142
+
143
+ **Purpose**: Tests platform-specific behaviors and compatibility
144
+
145
+ **Coverage (Linux)**:
146
+ - Path handling (forward slashes, case-sensitive)
147
+ - File operations (symlinks, hard links, hidden files)
148
+ - Permissions (chmod, read/write checks)
149
+ - ANSI color codes (8 colors, 4 backgrounds, 4 styles)
150
+ - Progress bar rendering (block characters, spinner)
151
+ - Terminal compatibility (dimensions, cursor codes)
152
+
153
+ **Run individually**:
154
+ ```bash
155
+ node tests/installer/cross-platform-testing.test.js
156
+ ```
157
+
158
+ **Platforms**:
159
+ - ✅ **Linux**: Fully tested (66 tests, 97% pass rate)
160
+ - 📝 **macOS**: Requirements documented
161
+ - 📝 **Windows**: Requirements documented
162
+
163
+ **Known Limitations**:
164
+ - 2 expected failures: TERM not set, stdout not TTY (Docker/CI environment)
165
+
166
+ ---
167
+
168
+ ## Running Tests
169
+
170
+ ### Run All Tests
171
+
172
+ Execute the unified test runner:
173
+
174
+ ```bash
175
+ npm test
176
+ ```
177
+
178
+ or
179
+
180
+ ```bash
181
+ node tests/run-all-tests.js
182
+ ```
183
+
184
+ **Output**:
185
+ - Console output with color-coded results
186
+ - JSON report: `test-report.json`
187
+ - Markdown report: `TEST_REPORT.md`
188
+
189
+ **Expected Duration**: ~6-7 seconds
190
+
191
+ **Expected Results**:
192
+ ```
193
+ Total Tests: 348
194
+ Passed: 345 (99.1%)
195
+ Failed: 3 (expected failures in Docker/CI)
196
+ ```
197
+
198
+ ### Run Individual Test Suite
199
+
200
+ ```bash
201
+ # Variant testing
202
+ node tests/installer/variant-testing.test.js
203
+
204
+ # Multi-tool testing
205
+ node tests/installer/multi-tool-testing.test.js
206
+
207
+ # Error scenario testing
208
+ node tests/installer/error-scenario-testing.test.js
209
+
210
+ # Path handling testing
211
+ node tests/installer/path-handling-testing.test.js
212
+
213
+ # Cross-platform testing
214
+ node tests/installer/cross-platform-testing.test.js
215
+ ```
216
+
217
+ ### Run Specific Tests
218
+
219
+ Each test file can be run independently. They are self-contained with their own result tracking.
220
+
221
+ ---
222
+
223
+ ## Test Reports
224
+
225
+ ### JSON Report (`test-report.json`)
226
+
227
+ Machine-readable format for CI/CD integration:
228
+
229
+ ```json
230
+ {
231
+ "timestamp": "2025-11-05T09:39:11.895Z",
232
+ "summary": {
233
+ "totalTests": 348,
234
+ "totalPassed": 345,
235
+ "totalFailed": 3,
236
+ "passRate": "99.1",
237
+ "duration": 6381
238
+ },
239
+ "suites": [...]
240
+ }
241
+ ```
242
+
243
+ **Use Cases**:
244
+ - CI/CD parsing
245
+ - Automated reporting
246
+ - Trend analysis
247
+ - Quality gates
248
+
249
+ ### Markdown Report (`TEST_REPORT.md`)
250
+
251
+ Human-readable format with tables and formatting:
252
+
253
+ - Summary table
254
+ - Per-suite breakdown
255
+ - Pass/fail indicators
256
+ - Duration metrics
257
+ - Final status
258
+
259
+ **Use Cases**:
260
+ - Pull request comments
261
+ - Documentation
262
+ - Team sharing
263
+ - Status updates
264
+
265
+ ### Console Output
266
+
267
+ Real-time colored output with:
268
+ - Suite-by-suite progress
269
+ - Individual test results
270
+ - Summary statistics
271
+ - Visual indicators (✓, ✗, ⚠️)
272
+
273
+ ---
274
+
275
+ ## CI/CD Integration
276
+
277
+ ### GitHub Actions
278
+
279
+ **Example `.github/workflows/test.yml`**:
280
+
281
+ ```yaml
282
+ name: Test Installer
283
+
284
+ on: [push, pull_request]
285
+
286
+ jobs:
287
+ test:
288
+ runs-on: ubuntu-latest
289
+
290
+ steps:
291
+ - uses: actions/checkout@v3
292
+
293
+ - name: Setup Node.js
294
+ uses: actions/setup-node@v3
295
+ with:
296
+ node-version: '18'
297
+
298
+ - name: Install dependencies
299
+ run: npm install
300
+
301
+ - name: Run tests
302
+ run: npm test
303
+
304
+ - name: Upload test report
305
+ if: always()
306
+ uses: actions/upload-artifact@v3
307
+ with:
308
+ name: test-report
309
+ path: |
310
+ test-report.json
311
+ TEST_REPORT.md
312
+ ```
313
+
314
+ ### Exit Codes
315
+
316
+ The test runner exits with appropriate codes for CI/CD:
317
+ - `0`: All tests passed
318
+ - `1`: One or more tests failed
319
+
320
+ ### Quality Gates
321
+
322
+ Recommended quality gates:
323
+ - **Minimum Pass Rate**: 95%
324
+ - **Maximum Duration**: 30 seconds
325
+ - **Critical Failures**: 0 (non-Docker environment)
326
+
327
+ ---
328
+
329
+ ## Troubleshooting
330
+
331
+ ### Common Issues
332
+
333
+ #### 1. Permission Denied Tests Fail
334
+
335
+ **Symptom**: Permission denied test shows unexpected pass/fail
336
+
337
+ **Cause**: Running as root user (Docker, CI)
338
+
339
+ **Solution**: Expected behavior. Root can bypass read-only permissions.
340
+
341
+ **Impact**: None - installer works correctly
342
+
343
+ ---
344
+
345
+ #### 2. TERM Environment Variable Not Set
346
+
347
+ **Symptom**: Terminal compatibility tests fail
348
+
349
+ **Cause**: Docker/CI environment without TTY
350
+
351
+ **Solution**: Expected behavior in non-interactive environments
352
+
353
+ **Impact**: None - installer detects and adapts
354
+
355
+ ---
356
+
357
+ #### 3. Tests Run Slowly
358
+
359
+ **Symptom**: Tests take longer than expected
360
+
361
+ **Possible Causes**:
362
+ - Slow file system
363
+ - Resource constraints
364
+ - Network issues (shouldn't happen - all local)
365
+
366
+ **Solution**:
367
+ - Check system resources
368
+ - Run individual suites to isolate
369
+ - Verify no background processes
370
+
371
+ **Expected Duration**: 6-7 seconds for all tests
372
+
373
+ ---
374
+
375
+ #### 4. Temp Directory Cleanup Failures
376
+
377
+ **Symptom**: Temp directories not cleaned up
378
+
379
+ **Possible Causes**:
380
+ - Permission issues
381
+ - Open file handles
382
+ - Interrupted tests
383
+
384
+ **Solution**:
385
+ ```bash
386
+ # Manual cleanup
387
+ rm -rf /tmp/agentic-kit-test-*
388
+ rm -rf /tmp/variant-test-*
389
+ rm -rf /tmp/multi-tool-test-*
390
+ rm -rf /tmp/error-test-*
391
+ rm -rf /tmp/path-test-*
392
+ rm -rf /tmp/cross-platform-*
393
+ ```
394
+
395
+ ---
396
+
397
+ #### 5. File Count Mismatches
398
+
399
+ **Symptom**: Variant tests fail with incorrect counts
400
+
401
+ **Cause**: Variant configuration changed
402
+
403
+ **Solution**:
404
+ 1. Check `packages/*/variants.json`
405
+ 2. Update expected counts in test files
406
+ 3. Verify package structure matches configuration
407
+
408
+ **Expected Counts**:
409
+ - LITE: 4 agents, 7 skills
410
+ - STANDARD: 9 agents, 11 skills
411
+ - PRO: 13 agents, 22 skills
412
+
413
+ ---
414
+
415
+ ## Test Fixtures
416
+
417
+ ### Location
418
+
419
+ `tests/fixtures/`
420
+
421
+ ### Contents
422
+
423
+ - **variants/**: Sample variants.json files (lite, standard, pro, corrupted, minimal)
424
+ - **packages/**: Mock package structures with complete file hierarchies
425
+ - **manifests/**: Template manifest files
426
+ - **helpers/**: Test utility functions (18 helpers)
427
+
428
+ ### Using Fixtures
429
+
430
+ ```javascript
431
+ const { createTempDir, removeDirRecursive, loadJsonFixture } =
432
+ require('./fixtures/helpers/test-helpers');
433
+
434
+ // Create temp directory
435
+ const testDir = createTempDir('my-test-');
436
+
437
+ // Load fixture
438
+ const variants = loadJsonFixture('variants/variants-standard.json');
439
+
440
+ // Cleanup
441
+ removeDirRecursive(testDir);
442
+ ```
443
+
444
+ See `tests/fixtures/README.md` for complete documentation.
445
+
446
+ ---
447
+
448
+ ## Writing New Tests
449
+
450
+ ### Template
451
+
452
+ ```javascript
453
+ #!/usr/bin/env node
454
+
455
+ const fs = require('fs');
456
+ const path = require('path');
457
+ const { createTempDir, removeDirRecursive } =
458
+ require('../fixtures/helpers/test-helpers');
459
+
460
+ // Test results tracker
461
+ const results = {
462
+ passed: 0,
463
+ failed: 0,
464
+ tests: []
465
+ };
466
+
467
+ function logTest(testName, passed, message = '') {
468
+ const status = passed ? '✓' : '✗';
469
+ const color = passed ? '\x1b[32m' : '\x1b[31m';
470
+ console.log(`${color}${status}\x1b[0m ${testName}${message ? ': ' + message : ''}`);
471
+
472
+ results.tests.push({ name: testName, passed, message });
473
+ if (passed) {
474
+ results.passed++;
475
+ } else {
476
+ results.failed++;
477
+ }
478
+ }
479
+
480
+ function testMyFeature() {
481
+ const testDir = createTempDir('my-test-');
482
+
483
+ try {
484
+ // Test code here
485
+ logTest('My test', true, 'Success message');
486
+
487
+ removeDirRecursive(testDir);
488
+ } catch (error) {
489
+ logTest('My test', false, error.message);
490
+ if (fs.existsSync(testDir)) removeDirRecursive(testDir);
491
+ }
492
+ }
493
+
494
+ function runAllTests() {
495
+ console.log('Running My Test Suite...\n');
496
+
497
+ testMyFeature();
498
+
499
+ // Print summary
500
+ const total = results.passed + results.failed;
501
+ console.log(`\nTotal: ${total} | Passed: ${results.passed} | Failed: ${results.failed}`);
502
+
503
+ process.exit(results.failed > 0 ? 1 : 0);
504
+ }
505
+
506
+ if (require.main === module) {
507
+ runAllTests();
508
+ }
509
+
510
+ module.exports = { testMyFeature, runAllTests };
511
+ ```
512
+
513
+ ### Best Practices
514
+
515
+ 1. **Use Temp Directories**: Always create unique temp dirs for test isolation
516
+ 2. **Always Cleanup**: Use try/catch to ensure cleanup runs
517
+ 3. **Clear Test Names**: Make test names descriptive and specific
518
+ 4. **Exit Codes**: Exit with 1 on failure, 0 on success
519
+ 5. **Color Coding**: Use ANSI colors for better readability
520
+ 6. **Fixtures**: Reuse fixtures instead of creating test data
521
+ 7. **Isolation**: Don't depend on other tests or external state
522
+ 8. **Documentation**: Document expected behavior and limitations
523
+
524
+ ---
525
+
526
+ ## Performance Benchmarks
527
+
528
+ Based on actual test runs:
529
+
530
+ | Test Suite | Tests | Duration | Avg per Test |
531
+ |------------|-------|----------|--------------|
532
+ | Variant Testing | 92 | 2.3s | 25ms |
533
+ | Multi-Tool Installation | 78 | 3.8s | 48ms |
534
+ | Error Scenario Testing | 36 | 0.2s | 6ms |
535
+ | Path Handling Testing | 76 | 0.1s | 1ms |
536
+ | Cross-Platform Testing | 66 | 0.1s | 2ms |
537
+ | **Total** | **348** | **6.4s** | **18ms** |
538
+
539
+ **Target**: All tests should complete in < 10 seconds
540
+
541
+ ---
542
+
543
+ ## Continuous Improvement
544
+
545
+ ### Adding New Tests
546
+
547
+ When adding new features:
548
+
549
+ 1. **Write tests first** (TDD approach)
550
+ 2. **Add to appropriate test suite** or create new one
551
+ 3. **Update expected counts** in unified test runner
552
+ 4. **Document in this file**
553
+ 5. **Run all tests** to ensure no regression
554
+ 6. **Update reports** and documentation
555
+
556
+ ### Reviewing Test Coverage
557
+
558
+ Periodically review:
559
+ - [ ] Are all features tested?
560
+ - [ ] Are error paths covered?
561
+ - [ ] Are edge cases handled?
562
+ - [ ] Are platform differences documented?
563
+ - [ ] Are tests fast enough?
564
+ - [ ] Are tests reliable (no flakiness)?
565
+
566
+ ---
567
+
568
+ ## Support
569
+
570
+ For questions or issues:
571
+
572
+ 1. Check this documentation
573
+ 2. Review test output and reports
574
+ 3. Check fixture documentation (`tests/fixtures/README.md`)
575
+ 4. Review individual test files for examples
576
+ 5. Open an issue on GitHub
577
+
578
+ ---
579
+
580
+ **Last Updated**: 2025-11-05
581
+ **Test Suite Version**: 1.2.0
582
+ **Coverage**: 348 tests, 99.1% pass rate