@oalacea/daemon 0.5.0 → 0.6.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 (222) hide show
  1. package/LICENSE +23 -23
  2. package/README.md +147 -141
  3. package/bin/Dockerfile +75 -74
  4. package/dist/cli/cli.d.ts +42 -0
  5. package/dist/cli/cli.d.ts.map +1 -0
  6. package/dist/cli/cli.js +89 -0
  7. package/dist/cli/cli.js.map +1 -0
  8. package/dist/cli/commands/detect.command.d.ts +39 -0
  9. package/dist/cli/commands/detect.command.d.ts.map +1 -0
  10. package/dist/cli/commands/detect.command.js +111 -0
  11. package/dist/cli/commands/detect.command.js.map +1 -0
  12. package/dist/cli/commands/index.d.ts +14 -0
  13. package/dist/cli/commands/index.d.ts.map +1 -0
  14. package/dist/cli/commands/index.js +11 -0
  15. package/dist/cli/commands/index.js.map +1 -0
  16. package/dist/cli/commands/init.command.d.ts +41 -0
  17. package/dist/cli/commands/init.command.d.ts.map +1 -0
  18. package/dist/cli/commands/init.command.js +111 -0
  19. package/dist/cli/commands/init.command.js.map +1 -0
  20. package/dist/cli/commands/test.command.d.ts +58 -0
  21. package/dist/cli/commands/test.command.d.ts.map +1 -0
  22. package/dist/cli/commands/test.command.js +180 -0
  23. package/dist/cli/commands/test.command.js.map +1 -0
  24. package/dist/cli/index.d.ts +8 -0
  25. package/dist/cli/index.d.ts.map +1 -0
  26. package/dist/cli/index.js +10 -0
  27. package/dist/cli/index.js.map +1 -0
  28. package/dist/core/config/daemon.config.d.ts +32 -0
  29. package/dist/core/config/daemon.config.d.ts.map +1 -0
  30. package/dist/core/config/daemon.config.js +83 -0
  31. package/dist/core/config/daemon.config.js.map +1 -0
  32. package/dist/core/config/index.d.ts +5 -0
  33. package/dist/core/config/index.d.ts.map +1 -0
  34. package/dist/core/config/index.js +5 -0
  35. package/dist/core/config/index.js.map +1 -0
  36. package/dist/core/constants.d.ts +36 -0
  37. package/dist/core/constants.d.ts.map +1 -0
  38. package/dist/core/constants.js +56 -0
  39. package/dist/core/constants.js.map +1 -0
  40. package/dist/core/types/common.types.d.ts +250 -0
  41. package/dist/core/types/common.types.d.ts.map +1 -0
  42. package/dist/core/types/common.types.js +7 -0
  43. package/dist/core/types/common.types.js.map +1 -0
  44. package/dist/core/types/detection.types.d.ts +232 -0
  45. package/dist/core/types/detection.types.d.ts.map +1 -0
  46. package/dist/core/types/detection.types.js +22 -0
  47. package/dist/core/types/detection.types.js.map +1 -0
  48. package/dist/core/types/docker.types.d.ts +322 -0
  49. package/dist/core/types/docker.types.d.ts.map +1 -0
  50. package/dist/core/types/docker.types.js +7 -0
  51. package/dist/core/types/docker.types.js.map +1 -0
  52. package/dist/core/types/index.d.ts +11 -0
  53. package/dist/core/types/index.d.ts.map +1 -0
  54. package/dist/core/types/index.js +7 -0
  55. package/dist/core/types/index.js.map +1 -0
  56. package/dist/core/types/project.types.d.ts +74 -0
  57. package/dist/core/types/project.types.d.ts.map +1 -0
  58. package/dist/core/types/project.types.js +7 -0
  59. package/dist/core/types/project.types.js.map +1 -0
  60. package/dist/core/types/shared.types.d.ts +118 -0
  61. package/dist/core/types/shared.types.d.ts.map +1 -0
  62. package/dist/core/types/shared.types.js +7 -0
  63. package/dist/core/types/shared.types.js.map +1 -0
  64. package/dist/core/types/test.types.d.ts +230 -0
  65. package/dist/core/types/test.types.d.ts.map +1 -0
  66. package/dist/core/types/test.types.js +7 -0
  67. package/dist/core/types/test.types.js.map +1 -0
  68. package/dist/services/detection/__tests__/framework-detector.test.d.ts +5 -0
  69. package/dist/services/detection/__tests__/framework-detector.test.d.ts.map +1 -0
  70. package/dist/services/detection/__tests__/framework-detector.test.js +52 -0
  71. package/dist/services/detection/__tests__/framework-detector.test.js.map +1 -0
  72. package/dist/services/detection/framework-detector.d.ts +179 -0
  73. package/dist/services/detection/framework-detector.d.ts.map +1 -0
  74. package/dist/services/detection/framework-detector.js +636 -0
  75. package/dist/services/detection/framework-detector.js.map +1 -0
  76. package/dist/services/detection/index.d.ts +10 -0
  77. package/dist/services/detection/index.d.ts.map +1 -0
  78. package/dist/services/detection/index.js +7 -0
  79. package/dist/services/detection/index.js.map +1 -0
  80. package/dist/services/docker/__tests__/docker-manager.test.d.ts +5 -0
  81. package/dist/services/docker/__tests__/docker-manager.test.d.ts.map +1 -0
  82. package/dist/services/docker/__tests__/docker-manager.test.js +67 -0
  83. package/dist/services/docker/__tests__/docker-manager.test.js.map +1 -0
  84. package/dist/services/docker/docker-manager.d.ts +157 -0
  85. package/dist/services/docker/docker-manager.d.ts.map +1 -0
  86. package/dist/services/docker/docker-manager.js +516 -0
  87. package/dist/services/docker/docker-manager.js.map +1 -0
  88. package/dist/services/docker/index.d.ts +9 -0
  89. package/dist/services/docker/index.d.ts.map +1 -0
  90. package/dist/services/docker/index.js +9 -0
  91. package/dist/services/docker/index.js.map +1 -0
  92. package/dist/services/index.d.ts +10 -0
  93. package/dist/services/index.d.ts.map +1 -0
  94. package/dist/services/index.js +8 -0
  95. package/dist/services/index.js.map +1 -0
  96. package/dist/shared/errors/__tests__/base.error.test.d.ts +5 -0
  97. package/dist/shared/errors/__tests__/base.error.test.d.ts.map +1 -0
  98. package/dist/shared/errors/__tests__/base.error.test.js +61 -0
  99. package/dist/shared/errors/__tests__/base.error.test.js.map +1 -0
  100. package/dist/shared/errors/__tests__/command.error.test.d.ts +5 -0
  101. package/dist/shared/errors/__tests__/command.error.test.d.ts.map +1 -0
  102. package/dist/shared/errors/__tests__/command.error.test.js +62 -0
  103. package/dist/shared/errors/__tests__/command.error.test.js.map +1 -0
  104. package/dist/shared/errors/__tests__/file.error.test.d.ts +5 -0
  105. package/dist/shared/errors/__tests__/file.error.test.d.ts.map +1 -0
  106. package/dist/shared/errors/__tests__/file.error.test.js +75 -0
  107. package/dist/shared/errors/__tests__/file.error.test.js.map +1 -0
  108. package/dist/shared/errors/__tests__/index.test.d.ts +5 -0
  109. package/dist/shared/errors/__tests__/index.test.d.ts.map +1 -0
  110. package/dist/shared/errors/__tests__/index.test.js +62 -0
  111. package/dist/shared/errors/__tests__/index.test.js.map +1 -0
  112. package/dist/shared/errors/__tests__/validation.error.test.d.ts +5 -0
  113. package/dist/shared/errors/__tests__/validation.error.test.d.ts.map +1 -0
  114. package/dist/shared/errors/__tests__/validation.error.test.js +79 -0
  115. package/dist/shared/errors/__tests__/validation.error.test.js.map +1 -0
  116. package/dist/shared/errors/base.error.d.ts +54 -0
  117. package/dist/shared/errors/base.error.d.ts.map +1 -0
  118. package/dist/shared/errors/base.error.js +85 -0
  119. package/dist/shared/errors/base.error.js.map +1 -0
  120. package/dist/shared/errors/command.error.d.ts +58 -0
  121. package/dist/shared/errors/command.error.d.ts.map +1 -0
  122. package/dist/shared/errors/command.error.js +102 -0
  123. package/dist/shared/errors/command.error.js.map +1 -0
  124. package/dist/shared/errors/detection.error.d.ts +42 -0
  125. package/dist/shared/errors/detection.error.d.ts.map +1 -0
  126. package/dist/shared/errors/detection.error.js +82 -0
  127. package/dist/shared/errors/detection.error.js.map +1 -0
  128. package/dist/shared/errors/docker.error.d.ts +142 -0
  129. package/dist/shared/errors/docker.error.d.ts.map +1 -0
  130. package/dist/shared/errors/docker.error.js +172 -0
  131. package/dist/shared/errors/docker.error.js.map +1 -0
  132. package/dist/shared/errors/file.error.d.ts +66 -0
  133. package/dist/shared/errors/file.error.d.ts.map +1 -0
  134. package/dist/shared/errors/file.error.js +93 -0
  135. package/dist/shared/errors/file.error.js.map +1 -0
  136. package/dist/shared/errors/index.d.ts +56 -0
  137. package/dist/shared/errors/index.d.ts.map +1 -0
  138. package/dist/shared/errors/index.js +86 -0
  139. package/dist/shared/errors/index.js.map +1 -0
  140. package/dist/shared/errors/validation.error.d.ts +67 -0
  141. package/dist/shared/errors/validation.error.d.ts.map +1 -0
  142. package/dist/shared/errors/validation.error.js +97 -0
  143. package/dist/shared/errors/validation.error.js.map +1 -0
  144. package/dist/shared/templates/index.d.ts +2 -0
  145. package/dist/shared/templates/index.d.ts.map +1 -0
  146. package/dist/shared/templates/index.js +2 -0
  147. package/dist/shared/templates/index.js.map +1 -0
  148. package/dist/shared/templates/prompt-builder.d.ts +2 -0
  149. package/dist/shared/templates/prompt-builder.d.ts.map +1 -0
  150. package/dist/shared/templates/prompt-builder.js +2 -0
  151. package/dist/shared/templates/prompt-builder.js.map +1 -0
  152. package/dist/shared/templates/template-engine.d.ts +2 -0
  153. package/dist/shared/templates/template-engine.d.ts.map +1 -0
  154. package/dist/shared/templates/template-engine.js +2 -0
  155. package/dist/shared/templates/template-engine.js.map +1 -0
  156. package/dist/shared/utils/__tests__/command-executor.test.d.ts +5 -0
  157. package/dist/shared/utils/__tests__/command-executor.test.d.ts.map +1 -0
  158. package/dist/shared/utils/__tests__/command-executor.test.js +45 -0
  159. package/dist/shared/utils/__tests__/command-executor.test.js.map +1 -0
  160. package/dist/shared/utils/__tests__/file-helper.test.d.ts +5 -0
  161. package/dist/shared/utils/__tests__/file-helper.test.d.ts.map +1 -0
  162. package/dist/shared/utils/__tests__/file-helper.test.js +71 -0
  163. package/dist/shared/utils/__tests__/file-helper.test.js.map +1 -0
  164. package/dist/shared/utils/__tests__/logger.test.d.ts +5 -0
  165. package/dist/shared/utils/__tests__/logger.test.d.ts.map +1 -0
  166. package/dist/shared/utils/__tests__/logger.test.js +83 -0
  167. package/dist/shared/utils/__tests__/logger.test.js.map +1 -0
  168. package/dist/shared/utils/command-executer.d.ts +2 -0
  169. package/dist/shared/utils/command-executer.d.ts.map +1 -0
  170. package/dist/shared/utils/command-executer.js +2 -0
  171. package/dist/shared/utils/command-executer.js.map +1 -0
  172. package/dist/shared/utils/command-executor.d.ts +255 -0
  173. package/dist/shared/utils/command-executor.d.ts.map +1 -0
  174. package/dist/shared/utils/command-executor.js +287 -0
  175. package/dist/shared/utils/command-executor.js.map +1 -0
  176. package/dist/shared/utils/file-helper.d.ts +86 -0
  177. package/dist/shared/utils/file-helper.d.ts.map +1 -0
  178. package/dist/shared/utils/file-helper.js +323 -0
  179. package/dist/shared/utils/file-helper.js.map +1 -0
  180. package/dist/shared/utils/index.d.ts +9 -0
  181. package/dist/shared/utils/index.d.ts.map +1 -0
  182. package/dist/shared/utils/index.js +9 -0
  183. package/dist/shared/utils/index.js.map +1 -0
  184. package/dist/shared/utils/logger.d.ts +163 -0
  185. package/dist/shared/utils/logger.d.ts.map +1 -0
  186. package/dist/shared/utils/logger.js +389 -0
  187. package/dist/shared/utils/logger.js.map +1 -0
  188. package/package.json +53 -34
  189. package/prompts/DEPS_EFFICIENCY.md +558 -558
  190. package/prompts/E2E.md +491 -491
  191. package/prompts/EXECUTE.md +1060 -1060
  192. package/prompts/INTEGRATION_API.md +484 -484
  193. package/prompts/INTEGRATION_DB.md +425 -425
  194. package/prompts/PERF_API.md +433 -433
  195. package/prompts/PERF_DB.md +430 -430
  196. package/prompts/PERF_FRONT.md +357 -357
  197. package/prompts/REMEDIATION.md +482 -482
  198. package/prompts/UNIT.md +260 -260
  199. package/templates/README.md +38 -38
  200. package/templates/k6/load-test.js +54 -54
  201. package/templates/playwright/e2e.spec.ts +61 -61
  202. package/templates/vitest/angular-component.test.ts +38 -38
  203. package/templates/vitest/api.test.ts +51 -51
  204. package/templates/vitest/component.test.ts +27 -27
  205. package/templates/vitest/hook.test.ts +36 -36
  206. package/templates/vitest/solid-component.test.ts +34 -34
  207. package/templates/vitest/svelte-component.test.ts +33 -33
  208. package/templates/vitest/vue-component.test.ts +39 -39
  209. package/CHANGELOG.md +0 -38
  210. package/agents/deps-analyzer.js +0 -366
  211. package/agents/detector.js +0 -570
  212. package/agents/fix-engine.js +0 -305
  213. package/agents/lighthouse-scanner.js +0 -405
  214. package/agents/perf-analyzer.js +0 -294
  215. package/agents/perf-front-analyzer.js +0 -229
  216. package/agents/test-generator.js +0 -387
  217. package/agents/test-runner.js +0 -318
  218. package/bin/cli.js +0 -449
  219. package/lib/config.js +0 -250
  220. package/lib/docker.js +0 -207
  221. package/lib/reporter.js +0 -297
  222. package/scripts/dev.js +0 -106
package/LICENSE CHANGED
@@ -1,23 +1,23 @@
1
- # Daemon - License
2
-
3
- MIT License
4
-
5
- Copyright (c) 2025 Yanis
6
-
7
- Permission is hereby granted, free of charge, to any person obtaining a copy
8
- of this software and associated documentation files (the "Software"), to deal
9
- in the Software without restriction, including without limitation the rights
10
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- copies of the Software, and to permit persons to whom the Software is
12
- furnished to do so, subject to the following conditions:
13
-
14
- The above copyright notice and this permission notice shall be included in all
15
- copies or substantial portions of the Software.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
- SOFTWARE.
1
+ # Daemon - License
2
+
3
+ MIT License
4
+
5
+ Copyright (c) 2025 Yanis
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
package/README.md CHANGED
@@ -1,141 +1,147 @@
1
- # Daemon
2
-
3
- AI-powered automated test generation and remediation for web applications.
4
-
5
- ## Quick Start
6
-
7
- ```bash
8
- # From your project directory
9
- npx --yes @oalacea/daemon@latest
10
- ```
11
-
12
- First run installs the testing toolkit (~500 MB Docker image, takes 2-3 minutes).
13
-
14
- ## What You Need
15
-
16
- - **Docker** - [Install](https://docs.docker.com/get-docker/)
17
- - **AI coding agent** - Claude Code, Cursor, Windsurf, Aider, Codex...
18
-
19
- ## Features
20
-
21
- | Category | Features |
22
- |----------|----------|
23
- | **Unit Tests** | Components, hooks, utils, validators, stores |
24
- | **Integration Tests** | API routes, database operations (with transaction rollback) |
25
- | **E2E Tests** | User flows, form interactions, navigation (Playwright) |
26
- | **Backend Performance** | API load testing (k6), DB query benchmarks |
27
- | **Frontend Performance** | Core Web Vitals, LCP, FID, CLS (Lighthouse) |
28
- | **Dependency Analysis** | TanStack Router, React Query, Prisma, Zustand, React Compiler |
29
-
30
- ## How It Works
31
-
32
- 1. **Analyze** - Auto-detects your framework, database, and existing tests
33
- 2. **Generate** - Creates tests based on your code patterns
34
- 3. **Execute** - Runs tests inside Docker container
35
- 4. **Fix** - Analyzes failures and applies corrections
36
- 5. **Report** - Provides comprehensive coverage and performance report
37
-
38
- ## Included Tools
39
-
40
- The Docker toolkit includes:
41
-
42
- | Category | Tools |
43
- |----------|-------|
44
- | Testing | Vitest, @testing-library/react, @testing-library/vue, @testing-library/svelte, @solidjs/testing-library, happy-dom |
45
- | E2E | Playwright (Chromium) |
46
- | Backend Performance | k6 (load testing) |
47
- | Frontend Performance | Lighthouse (Core Web Vitals) |
48
- | Utilities | supertest, MSW, @prisma/cli |
49
-
50
- ## Framework Support
51
-
52
- | Framework | Detection | Status |
53
- |-----------|-----------|--------|
54
- | Next.js | | Full support |
55
- | Remix | ✅ | Full support |
56
- | SvelteKit | ✅ | Full support |
57
- | Nuxt | ✅ | Full support |
58
- | Astro | | Full support |
59
- | Gatsby | ✅ | Full support |
60
- | Vite | ✅ | Full support |
61
- | Solid | ✅ | Full support |
62
- | Vue | ✅ | Full support |
63
- | Svelte | ✅ | Full support |
64
- | Angular | ✅ | Full support |
65
- | React Native | ✅ | Basic support |
66
- | Express | ✅ | Full support |
67
- | NestJS | ✅ | Full support |
68
-
69
- ## Output Example
70
-
71
- ```
72
- Unit Tests: 45 created, 42 passing, 3 fixed
73
- Integration: 12 created, 12 passing
74
- ✓ E2E: 8 created, 7 passing, 1 requires manual review
75
- Backend Performance: API p95 = 145ms (PASS)
76
- ✓ Frontend Performance: Lighthouse 85/100 (PASS)
77
- - LCP: 2.1s ✓ (target: <2.5s)
78
- - FID: 56ms (target: <100ms)
79
- - CLS: 0.05 (target: <0.1)
80
- Dependencies: 3 improvements suggested
81
-
82
- ## Summary
83
- Total Tests: 245
84
- Passing: 238
85
- Failing: 2 (requires manual review)
86
- Coverage: 84%
87
- ```
88
-
89
- ## Safety
90
-
91
- - Always use transaction rollback for database tests
92
- - Never modify production data
93
- - Git integration for safe rollbacks
94
- - Non-destructive testing modes available
95
-
96
- ## Troubleshooting
97
-
98
- ### Rebuild toolkit image
99
-
100
- ```bash
101
- docker rm -f daemon-tools
102
- docker rmi daemon-tools
103
- npx --yes @oalacea/daemon@latest
104
- ```
105
-
106
- ### Run specific test
107
-
108
- ```bash
109
- docker exec daemon-tools npm test -- Button.test.ts
110
- ```
111
-
112
- ### Debug test
113
-
114
- ```bash
115
- docker exec daemon-tools npm test -- Button.test.ts --reporter=verbose
116
- ```
117
-
118
- ### Run Lighthouse audit
119
-
120
- ```bash
121
- # Quick performance check
122
- docker exec daemon-tools npx lighthouse http://host.docker.internal:3000 --output=json --output=html
123
-
124
- # Mobile audit
125
- docker exec daemon-tools npx lighthouse http://host.docker.internal:3000 --form-factor=mobile
126
-
127
- # All categories
128
- docker exec daemon-tools npx lighthouse http://host.docker.internal:3000 --only-categories=performance,accessibility,best-practices,seo
129
- ```
130
-
131
- ## Related
132
-
133
- - **Guardian** - Security testing package: `npx @oalacea/guardian`
134
-
135
- ## License
136
-
137
- MIT - Use at your own risk.
138
-
139
- ## Credits
140
-
141
- Inspired by the need for comprehensive automated testing in modern web development.
1
+ # Daemon
2
+
3
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
+ [![GitHub release](https://img.shields.io/github/v/release/Pamacea/daemon)](https://github.com/Pamacea/daemon/releases/latest)
5
+ [![CI](https://github.com/Pamacea/daemon/actions/workflows/ci.yml/badge.svg)](https://github.com/Pamacea/daemon/actions)
6
+
7
+
8
+
9
+ AI-powered automated test generation and remediation for web applications.
10
+
11
+ ## Quick Start
12
+
13
+ ```bash
14
+ # From your project directory
15
+ npx --yes @oalacea/daemon@latest
16
+ ```
17
+
18
+ First run installs the testing toolkit (~500 MB Docker image, takes 2-3 minutes).
19
+
20
+ ## What You Need
21
+
22
+ - **Docker** - [Install](https://docs.docker.com/get-docker/)
23
+ - **AI coding agent** - Claude Code, Cursor, Windsurf, Aider, Codex...
24
+
25
+ ## Features
26
+
27
+ | Category | Features |
28
+ |----------|----------|
29
+ | **Unit Tests** | Components, hooks, utils, validators, stores |
30
+ | **Integration Tests** | API routes, database operations (with transaction rollback) |
31
+ | **E2E Tests** | User flows, form interactions, navigation (Playwright) |
32
+ | **Backend Performance** | API load testing (k6), DB query benchmarks |
33
+ | **Frontend Performance** | Core Web Vitals, LCP, FID, CLS (Lighthouse) |
34
+ | **Dependency Analysis** | TanStack Router, React Query, Prisma, Zustand, React Compiler |
35
+
36
+ ## How It Works
37
+
38
+ 1. **Analyze** - Auto-detects your framework, database, and existing tests
39
+ 2. **Generate** - Creates tests based on your code patterns
40
+ 3. **Execute** - Runs tests inside Docker container
41
+ 4. **Fix** - Analyzes failures and applies corrections
42
+ 5. **Report** - Provides comprehensive coverage and performance report
43
+
44
+ ## Included Tools
45
+
46
+ The Docker toolkit includes:
47
+
48
+ | Category | Tools |
49
+ |----------|-------|
50
+ | Testing | Vitest, @testing-library/react, @testing-library/vue, @testing-library/svelte, @solidjs/testing-library, happy-dom |
51
+ | E2E | Playwright (Chromium) |
52
+ | Backend Performance | k6 (load testing) |
53
+ | Frontend Performance | Lighthouse (Core Web Vitals) |
54
+ | Utilities | supertest, MSW, @prisma/cli |
55
+
56
+ ## Framework Support
57
+
58
+ | Framework | Detection | Status |
59
+ |-----------|-----------|--------|
60
+ | Next.js | ✅ | Full support |
61
+ | Remix | ✅ | Full support |
62
+ | SvelteKit | ✅ | Full support |
63
+ | Nuxt | ✅ | Full support |
64
+ | Astro | ✅ | Full support |
65
+ | Gatsby | ✅ | Full support |
66
+ | Vite | ✅ | Full support |
67
+ | Solid | ✅ | Full support |
68
+ | Vue | ✅ | Full support |
69
+ | Svelte | ✅ | Full support |
70
+ | Angular | ✅ | Full support |
71
+ | React Native | ✅ | Basic support |
72
+ | Express | | Full support |
73
+ | NestJS | | Full support |
74
+
75
+ ## Output Example
76
+
77
+ ```
78
+ Unit Tests: 45 created, 42 passing, 3 fixed
79
+ Integration: 12 created, 12 passing
80
+ E2E: 8 created, 7 passing, 1 requires manual review
81
+ ✓ Backend Performance: API p95 = 145ms (PASS)
82
+ Frontend Performance: Lighthouse 85/100 (PASS)
83
+ - LCP: 2.1s ✓ (target: <2.5s)
84
+ - FID: 56ms ✓ (target: <100ms)
85
+ - CLS: 0.05 (target: <0.1)
86
+ ✓ Dependencies: 3 improvements suggested
87
+
88
+ ## Summary
89
+ Total Tests: 245
90
+ Passing: 238
91
+ Failing: 2 (requires manual review)
92
+ Coverage: 84%
93
+ ```
94
+
95
+ ## Safety
96
+
97
+ - Always use transaction rollback for database tests
98
+ - Never modify production data
99
+ - Git integration for safe rollbacks
100
+ - Non-destructive testing modes available
101
+
102
+ ## Troubleshooting
103
+
104
+ ### Rebuild toolkit image
105
+
106
+ ```bash
107
+ docker rm -f daemon-tools
108
+ docker rmi daemon-tools
109
+ npx --yes @oalacea/daemon@latest
110
+ ```
111
+
112
+ ### Run specific test
113
+
114
+ ```bash
115
+ docker exec daemon-tools npm test -- Button.test.ts
116
+ ```
117
+
118
+ ### Debug test
119
+
120
+ ```bash
121
+ docker exec daemon-tools npm test -- Button.test.ts --reporter=verbose
122
+ ```
123
+
124
+ ### Run Lighthouse audit
125
+
126
+ ```bash
127
+ # Quick performance check
128
+ docker exec daemon-tools npx lighthouse http://host.docker.internal:3000 --output=json --output=html
129
+
130
+ # Mobile audit
131
+ docker exec daemon-tools npx lighthouse http://host.docker.internal:3000 --form-factor=mobile
132
+
133
+ # All categories
134
+ docker exec daemon-tools npx lighthouse http://host.docker.internal:3000 --only-categories=performance,accessibility,best-practices,seo
135
+ ```
136
+
137
+ ## Related
138
+
139
+ - **Guardian** - Security testing package: `npx @oalacea/guardian`
140
+
141
+ ## License
142
+
143
+ MIT - Use at your own risk.
144
+
145
+ ## Credits
146
+
147
+ Inspired by the need for comprehensive automated testing in modern web development.
package/bin/Dockerfile CHANGED
@@ -1,74 +1,75 @@
1
- # Daemon - Testing Tools Container
2
- FROM node:20-slim
3
-
4
- LABEL maintainer="Yanis"
5
- LABEL description="Daemon - Automated testing tools for web applications"
6
-
7
- # Install system dependencies for Playwright and wget with SSL
8
- RUN apt-get update && apt-get install -y --no-install-recommends \
9
- ca-certificates \
10
- libnss3 \
11
- libnspr4 \
12
- libatk1.0-0 \
13
- libatk-bridge2.0-0 \
14
- libcups2 \
15
- libdrm2 \
16
- libxkbcommon0 \
17
- libxcomposite1 \
18
- libxdamage1 \
19
- libxfixes3 \
20
- libxrandr2 \
21
- libgbm1 \
22
- libpango-1.0-0 \
23
- libcairo2 \
24
- libasound2 \
25
- libatspi2.0-0 \
26
- libxshmfence1 \
27
- wget \
28
- && rm -rf /var/lib/apt/lists/*
29
-
30
- # Install Playwright browsers
31
- RUN npx playwright install --with-deps chromium
32
-
33
- # Install testing tools globally
34
- RUN npm install -g \
35
- vitest \
36
- @vitest/ui \
37
- @playwright/test \
38
- @vitejs/plugin-react \
39
- @testing-library/react \
40
- @testing-library/jest-dom \
41
- @testing-library/user-event \
42
- @testing-library/vue \
43
- @testing-library/svelte \
44
- @solidjs/testing-library \
45
- @vue/test-utils \
46
- happy-dom
47
-
48
- # Install k6 for performance testing
49
- ARG TARGETARCH=amd64
50
- RUN ARCH=$([ "$TARGETARCH" = "arm64" ] && echo "arm64" || echo "amd64") && \
51
- wget -q "https://github.com/grafana/k6/releases/download/v1.5.0/k6-v1.5.0-linux-${ARCH}.tar.gz" -O /tmp/k6.tar.gz && \
52
- tar -xzf /tmp/k6.tar.gz -C /tmp && \
53
- mv /tmp/k6-v1.5.0-linux-${ARCH}/k6 /usr/local/bin/ && \
54
- rm -rf /tmp/k6.tar.gz /tmp/k6-v1.5.0-linux-${ARCH}
55
-
56
- # Install additional tools
57
- RUN npm install -g \
58
- supertest \
59
- msw \
60
- prisma \
61
- lighthouse
62
-
63
- # Create non-root user for security
64
- # Use UID 1001 to avoid conflict with existing node user (UID 1000)
65
- RUN useradd -m -u 1001 -s /bin/bash daemon && \
66
- mkdir -p /app && \
67
- chown -R daemon:daemon /app
68
-
69
- # Switch to non-root user
70
- USER daemon
71
- WORKDIR /app
72
-
73
- # Keep container alive for docker exec
74
- CMD ["sleep", "infinity"]
1
+ # Daemon - Testing Tools Container
2
+ FROM node:20-slim
3
+
4
+ LABEL maintainer="Yanis"
5
+ LABEL description="Daemon - Automated testing tools for web applications"
6
+
7
+ # Install system dependencies for Playwright and wget with SSL
8
+ RUN apt-get update && apt-get install -y --no-install-recommends \
9
+ ca-certificates \
10
+ libnss3 \
11
+ libnspr4 \
12
+ libatk1.0-0 \
13
+ libatk-bridge2.0-0 \
14
+ libcups2 \
15
+ libdrm2 \
16
+ libxkbcommon0 \
17
+ libxcomposite1 \
18
+ libxdamage1 \
19
+ libxfixes3 \
20
+ libxrandr2 \
21
+ libgbm1 \
22
+ libpango-1.0-0 \
23
+ libcairo2 \
24
+ libasound2 \
25
+ libatspi2.0-0 \
26
+ libxshmfence1 \
27
+ wget \
28
+ && rm -rf /var/lib/apt/lists/*
29
+
30
+ # Install Playwright browsers
31
+ RUN npx playwright install --with-deps chromium
32
+
33
+ # Install testing tools globally
34
+ RUN npm install -g \
35
+ vitest \
36
+ @vitest/ui \
37
+ @playwright/test \
38
+ @vitejs/plugin-react \
39
+ @testing-library/react \
40
+ @testing-library/jest-dom \
41
+ @testing-library/user-event \
42
+ @testing-library/vue \
43
+ @testing-library/svelte \
44
+ @solidjs/testing-library \
45
+ @vue/test-utils \
46
+ happy-dom
47
+
48
+ # Install k6 for performance testing
49
+ ARG TARGETARCH=amd64
50
+ RUN ARCH=$([ "$TARGETARCH" = "arm64" ] && echo "arm64" || echo "amd64") && \
51
+ wget -q "https://github.com/grafana/k6/releases/download/v1.5.0/k6-v1.5.0-linux-${ARCH}.tar.gz" -O /tmp/k6.tar.gz && \
52
+ tar -xzf /tmp/k6.tar.gz -C /tmp && \
53
+ mv /tmp/k6-v1.5.0-linux-${ARCH}/k6 /usr/local/bin/ && \
54
+ rm -rf /tmp/k6.tar.gz /tmp/k6-v1.5.0-linux-${ARCH}
55
+
56
+ # Install additional tools
57
+ RUN npm install -g \
58
+ supertest \
59
+ msw \
60
+ prisma \
61
+ lighthouse
62
+
63
+ # Create non-root user for security
64
+ # Use UID 1001 to avoid conflict with existing node user (UID 1000)
65
+ # Check if 'daemon' user exists first (node:20-slim already has it)
66
+ RUN id -u daemon >/dev/null 2>&1 || useradd -m -u 1001 -s /bin/bash daemon && \
67
+ mkdir -p /app && \
68
+ chown -R daemon:daemon /app
69
+
70
+ # Switch to non-root user
71
+ USER daemon
72
+ WORKDIR /app
73
+
74
+ # Keep container alive for docker exec
75
+ CMD ["sleep", "infinity"]
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Daemon CLI - Main CLI Class
4
+ *
5
+ * @module cli/cli
6
+ */
7
+ export interface CliContext {
8
+ /** Project directory */
9
+ projectDir: string;
10
+ /** Verbose mode */
11
+ verbose?: boolean;
12
+ /** Silent mode */
13
+ silent?: boolean;
14
+ /** Force mode */
15
+ force?: boolean;
16
+ }
17
+ /**
18
+ * Main CLI class for Daemon
19
+ *
20
+ * Handles command routing and execution.
21
+ */
22
+ export declare class DaemonCli {
23
+ private readonly commands;
24
+ constructor();
25
+ /**
26
+ * Run the CLI with provided arguments
27
+ */
28
+ run(argv: string[]): Promise<void>;
29
+ /**
30
+ * Show help message
31
+ */
32
+ private showHelp;
33
+ /**
34
+ * Get CLI context from environment and flags
35
+ */
36
+ createContext(options: {
37
+ verbose?: boolean;
38
+ silent?: boolean;
39
+ force?: boolean;
40
+ }): CliContext;
41
+ }
42
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli/cli.ts"],"names":[],"mappings":";AACA;;;;GAIG;AASH,MAAM,WAAW,UAAU;IACzB,wBAAwB;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,mBAAmB;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,kBAAkB;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,iBAAiB;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;GAIG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA8D;;IASvF;;OAEG;IACG,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IA2BxC;;OAEG;IACH,OAAO,CAAC,QAAQ;IAyBhB;;OAEG;IACH,aAAa,CAAC,OAAO,EAAE;QACrB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,MAAM,CAAC,EAAE,OAAO,CAAC;QACjB,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB,GAAG,UAAU;CAQf"}
@@ -0,0 +1,89 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Daemon CLI - Main CLI Class
4
+ *
5
+ * @module cli/cli
6
+ */
7
+ import { createLogger } from '../shared/utils/logger.js';
8
+ import { InitCommand } from './commands/init.command.js';
9
+ import { DetectCommand } from './commands/detect.command.js';
10
+ import { TestCommand } from './commands/test.command.js';
11
+ const logger = createLogger('DaemonCli');
12
+ /**
13
+ * Main CLI class for Daemon
14
+ *
15
+ * Handles command routing and execution.
16
+ */
17
+ export class DaemonCli {
18
+ commands;
19
+ constructor() {
20
+ this.commands = new Map();
21
+ this.commands.set('init', new InitCommand());
22
+ this.commands.set('detect', new DetectCommand());
23
+ this.commands.set('test', new TestCommand());
24
+ }
25
+ /**
26
+ * Run the CLI with provided arguments
27
+ */
28
+ async run(argv) {
29
+ const args = argv.slice(2); // Skip node and script path
30
+ if (args.length === 0 || args[0] === '--help' || args[0] === '-h') {
31
+ this.showHelp();
32
+ return;
33
+ }
34
+ const commandName = args[0] ?? '';
35
+ const commandArgs = args.slice(1);
36
+ const command = this.commands.get(commandName);
37
+ if (!command) {
38
+ logger.error(`Unknown command: ${commandName}`);
39
+ this.showHelp();
40
+ process.exit(1);
41
+ }
42
+ try {
43
+ await command.execute(commandArgs);
44
+ }
45
+ catch (error) {
46
+ logger.error('Command execution failed', error);
47
+ process.exit(1);
48
+ }
49
+ }
50
+ /**
51
+ * Show help message
52
+ */
53
+ showHelp() {
54
+ console.log(`
55
+ Daemon v0.6.0 - AI-powered automated testing toolkit
56
+
57
+ USAGE:
58
+ daemon <command> [options]
59
+
60
+ COMMANDS:
61
+ init Initialize project with Daemon
62
+ detect Detect project framework and tools
63
+ test Generate and run tests
64
+
65
+ OPTIONS:
66
+ --help, -h Show this help message
67
+ --version Show version number
68
+
69
+ EXAMPLES:
70
+ daemon init
71
+ daemon detect
72
+ daemon test --coverage
73
+
74
+ For more information, visit: https://github.com/Pamacea/daemon
75
+ `);
76
+ }
77
+ /**
78
+ * Get CLI context from environment and flags
79
+ */
80
+ createContext(options) {
81
+ return {
82
+ projectDir: process.cwd(),
83
+ verbose: options.verbose ?? false,
84
+ silent: options.silent ?? false,
85
+ force: options.force ?? false,
86
+ };
87
+ }
88
+ }
89
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli/cli.ts"],"names":[],"mappings":";AACA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,MAAM,MAAM,GAAG,YAAY,CAAC,WAAW,CAAC,CAAC;AAazC;;;;GAIG;AACH,MAAM,OAAO,SAAS;IACH,QAAQ,CAA8D;IAEvF;QACE,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,EAA0D,CAAC;QAClF,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,WAAW,EAAE,CAAC,CAAC;QAC7C,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,aAAa,EAAE,CAAC,CAAC;QACjD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,WAAW,EAAE,CAAC,CAAC;IAC/C,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,GAAG,CAAC,IAAc;QACtB,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,4BAA4B;QAExD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;YAClE,IAAI,CAAC,QAAQ,EAAE,CAAC;YAChB,OAAO;QACT,CAAC;QAED,MAAM,WAAW,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAClC,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAElC,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QAE/C,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,CAAC,KAAK,CAAC,oBAAoB,WAAW,EAAE,CAAC,CAAC;YAChD,IAAI,CAAC,QAAQ,EAAE,CAAC;YAChB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,IAAI,CAAC;YACH,MAAM,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QACrC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,KAAK,CAAC,0BAA0B,EAAE,KAAK,CAAC,CAAC;YAChD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;IAED;;OAEG;IACK,QAAQ;QACd,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;KAqBX,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,aAAa,CAAC,OAIb;QACC,OAAO;YACL,UAAU,EAAE,OAAO,CAAC,GAAG,EAAE;YACzB,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,KAAK;YACjC,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,KAAK;YAC/B,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,KAAK;SAC9B,CAAC;IACJ,CAAC;CACF"}