cast-code 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +217 -0
  3. package/dist/app.module.js +45 -0
  4. package/dist/app.module.js.map +1 -0
  5. package/dist/common/common.module.js +49 -0
  6. package/dist/common/common.module.js.map +1 -0
  7. package/dist/common/constants/index.js +105 -0
  8. package/dist/common/constants/index.js.map +1 -0
  9. package/dist/common/index.js +24 -0
  10. package/dist/common/index.js.map +1 -0
  11. package/dist/common/services/config.service.js +119 -0
  12. package/dist/common/services/config.service.js.map +1 -0
  13. package/dist/common/services/llm.service.js +56 -0
  14. package/dist/common/services/llm.service.js.map +1 -0
  15. package/dist/common/services/markdown-parser.service.js +101 -0
  16. package/dist/common/services/markdown-parser.service.js.map +1 -0
  17. package/dist/common/services/markdown-renderer.service.js +220 -0
  18. package/dist/common/services/markdown-renderer.service.js.map +1 -0
  19. package/dist/common/services/multi-llm.service.js +115 -0
  20. package/dist/common/services/multi-llm.service.js.map +1 -0
  21. package/dist/common/types/index.js +20 -0
  22. package/dist/common/types/index.js.map +1 -0
  23. package/dist/common/types/markdown.types.js +6 -0
  24. package/dist/common/types/markdown.types.js.map +1 -0
  25. package/dist/main.js +84 -0
  26. package/dist/main.js.map +1 -0
  27. package/dist/modules/agents/agents.module.js +43 -0
  28. package/dist/modules/agents/agents.module.js.map +1 -0
  29. package/dist/modules/agents/definitions/architect.md +35 -0
  30. package/dist/modules/agents/definitions/backend.md +43 -0
  31. package/dist/modules/agents/definitions/coder.md +34 -0
  32. package/dist/modules/agents/definitions/devops.md +42 -0
  33. package/dist/modules/agents/definitions/frontend.md +46 -0
  34. package/dist/modules/agents/definitions/reviewer.md +35 -0
  35. package/dist/modules/agents/definitions/tester.md +41 -0
  36. package/dist/modules/agents/index.js +23 -0
  37. package/dist/modules/agents/index.js.map +1 -0
  38. package/dist/modules/agents/services/agent-loader.service.js +150 -0
  39. package/dist/modules/agents/services/agent-loader.service.js.map +1 -0
  40. package/dist/modules/agents/services/agent-registry.service.js +108 -0
  41. package/dist/modules/agents/services/agent-registry.service.js.map +1 -0
  42. package/dist/modules/agents/types/agent.types.js +6 -0
  43. package/dist/modules/agents/types/agent.types.js.map +1 -0
  44. package/dist/modules/agents/types/index.js +20 -0
  45. package/dist/modules/agents/types/index.js.map +1 -0
  46. package/dist/modules/config/config.module.js +38 -0
  47. package/dist/modules/config/config.module.js.map +1 -0
  48. package/dist/modules/config/index.js +24 -0
  49. package/dist/modules/config/index.js.map +1 -0
  50. package/dist/modules/config/services/config-commands.service.js +405 -0
  51. package/dist/modules/config/services/config-commands.service.js.map +1 -0
  52. package/dist/modules/config/services/config-manager.service.js +175 -0
  53. package/dist/modules/config/services/config-manager.service.js.map +1 -0
  54. package/dist/modules/config/services/init-config.service.js +238 -0
  55. package/dist/modules/config/services/init-config.service.js.map +1 -0
  56. package/dist/modules/config/types/config.types.js +163 -0
  57. package/dist/modules/config/types/config.types.js.map +1 -0
  58. package/dist/modules/config/types/index.js +20 -0
  59. package/dist/modules/config/types/index.js.map +1 -0
  60. package/dist/modules/core/core.module.js +60 -0
  61. package/dist/modules/core/core.module.js.map +1 -0
  62. package/dist/modules/core/index.js +22 -0
  63. package/dist/modules/core/index.js.map +1 -0
  64. package/dist/modules/core/services/deep-agent.service.js +575 -0
  65. package/dist/modules/core/services/deep-agent.service.js.map +1 -0
  66. package/dist/modules/core/services/plan-mode.service.js +225 -0
  67. package/dist/modules/core/services/plan-mode.service.js.map +1 -0
  68. package/dist/modules/git/git.module.js +48 -0
  69. package/dist/modules/git/git.module.js.map +1 -0
  70. package/dist/modules/git/index.js +23 -0
  71. package/dist/modules/git/index.js.map +1 -0
  72. package/dist/modules/git/services/code-review.service.js +330 -0
  73. package/dist/modules/git/services/code-review.service.js.map +1 -0
  74. package/dist/modules/git/services/commit-generator.service.js +403 -0
  75. package/dist/modules/git/services/commit-generator.service.js.map +1 -0
  76. package/dist/modules/git/services/index.js +21 -0
  77. package/dist/modules/git/services/index.js.map +1 -0
  78. package/dist/modules/git/services/monorepo-detector.service.js +338 -0
  79. package/dist/modules/git/services/monorepo-detector.service.js.map +1 -0
  80. package/dist/modules/git/services/pr-generator.service.js +429 -0
  81. package/dist/modules/git/services/pr-generator.service.js.map +1 -0
  82. package/dist/modules/git/services/release-notes.service.js +426 -0
  83. package/dist/modules/git/services/release-notes.service.js.map +1 -0
  84. package/dist/modules/git/types/git.types.js +6 -0
  85. package/dist/modules/git/types/git.types.js.map +1 -0
  86. package/dist/modules/git/types/index.js +20 -0
  87. package/dist/modules/git/types/index.js.map +1 -0
  88. package/dist/modules/mcp/catalog/mcp-templates.js +606 -0
  89. package/dist/modules/mcp/catalog/mcp-templates.js.map +1 -0
  90. package/dist/modules/mcp/index.js +23 -0
  91. package/dist/modules/mcp/index.js.map +1 -0
  92. package/dist/modules/mcp/mcp.module.js +35 -0
  93. package/dist/modules/mcp/mcp.module.js.map +1 -0
  94. package/dist/modules/mcp/services/mcp-client.service.js +289 -0
  95. package/dist/modules/mcp/services/mcp-client.service.js.map +1 -0
  96. package/dist/modules/mcp/services/mcp-registry.service.js +197 -0
  97. package/dist/modules/mcp/services/mcp-registry.service.js.map +1 -0
  98. package/dist/modules/mcp/types/index.js +20 -0
  99. package/dist/modules/mcp/types/index.js.map +1 -0
  100. package/dist/modules/mcp/types/mcp.types.js +6 -0
  101. package/dist/modules/mcp/types/mcp.types.js.map +1 -0
  102. package/dist/modules/memory/index.js +23 -0
  103. package/dist/modules/memory/index.js.map +1 -0
  104. package/dist/modules/memory/memory.module.js +35 -0
  105. package/dist/modules/memory/memory.module.js.map +1 -0
  106. package/dist/modules/memory/services/memory-tools.service.js +78 -0
  107. package/dist/modules/memory/services/memory-tools.service.js.map +1 -0
  108. package/dist/modules/memory/services/memory.service.js +169 -0
  109. package/dist/modules/memory/services/memory.service.js.map +1 -0
  110. package/dist/modules/memory/types/index.js +20 -0
  111. package/dist/modules/memory/types/index.js.map +1 -0
  112. package/dist/modules/memory/types/memory.types.js +6 -0
  113. package/dist/modules/memory/types/memory.types.js.map +1 -0
  114. package/dist/modules/mentions/index.js +22 -0
  115. package/dist/modules/mentions/index.js.map +1 -0
  116. package/dist/modules/mentions/mentions.module.js +32 -0
  117. package/dist/modules/mentions/mentions.module.js.map +1 -0
  118. package/dist/modules/mentions/services/mentions.service.js +336 -0
  119. package/dist/modules/mentions/services/mentions.service.js.map +1 -0
  120. package/dist/modules/mentions/types/index.js +20 -0
  121. package/dist/modules/mentions/types/index.js.map +1 -0
  122. package/dist/modules/mentions/types/mention.types.js +19 -0
  123. package/dist/modules/mentions/types/mention.types.js.map +1 -0
  124. package/dist/modules/permissions/index.js +23 -0
  125. package/dist/modules/permissions/index.js.map +1 -0
  126. package/dist/modules/permissions/permissions.module.js +35 -0
  127. package/dist/modules/permissions/permissions.module.js.map +1 -0
  128. package/dist/modules/permissions/services/permission.service.js +269 -0
  129. package/dist/modules/permissions/services/permission.service.js.map +1 -0
  130. package/dist/modules/permissions/services/prompt.service.js +116 -0
  131. package/dist/modules/permissions/services/prompt.service.js.map +1 -0
  132. package/dist/modules/permissions/types/permission.types.js +32 -0
  133. package/dist/modules/permissions/types/permission.types.js.map +1 -0
  134. package/dist/modules/project/index.js +24 -0
  135. package/dist/modules/project/index.js.map +1 -0
  136. package/dist/modules/project/project.module.js +38 -0
  137. package/dist/modules/project/project.module.js.map +1 -0
  138. package/dist/modules/project/services/project-analyzer.service.js +1063 -0
  139. package/dist/modules/project/services/project-analyzer.service.js.map +1 -0
  140. package/dist/modules/project/services/project-context.service.js +62 -0
  141. package/dist/modules/project/services/project-context.service.js.map +1 -0
  142. package/dist/modules/project/services/project-loader.service.js +147 -0
  143. package/dist/modules/project/services/project-loader.service.js.map +1 -0
  144. package/dist/modules/project/types/index.js +20 -0
  145. package/dist/modules/project/types/index.js.map +1 -0
  146. package/dist/modules/project/types/project.types.js +6 -0
  147. package/dist/modules/project/types/project.types.js.map +1 -0
  148. package/dist/modules/repl/index.js +21 -0
  149. package/dist/modules/repl/index.js.map +1 -0
  150. package/dist/modules/repl/repl.module.js +66 -0
  151. package/dist/modules/repl/repl.module.js.map +1 -0
  152. package/dist/modules/repl/services/commands/agent-commands.service.js +196 -0
  153. package/dist/modules/repl/services/commands/agent-commands.service.js.map +1 -0
  154. package/dist/modules/repl/services/commands/git-commands.service.js +500 -0
  155. package/dist/modules/repl/services/commands/git-commands.service.js.map +1 -0
  156. package/dist/modules/repl/services/commands/mcp-commands.service.js +579 -0
  157. package/dist/modules/repl/services/commands/mcp-commands.service.js.map +1 -0
  158. package/dist/modules/repl/services/commands/project-commands.service.js +226 -0
  159. package/dist/modules/repl/services/commands/project-commands.service.js.map +1 -0
  160. package/dist/modules/repl/services/commands/repl-commands.service.js +254 -0
  161. package/dist/modules/repl/services/commands/repl-commands.service.js.map +1 -0
  162. package/dist/modules/repl/services/repl.service.js +647 -0
  163. package/dist/modules/repl/services/repl.service.js.map +1 -0
  164. package/dist/modules/repl/services/smart-input.js +544 -0
  165. package/dist/modules/repl/services/smart-input.js.map +1 -0
  166. package/dist/modules/repl/services/welcome-screen.service.js +117 -0
  167. package/dist/modules/repl/services/welcome-screen.service.js.map +1 -0
  168. package/dist/modules/repl/utils/prompts-with-esc.js +187 -0
  169. package/dist/modules/repl/utils/prompts-with-esc.js.map +1 -0
  170. package/dist/modules/repl/utils/theme.js +185 -0
  171. package/dist/modules/repl/utils/theme.js.map +1 -0
  172. package/dist/modules/skills/definitions/general/file-operations.md +60 -0
  173. package/dist/modules/skills/definitions/general/git-operations.md +59 -0
  174. package/dist/modules/skills/definitions/general/planning.md +86 -0
  175. package/dist/modules/skills/definitions/general/search.md +59 -0
  176. package/dist/modules/skills/definitions/specialized/api-design.md +85 -0
  177. package/dist/modules/skills/definitions/specialized/database-operations.md +78 -0
  178. package/dist/modules/skills/definitions/specialized/frontend-bootstrap.md +71 -0
  179. package/dist/modules/skills/definitions/specialized/react-patterns.md +77 -0
  180. package/dist/modules/skills/definitions/specialized/testing-strategies.md +79 -0
  181. package/dist/modules/skills/index.js +23 -0
  182. package/dist/modules/skills/index.js.map +1 -0
  183. package/dist/modules/skills/services/skill-loader.service.js +130 -0
  184. package/dist/modules/skills/services/skill-loader.service.js.map +1 -0
  185. package/dist/modules/skills/services/skill-registry.service.js +96 -0
  186. package/dist/modules/skills/services/skill-registry.service.js.map +1 -0
  187. package/dist/modules/skills/skills.module.js +38 -0
  188. package/dist/modules/skills/skills.module.js.map +1 -0
  189. package/dist/modules/skills/types/index.js +20 -0
  190. package/dist/modules/skills/types/index.js.map +1 -0
  191. package/dist/modules/skills/types/skill.types.js +6 -0
  192. package/dist/modules/skills/types/skill.types.js.map +1 -0
  193. package/dist/modules/tasks/index.js +24 -0
  194. package/dist/modules/tasks/index.js.map +1 -0
  195. package/dist/modules/tasks/services/plan-executor.service.js +199 -0
  196. package/dist/modules/tasks/services/plan-executor.service.js.map +1 -0
  197. package/dist/modules/tasks/services/plan-mode.service.js +118 -0
  198. package/dist/modules/tasks/services/plan-mode.service.js.map +1 -0
  199. package/dist/modules/tasks/services/plan-persistence.service.js +148 -0
  200. package/dist/modules/tasks/services/plan-persistence.service.js.map +1 -0
  201. package/dist/modules/tasks/services/task-management.service.js +255 -0
  202. package/dist/modules/tasks/services/task-management.service.js.map +1 -0
  203. package/dist/modules/tasks/services/task-tools.service.js +270 -0
  204. package/dist/modules/tasks/services/task-tools.service.js.map +1 -0
  205. package/dist/modules/tasks/tasks.module.js +49 -0
  206. package/dist/modules/tasks/tasks.module.js.map +1 -0
  207. package/dist/modules/tasks/types/task.types.js +21 -0
  208. package/dist/modules/tasks/types/task.types.js.map +1 -0
  209. package/dist/modules/tools/index.js +24 -0
  210. package/dist/modules/tools/index.js.map +1 -0
  211. package/dist/modules/tools/services/filesystem-tools.service.js +450 -0
  212. package/dist/modules/tools/services/filesystem-tools.service.js.map +1 -0
  213. package/dist/modules/tools/services/search-tools.service.js +63 -0
  214. package/dist/modules/tools/services/search-tools.service.js.map +1 -0
  215. package/dist/modules/tools/services/shell-tools.service.js +194 -0
  216. package/dist/modules/tools/services/shell-tools.service.js.map +1 -0
  217. package/dist/modules/tools/services/tools-registry.service.js +83 -0
  218. package/dist/modules/tools/services/tools-registry.service.js.map +1 -0
  219. package/dist/modules/tools/tools.module.js +46 -0
  220. package/dist/modules/tools/tools.module.js.map +1 -0
  221. package/package.json +74 -0
@@ -0,0 +1,1063 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "ProjectAnalyzerService", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return ProjectAnalyzerService;
9
+ }
10
+ });
11
+ const _common = require("@nestjs/common");
12
+ const _promises = /*#__PURE__*/ _interop_require_wildcard(require("node:fs/promises"));
13
+ const _path = /*#__PURE__*/ _interop_require_wildcard(require("path"));
14
+ const _glob = require("glob");
15
+ function _getRequireWildcardCache(nodeInterop) {
16
+ if (typeof WeakMap !== "function") return null;
17
+ var cacheBabelInterop = new WeakMap();
18
+ var cacheNodeInterop = new WeakMap();
19
+ return (_getRequireWildcardCache = function(nodeInterop) {
20
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
21
+ })(nodeInterop);
22
+ }
23
+ function _interop_require_wildcard(obj, nodeInterop) {
24
+ if (!nodeInterop && obj && obj.__esModule) {
25
+ return obj;
26
+ }
27
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
28
+ return {
29
+ default: obj
30
+ };
31
+ }
32
+ var cache = _getRequireWildcardCache(nodeInterop);
33
+ if (cache && cache.has(obj)) {
34
+ return cache.get(obj);
35
+ }
36
+ var newObj = {
37
+ __proto__: null
38
+ };
39
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
40
+ for(var key in obj){
41
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
42
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
43
+ if (desc && (desc.get || desc.set)) {
44
+ Object.defineProperty(newObj, key, desc);
45
+ } else {
46
+ newObj[key] = obj[key];
47
+ }
48
+ }
49
+ }
50
+ newObj.default = obj;
51
+ if (cache) {
52
+ cache.set(obj, newObj);
53
+ }
54
+ return newObj;
55
+ }
56
+ function _ts_decorate(decorators, target, key, desc) {
57
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
58
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
59
+ else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
60
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
61
+ }
62
+ const LANGUAGES = {
63
+ typescript: {
64
+ name: 'TypeScript',
65
+ extensions: [
66
+ '.ts',
67
+ '.tsx'
68
+ ],
69
+ configFiles: [
70
+ 'tsconfig.json'
71
+ ],
72
+ entryPatterns: [
73
+ 'src/main.ts',
74
+ 'src/index.ts',
75
+ 'index.ts',
76
+ 'main.ts'
77
+ ],
78
+ importPatterns: [
79
+ /import\s+.*?\s+from\s+['"]([^'"]+)['"]/g,
80
+ /import\s*\(['"]([^'"]+)['"]\)/g,
81
+ /require\s*\(\s*['"]([^'"]+)['"]\s*\)/g
82
+ ],
83
+ commentPatterns: {
84
+ single: '//',
85
+ multi: [
86
+ '/*',
87
+ '*/'
88
+ ]
89
+ }
90
+ },
91
+ javascript: {
92
+ name: 'JavaScript',
93
+ extensions: [
94
+ '.js',
95
+ '.jsx',
96
+ '.mjs'
97
+ ],
98
+ configFiles: [
99
+ 'package.json',
100
+ '.eslintrc.js'
101
+ ],
102
+ entryPatterns: [
103
+ 'src/main.js',
104
+ 'src/index.js',
105
+ 'index.js',
106
+ 'main.js',
107
+ 'app.js'
108
+ ],
109
+ importPatterns: [
110
+ /import\s+.*?\s+from\s+['"]([^'"]+)['"]/g,
111
+ /require\s*\(\s*['"]([^'"]+)['"]\s*\)/g
112
+ ],
113
+ commentPatterns: {
114
+ single: '//',
115
+ multi: [
116
+ '/*',
117
+ '*/'
118
+ ]
119
+ }
120
+ },
121
+ python: {
122
+ name: 'Python',
123
+ extensions: [
124
+ '.py'
125
+ ],
126
+ configFiles: [
127
+ 'pyproject.toml',
128
+ 'requirements.txt',
129
+ 'setup.py',
130
+ 'Pipfile'
131
+ ],
132
+ entryPatterns: [
133
+ 'main.py',
134
+ 'app.py',
135
+ 'src/main.py',
136
+ '__main__.py',
137
+ 'manage.py'
138
+ ],
139
+ importPatterns: [
140
+ /(?:from|import)\s+([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)/g
141
+ ],
142
+ commentPatterns: {
143
+ single: '#',
144
+ multi: [
145
+ '"""',
146
+ '"""'
147
+ ]
148
+ }
149
+ },
150
+ go: {
151
+ name: 'Go',
152
+ extensions: [
153
+ '.go'
154
+ ],
155
+ configFiles: [
156
+ 'go.mod',
157
+ 'go.sum'
158
+ ],
159
+ entryPatterns: [
160
+ 'main.go',
161
+ 'cmd/main.go',
162
+ 'src/main.go'
163
+ ],
164
+ importPatterns: [
165
+ /import\s+\(\s*([^)]+)\)/g,
166
+ /import\s+['"]([^'"]+)['"]/g
167
+ ],
168
+ commentPatterns: {
169
+ single: '//',
170
+ multi: [
171
+ '/*',
172
+ '*/'
173
+ ]
174
+ }
175
+ },
176
+ rust: {
177
+ name: 'Rust',
178
+ extensions: [
179
+ '.rs'
180
+ ],
181
+ configFiles: [
182
+ 'Cargo.toml',
183
+ 'Cargo.lock'
184
+ ],
185
+ entryPatterns: [
186
+ 'src/main.rs',
187
+ 'src/lib.rs',
188
+ 'main.rs'
189
+ ],
190
+ importPatterns: [
191
+ /use\s+([a-zA-Z_][a-zA-Z0-9_:]*)/g,
192
+ /extern\s+crate\s+([a-zA-Z_][a-zA-Z0-9_]*)/g
193
+ ],
194
+ commentPatterns: {
195
+ single: '//',
196
+ multi: [
197
+ '/*',
198
+ '*/'
199
+ ]
200
+ }
201
+ },
202
+ java: {
203
+ name: 'Java',
204
+ extensions: [
205
+ '.java'
206
+ ],
207
+ configFiles: [
208
+ 'pom.xml',
209
+ 'build.gradle',
210
+ 'gradlew'
211
+ ],
212
+ entryPatterns: [
213
+ 'src/main/java/Main.java',
214
+ 'src/Main.java',
215
+ 'Main.java'
216
+ ],
217
+ importPatterns: [
218
+ /import\s+([a-zA-Z_][a-zA-Z0-9_.]*)/g
219
+ ],
220
+ commentPatterns: {
221
+ single: '//',
222
+ multi: [
223
+ '/*',
224
+ '*/'
225
+ ]
226
+ }
227
+ },
228
+ php: {
229
+ name: 'PHP',
230
+ extensions: [
231
+ '.php'
232
+ ],
233
+ configFiles: [
234
+ 'composer.json',
235
+ 'composer.lock'
236
+ ],
237
+ entryPatterns: [
238
+ 'index.php',
239
+ 'public/index.php',
240
+ 'src/index.php'
241
+ ],
242
+ importPatterns: [
243
+ /use\s+([a-zA-Z_][a-zA-Z0-9_\\]*)/g,
244
+ /require(?:_once)?\s*\(\s*['"]([^'"]+)['"]\s*\)/g,
245
+ /include(?:_once)?\s*\(\s*['"]([^'"]+)['"]\s*\)/g
246
+ ],
247
+ commentPatterns: {
248
+ single: '//',
249
+ multi: [
250
+ '/*',
251
+ '*/'
252
+ ]
253
+ }
254
+ },
255
+ ruby: {
256
+ name: 'Ruby',
257
+ extensions: [
258
+ '.rb'
259
+ ],
260
+ configFiles: [
261
+ 'Gemfile',
262
+ 'Gemfile.lock',
263
+ '*.gemspec'
264
+ ],
265
+ entryPatterns: [
266
+ 'main.rb',
267
+ 'app.rb',
268
+ 'config.ru',
269
+ 'bin/'
270
+ ],
271
+ importPatterns: [
272
+ /require\s+['"]([^'"]+)['"]/g,
273
+ /require_relative\s+['"]([^'"]+)['"]/g
274
+ ],
275
+ commentPatterns: {
276
+ single: '#'
277
+ }
278
+ },
279
+ csharp: {
280
+ name: 'C#',
281
+ extensions: [
282
+ '.cs'
283
+ ],
284
+ configFiles: [
285
+ '*.csproj',
286
+ '*.sln'
287
+ ],
288
+ entryPatterns: [
289
+ 'Program.cs',
290
+ 'Main.cs',
291
+ 'Startup.cs'
292
+ ],
293
+ importPatterns: [
294
+ /using\s+([a-zA-Z_][a-zA-Z0-9_.]*)/g
295
+ ],
296
+ commentPatterns: {
297
+ single: '//',
298
+ multi: [
299
+ '/*',
300
+ '*/'
301
+ ]
302
+ }
303
+ }
304
+ };
305
+ const ARCHITECTURE_PATTERNS = [
306
+ {
307
+ name: 'Layered Architecture',
308
+ indicators: [
309
+ 'controllers',
310
+ 'services',
311
+ 'repositories',
312
+ 'models',
313
+ 'dao'
314
+ ],
315
+ description: 'Separação em camadas: apresentação, negócio, dados'
316
+ },
317
+ {
318
+ name: 'Clean Architecture',
319
+ indicators: [
320
+ 'entities',
321
+ 'usecases',
322
+ 'adapters',
323
+ 'frameworks',
324
+ 'interfaces'
325
+ ],
326
+ description: 'Independência de frameworks, testável, independente de UI e banco'
327
+ },
328
+ {
329
+ name: 'Hexagonal Architecture (Ports & Adapters)',
330
+ indicators: [
331
+ 'ports',
332
+ 'adapters',
333
+ 'domain',
334
+ 'application'
335
+ ],
336
+ description: 'Domínio no centro, adaptadores externos plugáveis'
337
+ },
338
+ {
339
+ name: 'Microservices',
340
+ indicators: [
341
+ 'services/',
342
+ 'api/',
343
+ 'gateway',
344
+ 'proto/',
345
+ 'grpc'
346
+ ],
347
+ description: 'Serviços independentes, comunicação via API/mensagens'
348
+ },
349
+ {
350
+ name: 'Serverless',
351
+ indicators: [
352
+ 'functions/',
353
+ 'handlers/',
354
+ 'lambda',
355
+ 'serverless.yml'
356
+ ],
357
+ description: 'Funções como unidade de deployment, event-driven'
358
+ },
359
+ {
360
+ name: 'Modular Monolith',
361
+ indicators: [
362
+ 'modules/',
363
+ 'bounded-contexts',
364
+ 'packages/'
365
+ ],
366
+ description: 'Monolito dividido em módulos bem definidos'
367
+ },
368
+ {
369
+ name: 'Domain-Driven Design (DDD)',
370
+ indicators: [
371
+ 'domain/',
372
+ 'aggregates',
373
+ 'value-objects',
374
+ 'entities',
375
+ 'domain-events'
376
+ ],
377
+ description: 'Modelagem focada no domínio de negócio'
378
+ },
379
+ {
380
+ name: 'CQRS',
381
+ indicators: [
382
+ 'commands/',
383
+ 'queries/',
384
+ 'handlers/',
385
+ 'read-model',
386
+ 'write-model'
387
+ ],
388
+ description: 'Separação de leitura e escrita'
389
+ },
390
+ {
391
+ name: 'Event Sourcing',
392
+ indicators: [
393
+ 'events/',
394
+ 'event-store',
395
+ 'projections',
396
+ 'aggregates'
397
+ ],
398
+ description: 'Estado derivado de uma sequência de eventos'
399
+ },
400
+ {
401
+ name: 'MVC/MVP/MVVM',
402
+ indicators: [
403
+ 'views/',
404
+ 'viewmodels',
405
+ 'presenters',
406
+ 'controllers'
407
+ ],
408
+ description: 'Separação de concerns de UI'
409
+ }
410
+ ];
411
+ // Pattern roles based on file/directory names
412
+ const PATTERN_ROLES = {
413
+ // Controllers
414
+ controller: 'Controlador - Recebe requisições, delega processamento',
415
+ handler: 'Handler - Processa requisições/eventos',
416
+ resource: 'Resource - Endpoints REST',
417
+ router: 'Router - Define rotas',
418
+ route: 'Route - Configuração de rota',
419
+ service: 'Serviço - Lógica de negócio',
420
+ usecase: 'Caso de Uso - Orquestra operação específica',
421
+ interactor: 'Interactor - Coordena fluxo de dados',
422
+ repository: 'Repositório - Acesso a dados',
423
+ dao: 'DAO - Data Access Object',
424
+ model: 'Modelo - Entidade/Modelo de dados',
425
+ entity: 'Entidade - Objeto de domínio',
426
+ schema: 'Schema - Definição de estrutura de dados',
427
+ migration: 'Migration - Alteração de banco de dados',
428
+ aggregate: 'Aggregate - Raiz de agregação DDD',
429
+ valueobject: 'Value Object - Objeto de valor imutável',
430
+ domainevent: 'Domain Event - Evento de domínio',
431
+ adapter: 'Adapter - Adapta interface externa',
432
+ gateway: 'Gateway - Interface para sistema externo',
433
+ client: 'Client - Cliente HTTP/API',
434
+ provider: 'Provider - Provedor de serviço/dependência',
435
+ config: 'Configuração - Setup e configurações',
436
+ settings: 'Settings - Configurações do projeto',
437
+ env: 'Environment - Variáveis de ambiente',
438
+ utils: 'Utilitários - Funções auxiliares',
439
+ helpers: 'Helpers - Funções de apoio',
440
+ common: 'Common - Código compartilhado',
441
+ shared: 'Shared - Recursos compartilhados',
442
+ lib: 'Library - Biblioteca interna',
443
+ test: 'Teste - Testes unitários/integração',
444
+ spec: 'Spec - Especificação/teste',
445
+ mock: 'Mock - Simulação para testes',
446
+ fixture: 'Fixture - Dados de teste',
447
+ component: 'Componente - Componente de UI',
448
+ page: 'Page - Página da aplicação',
449
+ layout: 'Layout - Template de layout',
450
+ style: 'Style - Estilos CSS/styled',
451
+ event: 'Event - Definição de evento',
452
+ listener: 'Listener - Ouvinte de evento',
453
+ subscriber: 'Subscriber - Assinante de evento',
454
+ producer: 'Producer - Produtor de evento',
455
+ consumer: 'Consumer - Consumidor de evento/mensagem',
456
+ middleware: 'Middleware - Interceptador de requisições',
457
+ guard: 'Guard - Proteção de rotas/recursos',
458
+ interceptor: 'Interceptor - Intercepta execução',
459
+ filter: 'Filter - Filtro de dados/requisições',
460
+ pipe: 'Pipe - Transformação de dados',
461
+ decorator: 'Decorator - Decorador/annotation',
462
+ job: 'Job - Tarefa em background',
463
+ worker: 'Worker - Processador de tarefas',
464
+ queue: 'Queue - Fila de processamento',
465
+ schedule: 'Schedule - Tarefa agendada',
466
+ cron: 'Cron - Job periódico',
467
+ dto: 'DTO - Data Transfer Object',
468
+ request: 'Request - Objeto de requisição',
469
+ response: 'Response - Objeto de resposta',
470
+ serializer: 'Serializer - Serialização de dados',
471
+ validator: 'Validator - Validação de dados'
472
+ };
473
+ let ProjectAnalyzerService = class ProjectAnalyzerService {
474
+ async analyze(projectPath = process.cwd()) {
475
+ const name = _path.basename(projectPath);
476
+ const languages = await this.detectLanguages(projectPath);
477
+ const primaryLanguage = languages[0] || 'unknown';
478
+ const structure = await this.analyzeStructure(projectPath, primaryLanguage);
479
+ const architecture = await this.detectArchitecture(projectPath, structure.directories);
480
+ const modules = await this.analyzeModules(projectPath, structure.directories);
481
+ const dependencies = await this.getDependencies(projectPath, primaryLanguage);
482
+ const conventions = await this.detectConventions(projectPath);
483
+ const allFiles = await this.getAllFiles(projectPath, languages);
484
+ const configFiles = await this.getConfigFiles(projectPath);
485
+ const objective = this.generateObjective(name, primaryLanguage, architecture);
486
+ const description = this.generateDescription(name, primaryLanguage, architecture, modules.length);
487
+ return {
488
+ name,
489
+ objective,
490
+ description,
491
+ primaryLanguage,
492
+ languages,
493
+ architecture,
494
+ structure,
495
+ modules,
496
+ dependencies,
497
+ conventions,
498
+ rawData: {
499
+ allFiles,
500
+ configFiles
501
+ }
502
+ };
503
+ }
504
+ async detectLanguages(projectPath) {
505
+ const languages = [];
506
+ const counts = {};
507
+ for (const [key, config] of Object.entries(LANGUAGES)){
508
+ try {
509
+ const files = await (0, _glob.glob)(`**/*{${config.extensions.join(',')}}`, {
510
+ cwd: projectPath,
511
+ nodir: true,
512
+ ignore: [
513
+ 'node_modules/**',
514
+ '**/node_modules/**',
515
+ '.git/**',
516
+ 'dist/**',
517
+ 'build/**',
518
+ 'target/**'
519
+ ]
520
+ });
521
+ if (files.length > 0) {
522
+ counts[key] = files.length;
523
+ }
524
+ } catch {}
525
+ }
526
+ return Object.entries(counts).sort((a, b)=>b[1] - a[1]).map(([lang])=>lang);
527
+ }
528
+ async analyzeStructure(projectPath, primaryLanguage) {
529
+ const langConfig = LANGUAGES[primaryLanguage];
530
+ const directories = [];
531
+ const entryPoints = [];
532
+ const commonDirs = [
533
+ 'src',
534
+ 'lib',
535
+ 'app',
536
+ 'source',
537
+ 'core',
538
+ 'packages',
539
+ 'internal',
540
+ 'cmd',
541
+ 'pkg'
542
+ ];
543
+ for (const dir of commonDirs){
544
+ try {
545
+ const stat = await _promises.stat(_path.join(projectPath, dir));
546
+ if (stat.isDirectory()) {
547
+ directories.push(dir);
548
+ }
549
+ } catch {}
550
+ }
551
+ if (langConfig) {
552
+ for (const pattern of langConfig.entryPatterns){
553
+ try {
554
+ await _promises.access(_path.join(projectPath, pattern));
555
+ entryPoints.push(pattern);
556
+ } catch {}
557
+ }
558
+ }
559
+ return {
560
+ root: projectPath,
561
+ directories,
562
+ entryPoints
563
+ };
564
+ }
565
+ async detectArchitecture(projectPath, directories) {
566
+ const dirSet = new Set(directories.map((d)=>d.toLowerCase()));
567
+ const allDirs = await this.getAllDirectories(projectPath);
568
+ const allDirsLower = allDirs.map((d)=>d.toLowerCase());
569
+ let bestMatch = null;
570
+ for (const pattern of ARCHITECTURE_PATTERNS){
571
+ const matchingIndicators = pattern.indicators.filter((indicator)=>allDirsLower.some((dir)=>dir.includes(indicator.toLowerCase())));
572
+ if (matchingIndicators.length > 0) {
573
+ if (!bestMatch || matchingIndicators.length > bestMatch.count) {
574
+ bestMatch = {
575
+ pattern,
576
+ count: matchingIndicators.length
577
+ };
578
+ }
579
+ }
580
+ }
581
+ if (bestMatch) {
582
+ const confidence = bestMatch.count >= 3 ? 'high' : bestMatch.count >= 2 ? 'medium' : 'low';
583
+ return {
584
+ pattern: bestMatch.pattern.name,
585
+ description: bestMatch.pattern.description,
586
+ confidence
587
+ };
588
+ }
589
+ return undefined;
590
+ }
591
+ async analyzeModules(projectPath, directories) {
592
+ const modules = [];
593
+ for (const dir of directories){
594
+ const dirPath = _path.join(projectPath, dir);
595
+ try {
596
+ const entries = await _promises.readdir(dirPath, {
597
+ withFileTypes: true
598
+ });
599
+ for (const entry of entries){
600
+ if (entry.isDirectory() && !entry.name.startsWith('.') && !entry.name.startsWith('_')) {
601
+ const modulePath = _path.join(dirPath, entry.name);
602
+ const files = await this.getFilesInDir(modulePath);
603
+ const keyFiles = files.slice(0, 5);
604
+ const role = this.detectRole(entry.name);
605
+ modules.push({
606
+ name: entry.name,
607
+ path: _path.join(dir, entry.name),
608
+ role,
609
+ fileCount: files.length,
610
+ keyFiles
611
+ });
612
+ }
613
+ }
614
+ } catch {}
615
+ }
616
+ return modules.sort((a, b)=>b.fileCount - a.fileCount);
617
+ }
618
+ detectRole(dirName) {
619
+ const lower = dirName.toLowerCase();
620
+ for (const [pattern, role] of Object.entries(PATTERN_ROLES)){
621
+ if (lower.includes(pattern)) {
622
+ return role;
623
+ }
624
+ }
625
+ if ([
626
+ 'auth',
627
+ 'authentication',
628
+ 'security'
629
+ ].some((p)=>lower.includes(p))) {
630
+ return 'Autenticação e autorização';
631
+ }
632
+ if ([
633
+ 'user',
634
+ 'users',
635
+ 'account',
636
+ 'accounts'
637
+ ].some((p)=>lower.includes(p))) {
638
+ return 'Gestão de usuários/contas';
639
+ }
640
+ if ([
641
+ 'payment',
642
+ 'billing',
643
+ 'finance',
644
+ 'subscription'
645
+ ].some((p)=>lower.includes(p))) {
646
+ return 'Pagamentos e faturamento';
647
+ }
648
+ if ([
649
+ 'notification',
650
+ 'email',
651
+ 'sms',
652
+ 'push'
653
+ ].some((p)=>lower.includes(p))) {
654
+ return 'Notificações';
655
+ }
656
+ if ([
657
+ 'api',
658
+ 'rest',
659
+ 'graphql',
660
+ 'grpc'
661
+ ].some((p)=>lower.includes(p))) {
662
+ return 'API/Interface externa';
663
+ }
664
+ if ([
665
+ 'db',
666
+ 'database',
667
+ 'storage',
668
+ 'cache'
669
+ ].some((p)=>lower.includes(p))) {
670
+ return 'Persistência de dados';
671
+ }
672
+ if ([
673
+ 'queue',
674
+ 'job',
675
+ 'worker',
676
+ 'background'
677
+ ].some((p)=>lower.includes(p))) {
678
+ return 'Processamento em background';
679
+ }
680
+ if ([
681
+ 'frontend',
682
+ 'web',
683
+ 'ui',
684
+ 'mobile',
685
+ 'app'
686
+ ].some((p)=>lower.includes(p))) {
687
+ return 'Interface do usuário';
688
+ }
689
+ return 'Funcionalidade específica do domínio';
690
+ }
691
+ async getDependencies(projectPath, language) {
692
+ const internal = [];
693
+ const external = [];
694
+ switch(language){
695
+ case 'typescript':
696
+ case 'javascript':
697
+ try {
698
+ const pkg = JSON.parse(await _promises.readFile(_path.join(projectPath, 'package.json'), 'utf-8'));
699
+ const allDeps = {
700
+ ...pkg.dependencies,
701
+ ...pkg.devDependencies
702
+ };
703
+ for (const [name, version] of Object.entries(allDeps)){
704
+ if (name.startsWith('@') && name.includes('/')) {
705
+ const scope = name.split('/')[0];
706
+ if (scope === `@${pkg.name}` || name.startsWith('@internal')) {
707
+ internal.push(name);
708
+ } else {
709
+ external.push(name);
710
+ }
711
+ } else {
712
+ external.push(name);
713
+ }
714
+ }
715
+ } catch {}
716
+ break;
717
+ case 'python':
718
+ try {
719
+ const requirements = await _promises.readFile(_path.join(projectPath, 'requirements.txt'), 'utf-8');
720
+ external.push(...requirements.split('\n').map((line)=>line.split('==')[0].split('>=')[0].trim()).filter((line)=>line && !line.startsWith('#') && !line.startsWith('-')));
721
+ } catch {}
722
+ break;
723
+ case 'go':
724
+ try {
725
+ const modContent = await _promises.readFile(_path.join(projectPath, 'go.mod'), 'utf-8');
726
+ const matches = modContent.match(/require\s+\(([^)]+)\)/s);
727
+ if (matches) {
728
+ external.push(...matches[1].split('\n').map((line)=>line.trim().split(' ')[0]).filter((line)=>line && !line.startsWith('//')));
729
+ }
730
+ } catch {}
731
+ break;
732
+ case 'rust':
733
+ try {
734
+ const cargo = await _promises.readFile(_path.join(projectPath, 'Cargo.toml'), 'utf-8');
735
+ const matches = cargo.match(/\[dependencies\]([^\[]+)/);
736
+ if (matches) {
737
+ external.push(...matches[1].split('\n').map((line)=>line.split('=')[0].trim()).filter((line)=>line && !line.startsWith('#')));
738
+ }
739
+ } catch {}
740
+ break;
741
+ }
742
+ return {
743
+ internal: [
744
+ ...new Set(internal)
745
+ ].slice(0, 10),
746
+ external: [
747
+ ...new Set(external)
748
+ ].slice(0, 20)
749
+ };
750
+ }
751
+ async detectConventions(projectPath) {
752
+ const naming = 'mixed';
753
+ let testing = false;
754
+ let linting = false;
755
+ try {
756
+ await _promises.access(_path.join(projectPath, 'test'));
757
+ testing = true;
758
+ } catch {
759
+ try {
760
+ await _promises.access(_path.join(projectPath, 'tests'));
761
+ testing = true;
762
+ } catch {}
763
+ }
764
+ const lintFiles = [
765
+ '.eslintrc',
766
+ '.eslintrc.js',
767
+ '.eslintrc.json',
768
+ 'pyproject.toml',
769
+ 'setup.cfg'
770
+ ];
771
+ for (const file of lintFiles){
772
+ try {
773
+ await _promises.access(_path.join(projectPath, file));
774
+ linting = true;
775
+ break;
776
+ } catch {}
777
+ }
778
+ return {
779
+ naming,
780
+ testing,
781
+ linting
782
+ };
783
+ }
784
+ async getAllFiles(projectPath, languages) {
785
+ const allFiles = [];
786
+ const extensions = languages.flatMap((lang)=>LANGUAGES[lang]?.extensions || []);
787
+ if (extensions.length === 0) return allFiles;
788
+ try {
789
+ const files = await (0, _glob.glob)(`**/*{${extensions.join(',')}}`, {
790
+ cwd: projectPath,
791
+ nodir: true,
792
+ ignore: [
793
+ '**/node_modules/**',
794
+ '**/.git/**',
795
+ '**/dist/**',
796
+ '**/build/**',
797
+ '**/target/**',
798
+ '**/__pycache__/**'
799
+ ]
800
+ });
801
+ allFiles.push(...files);
802
+ } catch {}
803
+ return allFiles.slice(0, 100);
804
+ }
805
+ async getConfigFiles(projectPath) {
806
+ const configFiles = [];
807
+ const patterns = [
808
+ '*.config.*',
809
+ '.*rc*',
810
+ 'Makefile',
811
+ 'Dockerfile*',
812
+ 'docker-compose*',
813
+ '.env*',
814
+ '*.toml',
815
+ '*.yaml',
816
+ '*.yml',
817
+ '*.json'
818
+ ];
819
+ for (const pattern of patterns){
820
+ try {
821
+ const files = await (0, _glob.glob)(pattern, {
822
+ cwd: projectPath,
823
+ nodir: true
824
+ });
825
+ configFiles.push(...files);
826
+ } catch {}
827
+ }
828
+ return [
829
+ ...new Set(configFiles)
830
+ ].slice(0, 20);
831
+ }
832
+ async getAllDirectories(projectPath) {
833
+ const dirs = [];
834
+ try {
835
+ const entries = await _promises.readdir(projectPath, {
836
+ withFileTypes: true,
837
+ recursive: true
838
+ });
839
+ for (const entry of entries){
840
+ if (entry.isDirectory() && !entry.name.startsWith('.') && !entry.name.startsWith('_') && entry.name !== 'node_modules' && entry.name !== 'dist' && entry.name !== 'build') {
841
+ dirs.push(entry.name);
842
+ }
843
+ }
844
+ } catch {}
845
+ return dirs;
846
+ }
847
+ async getFilesInDir(dirPath) {
848
+ try {
849
+ const files = await (0, _glob.glob)('**/*', {
850
+ cwd: dirPath,
851
+ nodir: true,
852
+ ignore: [
853
+ '*.spec.*',
854
+ '*.test.*',
855
+ '*_test.*',
856
+ '__pycache__/**'
857
+ ]
858
+ });
859
+ return files;
860
+ } catch {
861
+ return [];
862
+ }
863
+ }
864
+ generateObjective(name, language, architecture) {
865
+ const parts = [
866
+ `Desenvolver e manter o projeto ${name}`
867
+ ];
868
+ if (language !== 'unknown') {
869
+ parts.push(`utilizando ${LANGUAGES[language]?.name || language}`);
870
+ }
871
+ if (architecture) {
872
+ parts.push(`com arquitetura ${architecture.pattern}`);
873
+ }
874
+ return parts.join(' ') + '.';
875
+ }
876
+ generateDescription(name, language, architecture, moduleCount) {
877
+ const parts = [
878
+ `Projeto ${name}`
879
+ ];
880
+ if (language !== 'unknown') {
881
+ parts.push(`desenvolvido em ${LANGUAGES[language]?.name || language}`);
882
+ }
883
+ if (architecture) {
884
+ parts.push(`seguindo ${architecture.pattern}`);
885
+ }
886
+ if (moduleCount > 0) {
887
+ parts.push(`com ${moduleCount} módulo(s) organizado(s)`);
888
+ }
889
+ return parts.join(' ') + '.';
890
+ }
891
+ generateMarkdown(context) {
892
+ const lines = [];
893
+ lines.push('---');
894
+ lines.push(`name: ${context.name}`);
895
+ lines.push(`objective: |`);
896
+ lines.push(` ${context.objective}`);
897
+ lines.push(`primary_language: ${context.primaryLanguage}`);
898
+ lines.push(`languages:`);
899
+ context.languages.forEach((lang)=>{
900
+ const langName = LANGUAGES[lang]?.name || lang;
901
+ lines.push(` - ${langName}`);
902
+ });
903
+ if (context.architecture) {
904
+ lines.push(`architecture:`);
905
+ lines.push(` pattern: ${context.architecture.pattern}`);
906
+ lines.push(` confidence: ${context.architecture.confidence}`);
907
+ }
908
+ lines.push('---');
909
+ lines.push('');
910
+ lines.push('# Visão Geral');
911
+ lines.push('');
912
+ lines.push(context.description);
913
+ lines.push('');
914
+ if (context.architecture) {
915
+ lines.push('## Arquitetura');
916
+ lines.push('');
917
+ lines.push(`**Padrão:** ${context.architecture.pattern}`);
918
+ lines.push('');
919
+ lines.push(`**Confiança:** ${context.architecture.confidence}`);
920
+ lines.push('');
921
+ lines.push(context.architecture.description);
922
+ lines.push('');
923
+ }
924
+ lines.push('## Estrutura');
925
+ lines.push('');
926
+ if (context.structure.entryPoints.length > 0) {
927
+ lines.push('### Pontos de Entrada');
928
+ context.structure.entryPoints.forEach((ep)=>lines.push(`- \`${ep}\``));
929
+ lines.push('');
930
+ }
931
+ if (context.structure.directories.length > 0) {
932
+ lines.push('### Diretórios Principais');
933
+ context.structure.directories.forEach((dir)=>lines.push(`- \`${dir}/\``));
934
+ lines.push('');
935
+ }
936
+ if (context.modules.length > 0) {
937
+ lines.push('## Módulos');
938
+ lines.push('');
939
+ context.modules.forEach((mod)=>{
940
+ lines.push(`### ${mod.name}`);
941
+ lines.push('');
942
+ lines.push(`**Caminho:** \`${mod.path}\``);
943
+ lines.push('');
944
+ lines.push(`**Papel:** ${mod.role}`);
945
+ lines.push('');
946
+ lines.push(`**Arquivos:** ${mod.fileCount}`);
947
+ lines.push('');
948
+ if (mod.keyFiles.length > 0) {
949
+ lines.push('**Arquivos-chave:**');
950
+ mod.keyFiles.forEach((file)=>lines.push(`- \`${file}\``));
951
+ lines.push('');
952
+ }
953
+ lines.push('---');
954
+ lines.push('');
955
+ });
956
+ }
957
+ if (context.dependencies.external.length > 0) {
958
+ lines.push('## Dependências');
959
+ lines.push('');
960
+ lines.push('### Externas Principais');
961
+ context.dependencies.external.slice(0, 15).forEach((dep)=>lines.push(`- ${dep}`));
962
+ lines.push('');
963
+ }
964
+ if (context.dependencies.internal.length > 0) {
965
+ lines.push('### Internas');
966
+ context.dependencies.internal.forEach((dep)=>lines.push(`- ${dep}`));
967
+ lines.push('');
968
+ }
969
+ lines.push('## Convenções');
970
+ lines.push('');
971
+ lines.push(`- **Nomenclatura:** ${context.conventions.naming}`);
972
+ lines.push(`- **Testes:** ${context.conventions.testing ? 'Sim' : 'Não detectado'}`);
973
+ lines.push(`- **Linting:** ${context.conventions.linting ? 'Sim' : 'Não detectado'}`);
974
+ lines.push('');
975
+ lines.push('## Estatísticas');
976
+ lines.push('');
977
+ lines.push(`- **Total de arquivos:** ${context.rawData.allFiles.length}`);
978
+ lines.push(`- **Arquivos de configuração:** ${context.rawData.configFiles.length}`);
979
+ lines.push(`- **Módulos:** ${context.modules.length}`);
980
+ lines.push('');
981
+ return lines.join('\n');
982
+ }
983
+ generateAgentInstructions(context) {
984
+ return `Analise profundamente o projeto "${context.name}" localizado em ${context.structure.root}.
985
+
986
+ ## Tarefas:
987
+
988
+ 1. **Explore a estrutura completa**
989
+ - Liste todos os diretórios principais
990
+ - Identifique a organização de pastas
991
+ - Encontre todos os arquivos de configuração
992
+
993
+ 2. **Analise os módulos**
994
+ ${context.modules.map((m)=>` - **${m.name}** (${m.path}): ${m.role}`).join('\n')}
995
+
996
+ 3. **Entenda as dependências**
997
+ - Analise o arquivo de dependências principal
998
+ - Identifique dependências críticas
999
+ - Entenda o propósito de cada dependência principal
1000
+
1001
+ 4. **Documente padrões de código**
1002
+ - Como são organizados os imports?
1003
+ - Quais convenções de nomenclatura são usadas?
1004
+ - Existe um estilo consistente de código?
1005
+
1006
+ 5. **Identifique fluxos de dados**
1007
+ - Como os dados fluem entre camadas?
1008
+ - Onde estão as validações?
1009
+ - Como é feita a persistência?
1010
+
1011
+ 6. **Encontre exemplos representativos**
1012
+ - Um controller/handler típico
1013
+ - Um serviço/caso de uso típico
1014
+ - Um modelo/entidade típica
1015
+ - Um teste típico (se existir)
1016
+
1017
+ ## Formato do Relatório:
1018
+
1019
+ Gere um resumo estruturado em Markdown com:
1020
+
1021
+ ### 1. Resumo Executivo
1022
+ - Propósito do projeto (1 parágrafo)
1023
+ - Arquitetura geral
1024
+ - Complexidade estimada
1025
+
1026
+ ### 2. Módulos Detalhados
1027
+ Para cada módulo encontrado:
1028
+ - Nome e propósito
1029
+ - Responsabilidades específicas
1030
+ - Interações com outros módulos
1031
+ - Arquivos principais
1032
+
1033
+ ### 3. Fluxos de Negócio
1034
+ - Principais operações/casos de uso
1035
+ - Como os dados entram e saem
1036
+ - Pontos críticos de validação
1037
+
1038
+ ### 4. Stack Completa
1039
+ - Linguagens e frameworks
1040
+ - Bancos de dados
1041
+ - Ferramentas de build/deploy
1042
+ - Bibliotecas significativas
1043
+
1044
+ ### 5. Convenções e Padrões
1045
+ - Estilo de código
1046
+ - Estrutura de commits
1047
+ - Organização de testes
1048
+ - Documentação
1049
+
1050
+ ### 6. Pontos de Atenção
1051
+ - Débito técnico aparente
1052
+ - Código duplicado
1053
+ - Dependências desatualizadas
1054
+ - Áreas complexas
1055
+
1056
+ Use as ferramentas disponíveis para explorar o código e gerar este relatório.`;
1057
+ }
1058
+ };
1059
+ ProjectAnalyzerService = _ts_decorate([
1060
+ (0, _common.Injectable)()
1061
+ ], ProjectAnalyzerService);
1062
+
1063
+ //# sourceMappingURL=project-analyzer.service.js.map