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,338 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "MonorepoDetectorService", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return MonorepoDetectorService;
9
+ }
10
+ });
11
+ const _common = require("@nestjs/common");
12
+ const _fs = /*#__PURE__*/ _interop_require_wildcard(require("fs"));
13
+ const _path = /*#__PURE__*/ _interop_require_wildcard(require("path"));
14
+ function _getRequireWildcardCache(nodeInterop) {
15
+ if (typeof WeakMap !== "function") return null;
16
+ var cacheBabelInterop = new WeakMap();
17
+ var cacheNodeInterop = new WeakMap();
18
+ return (_getRequireWildcardCache = function(nodeInterop) {
19
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
20
+ })(nodeInterop);
21
+ }
22
+ function _interop_require_wildcard(obj, nodeInterop) {
23
+ if (!nodeInterop && obj && obj.__esModule) {
24
+ return obj;
25
+ }
26
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
27
+ return {
28
+ default: obj
29
+ };
30
+ }
31
+ var cache = _getRequireWildcardCache(nodeInterop);
32
+ if (cache && cache.has(obj)) {
33
+ return cache.get(obj);
34
+ }
35
+ var newObj = {
36
+ __proto__: null
37
+ };
38
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
39
+ for(var key in obj){
40
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
41
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
42
+ if (desc && (desc.get || desc.set)) {
43
+ Object.defineProperty(newObj, key, desc);
44
+ } else {
45
+ newObj[key] = obj[key];
46
+ }
47
+ }
48
+ }
49
+ newObj.default = obj;
50
+ if (cache) {
51
+ cache.set(obj, newObj);
52
+ }
53
+ return newObj;
54
+ }
55
+ function _ts_decorate(decorators, target, key, desc) {
56
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
57
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
58
+ 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;
59
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
60
+ }
61
+ let MonorepoDetectorService = class MonorepoDetectorService {
62
+ detectMonorepo(repoPath) {
63
+ const modules = [];
64
+ const moduleMapping = {};
65
+ const patterns = [
66
+ {
67
+ dir: 'packages',
68
+ type: 'package'
69
+ },
70
+ {
71
+ dir: 'apps',
72
+ type: 'app'
73
+ },
74
+ {
75
+ dir: 'modules',
76
+ type: 'module'
77
+ },
78
+ {
79
+ dir: 'src/modules',
80
+ type: 'module'
81
+ },
82
+ {
83
+ dir: 'projects',
84
+ type: 'project'
85
+ },
86
+ {
87
+ dir: 'libs',
88
+ type: 'lib'
89
+ },
90
+ {
91
+ dir: 'services',
92
+ type: 'service'
93
+ },
94
+ {
95
+ dir: 'frontend',
96
+ type: 'frontend'
97
+ },
98
+ {
99
+ dir: 'backend',
100
+ type: 'backend'
101
+ },
102
+ {
103
+ dir: 'api',
104
+ type: 'api'
105
+ },
106
+ {
107
+ dir: 'web',
108
+ type: 'web'
109
+ },
110
+ {
111
+ dir: 'mobile',
112
+ type: 'mobile'
113
+ }
114
+ ];
115
+ for (const { dir, type } of patterns){
116
+ const fullPath = _path.join(repoPath, dir);
117
+ if (_fs.existsSync(fullPath) && _fs.statSync(fullPath).isDirectory()) {
118
+ const subdirs = _fs.readdirSync(fullPath, {
119
+ withFileTypes: true
120
+ }).filter((d)=>d.isDirectory() && !d.name.startsWith('.') && d.name !== 'node_modules').map((d)=>d.name);
121
+ if (subdirs.length > 0) {
122
+ for (const subdir of subdirs){
123
+ const moduleName = this.inferModuleName(dir, subdir, type);
124
+ if (!modules.includes(moduleName)) {
125
+ modules.push(moduleName);
126
+ }
127
+ moduleMapping[_path.join(dir, subdir)] = moduleName;
128
+ }
129
+ } else {
130
+ const moduleName = _path.basename(dir);
131
+ if (!modules.includes(moduleName)) {
132
+ modules.push(moduleName);
133
+ }
134
+ moduleMapping[dir] = moduleName;
135
+ }
136
+ }
137
+ }
138
+ const workspaceFile = this.findWorkspaceFile(repoPath);
139
+ if (workspaceFile) {
140
+ const workspaceModules = this.parseWorkspaceFile(workspaceFile, repoPath);
141
+ for (const mod of workspaceModules){
142
+ if (!modules.includes(mod)) {
143
+ modules.push(mod);
144
+ }
145
+ }
146
+ }
147
+ const nxConfig = _path.join(repoPath, 'nx.json');
148
+ if (_fs.existsSync(nxConfig)) {
149
+ try {
150
+ const nxData = JSON.parse(_fs.readFileSync(nxConfig, 'utf-8'));
151
+ if (nxData.projects) {
152
+ for (const [projectName, projectPath] of Object.entries(nxData.projects)){
153
+ if (typeof projectPath === 'string') {
154
+ if (!modules.includes(projectName)) {
155
+ modules.push(projectName);
156
+ }
157
+ moduleMapping[projectPath] = projectName;
158
+ }
159
+ }
160
+ }
161
+ } catch {
162
+ // Ignore parsing errors
163
+ }
164
+ }
165
+ return {
166
+ isMonorepo: modules.length > 0,
167
+ rootDir: repoPath,
168
+ modules,
169
+ moduleMapping
170
+ };
171
+ }
172
+ determineScope(files, monorepoInfo) {
173
+ if (!monorepoInfo.isMonorepo || files.length === 0) {
174
+ return undefined;
175
+ }
176
+ const scopes = new Set();
177
+ for (const file of files){
178
+ const scope = this.findModuleForFile(file, monorepoInfo);
179
+ if (scope) {
180
+ scopes.add(scope);
181
+ }
182
+ }
183
+ if (scopes.size === 1) {
184
+ return Array.from(scopes)[0];
185
+ }
186
+ if (scopes.size > 1) {
187
+ return this.findCommonScope(Array.from(scopes));
188
+ }
189
+ return undefined;
190
+ }
191
+ inferModuleName(parentDir, subdir, type) {
192
+ const normalized = subdir.toLowerCase().replace(/[^a-z0-9]/g, '-');
193
+ if ([
194
+ 'api',
195
+ 'web',
196
+ 'mobile',
197
+ 'frontend',
198
+ 'backend',
199
+ 'admin',
200
+ 'core',
201
+ 'shared'
202
+ ].includes(normalized)) {
203
+ return normalized;
204
+ }
205
+ if (parentDir === 'src/modules') {
206
+ return normalized;
207
+ }
208
+ return normalized;
209
+ }
210
+ findModuleForFile(file, monorepoInfo) {
211
+ for (const [modulePath, moduleName] of Object.entries(monorepoInfo.moduleMapping)){
212
+ if (file.startsWith(modulePath + '/') || file === modulePath) {
213
+ return moduleName;
214
+ }
215
+ }
216
+ const patterns = [
217
+ /^packages\/([^/]+)/,
218
+ /^apps\/([^/]+)/,
219
+ /^modules\/([^/]+)/,
220
+ /^src\/modules\/([^/]+)/,
221
+ /^projects\/([^/]+)/,
222
+ /^libs\/([^/]+)/,
223
+ /^services\/([^/]+)/,
224
+ /^([^/]+)\/src/
225
+ ];
226
+ for (const pattern of patterns){
227
+ const match = file.match(pattern);
228
+ if (match) {
229
+ return match[1];
230
+ }
231
+ }
232
+ return undefined;
233
+ }
234
+ findCommonScope(scopes) {
235
+ if (scopes.length === 0) return undefined;
236
+ if (scopes.length === 1) return scopes[0];
237
+ const first = scopes[0];
238
+ let common = first;
239
+ for (const scope of scopes.slice(1)){
240
+ while(!scope.startsWith(common) && common.length > 0){
241
+ common = common.slice(0, -1);
242
+ }
243
+ }
244
+ common = common.replace(/[-_/]+$/, '');
245
+ if (common.length < 2 || [
246
+ 'src',
247
+ 'lib',
248
+ 'app'
249
+ ].includes(common)) {
250
+ return undefined;
251
+ }
252
+ return common || undefined;
253
+ }
254
+ findWorkspaceFile(repoPath) {
255
+ const files = [
256
+ 'pnpm-workspace.yaml',
257
+ 'pnpm-workspace.yml',
258
+ 'lerna.json'
259
+ ];
260
+ for (const file of files){
261
+ const fullPath = _path.join(repoPath, file);
262
+ if (_fs.existsSync(fullPath)) {
263
+ return fullPath;
264
+ }
265
+ }
266
+ const packageJson = _path.join(repoPath, 'package.json');
267
+ if (_fs.existsSync(packageJson)) {
268
+ try {
269
+ const pkg = JSON.parse(_fs.readFileSync(packageJson, 'utf-8'));
270
+ if (pkg.workspaces) {
271
+ return packageJson;
272
+ }
273
+ } catch {
274
+ // Ignore
275
+ }
276
+ }
277
+ return null;
278
+ }
279
+ parseWorkspaceFile(filePath, repoPath) {
280
+ const modules = [];
281
+ try {
282
+ if (filePath.endsWith('pnpm-workspace.yaml') || filePath.endsWith('pnpm-workspace.yml')) {
283
+ const content = _fs.readFileSync(filePath, 'utf-8');
284
+ const match = content.match(/packages:\s*\n((?:\s*-\s*[^\n]+\n?)+)/);
285
+ if (match) {
286
+ const lines = match[1].split('\n');
287
+ for (const line of lines){
288
+ const pkgMatch = line.match(/-\s*['"]?([^'"\n]+)['"]?/);
289
+ if (pkgMatch) {
290
+ const pattern = pkgMatch[1].replace('/*', '');
291
+ const fullPath = _path.join(repoPath, pattern);
292
+ if (_fs.existsSync(fullPath)) {
293
+ const subdirs = _fs.readdirSync(fullPath, {
294
+ withFileTypes: true
295
+ }).filter((d)=>d.isDirectory() && !d.name.startsWith('.')).map((d)=>d.name);
296
+ modules.push(...subdirs);
297
+ }
298
+ }
299
+ }
300
+ }
301
+ } else if (filePath.endsWith('package.json')) {
302
+ const pkg = JSON.parse(_fs.readFileSync(filePath, 'utf-8'));
303
+ const workspaces = pkg.workspaces;
304
+ if (Array.isArray(workspaces)) {
305
+ for (const pattern of workspaces){
306
+ const dir = pattern.replace('/*', '');
307
+ const fullPath = _path.join(repoPath, dir);
308
+ if (_fs.existsSync(fullPath)) {
309
+ const subdirs = _fs.readdirSync(fullPath, {
310
+ withFileTypes: true
311
+ }).filter((d)=>d.isDirectory() && !d.name.startsWith('.')).map((d)=>d.name);
312
+ modules.push(...subdirs);
313
+ }
314
+ }
315
+ } else if (workspaces?.packages) {
316
+ for (const pattern of workspaces.packages){
317
+ const dir = pattern.replace('/*', '');
318
+ const fullPath = _path.join(repoPath, dir);
319
+ if (_fs.existsSync(fullPath)) {
320
+ const subdirs = _fs.readdirSync(fullPath, {
321
+ withFileTypes: true
322
+ }).filter((d)=>d.isDirectory() && !d.name.startsWith('.')).map((d)=>d.name);
323
+ modules.push(...subdirs);
324
+ }
325
+ }
326
+ }
327
+ }
328
+ } catch {
329
+ // Ignore errors
330
+ }
331
+ return modules;
332
+ }
333
+ };
334
+ MonorepoDetectorService = _ts_decorate([
335
+ (0, _common.Injectable)()
336
+ ], MonorepoDetectorService);
337
+
338
+ //# sourceMappingURL=monorepo-detector.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/modules/git/services/monorepo-detector.service.ts"],"sourcesContent":["import { Injectable } from '@nestjs/common';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { MonorepoInfo } from '../types/git.types';\n\n@Injectable()\nexport class MonorepoDetectorService {\n detectMonorepo(repoPath: string): MonorepoInfo {\n const modules: string[] = [];\n const moduleMapping: Record<string, string> = {};\n\n const patterns = [\n { dir: 'packages', type: 'package' },\n { dir: 'apps', type: 'app' },\n { dir: 'modules', type: 'module' },\n { dir: 'src/modules', type: 'module' },\n { dir: 'projects', type: 'project' },\n { dir: 'libs', type: 'lib' },\n { dir: 'services', type: 'service' },\n { dir: 'frontend', type: 'frontend' },\n { dir: 'backend', type: 'backend' },\n { dir: 'api', type: 'api' },\n { dir: 'web', type: 'web' },\n { dir: 'mobile', type: 'mobile' },\n ];\n\n for (const { dir, type } of patterns) {\n const fullPath = path.join(repoPath, dir);\n if (fs.existsSync(fullPath) && fs.statSync(fullPath).isDirectory()) {\n const subdirs = fs\n .readdirSync(fullPath, { withFileTypes: true })\n .filter((d) => d.isDirectory() && !d.name.startsWith('.') && d.name !== 'node_modules')\n .map((d) => d.name);\n\n if (subdirs.length > 0) {\n for (const subdir of subdirs) {\n const moduleName = this.inferModuleName(dir, subdir, type);\n if (!modules.includes(moduleName)) {\n modules.push(moduleName);\n }\n moduleMapping[path.join(dir, subdir)] = moduleName;\n }\n } else {\n const moduleName = path.basename(dir);\n if (!modules.includes(moduleName)) {\n modules.push(moduleName);\n }\n moduleMapping[dir] = moduleName;\n }\n }\n }\n\n const workspaceFile = this.findWorkspaceFile(repoPath);\n if (workspaceFile) {\n const workspaceModules = this.parseWorkspaceFile(workspaceFile, repoPath);\n for (const mod of workspaceModules) {\n if (!modules.includes(mod)) {\n modules.push(mod);\n }\n }\n }\n\n const nxConfig = path.join(repoPath, 'nx.json');\n if (fs.existsSync(nxConfig)) {\n try {\n const nxData = JSON.parse(fs.readFileSync(nxConfig, 'utf-8'));\n if (nxData.projects) {\n for (const [projectName, projectPath] of Object.entries(nxData.projects)) {\n if (typeof projectPath === 'string') {\n if (!modules.includes(projectName)) {\n modules.push(projectName);\n }\n moduleMapping[projectPath] = projectName;\n }\n }\n }\n } catch {\n // Ignore parsing errors\n }\n }\n\n return {\n isMonorepo: modules.length > 0,\n rootDir: repoPath,\n modules,\n moduleMapping,\n };\n }\n\n determineScope(files: string[], monorepoInfo: MonorepoInfo): string | undefined {\n if (!monorepoInfo.isMonorepo || files.length === 0) {\n return undefined;\n }\n\n const scopes = new Set<string>();\n\n for (const file of files) {\n const scope = this.findModuleForFile(file, monorepoInfo);\n if (scope) {\n scopes.add(scope);\n }\n }\n\n if (scopes.size === 1) {\n return Array.from(scopes)[0];\n }\n\n if (scopes.size > 1) {\n return this.findCommonScope(Array.from(scopes));\n }\n\n return undefined;\n }\n\n private inferModuleName(parentDir: string, subdir: string, type: string): string {\n const normalized = subdir.toLowerCase().replace(/[^a-z0-9]/g, '-');\n\n if (['api', 'web', 'mobile', 'frontend', 'backend', 'admin', 'core', 'shared'].includes(normalized)) {\n return normalized;\n }\n\n if (parentDir === 'src/modules') {\n return normalized;\n }\n\n return normalized;\n }\n\n private findModuleForFile(file: string, monorepoInfo: MonorepoInfo): string | undefined {\n for (const [modulePath, moduleName] of Object.entries(monorepoInfo.moduleMapping)) {\n if (file.startsWith(modulePath + '/') || file === modulePath) {\n return moduleName;\n }\n }\n\n const patterns = [\n /^packages\\/([^/]+)/,\n /^apps\\/([^/]+)/,\n /^modules\\/([^/]+)/,\n /^src\\/modules\\/([^/]+)/,\n /^projects\\/([^/]+)/,\n /^libs\\/([^/]+)/,\n /^services\\/([^/]+)/,\n /^([^/]+)\\/src/,\n ];\n\n for (const pattern of patterns) {\n const match = file.match(pattern);\n if (match) {\n return match[1];\n }\n }\n\n return undefined;\n }\n\n private findCommonScope(scopes: string[]): string | undefined {\n if (scopes.length === 0) return undefined;\n if (scopes.length === 1) return scopes[0];\n\n const first = scopes[0];\n let common = first;\n\n for (const scope of scopes.slice(1)) {\n while (!scope.startsWith(common) && common.length > 0) {\n common = common.slice(0, -1);\n }\n }\n\n common = common.replace(/[-_/]+$/, '');\n\n if (common.length < 2 || ['src', 'lib', 'app'].includes(common)) {\n return undefined;\n }\n\n return common || undefined;\n }\n\n private findWorkspaceFile(repoPath: string): string | null {\n const files = ['pnpm-workspace.yaml', 'pnpm-workspace.yml', 'lerna.json'];\n\n for (const file of files) {\n const fullPath = path.join(repoPath, file);\n if (fs.existsSync(fullPath)) {\n return fullPath;\n }\n }\n\n const packageJson = path.join(repoPath, 'package.json');\n if (fs.existsSync(packageJson)) {\n try {\n const pkg = JSON.parse(fs.readFileSync(packageJson, 'utf-8'));\n if (pkg.workspaces) {\n return packageJson;\n }\n } catch {\n // Ignore\n }\n }\n\n return null;\n }\n\n private parseWorkspaceFile(filePath: string, repoPath: string): string[] {\n const modules: string[] = [];\n\n try {\n if (filePath.endsWith('pnpm-workspace.yaml') || filePath.endsWith('pnpm-workspace.yml')) {\n const content = fs.readFileSync(filePath, 'utf-8');\n const match = content.match(/packages:\\s*\\n((?:\\s*-\\s*[^\\n]+\\n?)+)/);\n if (match) {\n const lines = match[1].split('\\n');\n for (const line of lines) {\n const pkgMatch = line.match(/-\\s*['\"]?([^'\"\\n]+)['\"]?/);\n if (pkgMatch) {\n const pattern = pkgMatch[1].replace('/*', '');\n const fullPath = path.join(repoPath, pattern);\n if (fs.existsSync(fullPath)) {\n const subdirs = fs\n .readdirSync(fullPath, { withFileTypes: true })\n .filter((d) => d.isDirectory() && !d.name.startsWith('.'))\n .map((d) => d.name);\n modules.push(...subdirs);\n }\n }\n }\n }\n } else if (filePath.endsWith('package.json')) {\n const pkg = JSON.parse(fs.readFileSync(filePath, 'utf-8'));\n const workspaces = pkg.workspaces;\n if (Array.isArray(workspaces)) {\n for (const pattern of workspaces) {\n const dir = pattern.replace('/*', '');\n const fullPath = path.join(repoPath, dir);\n if (fs.existsSync(fullPath)) {\n const subdirs = fs\n .readdirSync(fullPath, { withFileTypes: true })\n .filter((d) => d.isDirectory() && !d.name.startsWith('.'))\n .map((d) => d.name);\n modules.push(...subdirs);\n }\n }\n } else if (workspaces?.packages) {\n for (const pattern of workspaces.packages) {\n const dir = pattern.replace('/*', '');\n const fullPath = path.join(repoPath, dir);\n if (fs.existsSync(fullPath)) {\n const subdirs = fs\n .readdirSync(fullPath, { withFileTypes: true })\n .filter((d) => d.isDirectory() && !d.name.startsWith('.'))\n .map((d) => d.name);\n modules.push(...subdirs);\n }\n }\n }\n }\n } catch {\n // Ignore errors\n }\n\n return modules;\n }\n}\n"],"names":["MonorepoDetectorService","detectMonorepo","repoPath","modules","moduleMapping","patterns","dir","type","fullPath","path","join","fs","existsSync","statSync","isDirectory","subdirs","readdirSync","withFileTypes","filter","d","name","startsWith","map","length","subdir","moduleName","inferModuleName","includes","push","basename","workspaceFile","findWorkspaceFile","workspaceModules","parseWorkspaceFile","mod","nxConfig","nxData","JSON","parse","readFileSync","projects","projectName","projectPath","Object","entries","isMonorepo","rootDir","determineScope","files","monorepoInfo","undefined","scopes","Set","file","scope","findModuleForFile","add","size","Array","from","findCommonScope","parentDir","normalized","toLowerCase","replace","modulePath","pattern","match","first","common","slice","packageJson","pkg","workspaces","filePath","endsWith","content","lines","split","line","pkgMatch","isArray","packages"],"mappings":";;;;+BAMaA;;;eAAAA;;;wBANc;4DACP;8DACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIf,IAAA,AAAMA,0BAAN,MAAMA;IACXC,eAAeC,QAAgB,EAAgB;QAC7C,MAAMC,UAAoB,EAAE;QAC5B,MAAMC,gBAAwC,CAAC;QAE/C,MAAMC,WAAW;YACf;gBAAEC,KAAK;gBAAYC,MAAM;YAAU;YACnC;gBAAED,KAAK;gBAAQC,MAAM;YAAM;YAC3B;gBAAED,KAAK;gBAAWC,MAAM;YAAS;YACjC;gBAAED,KAAK;gBAAeC,MAAM;YAAS;YACrC;gBAAED,KAAK;gBAAYC,MAAM;YAAU;YACnC;gBAAED,KAAK;gBAAQC,MAAM;YAAM;YAC3B;gBAAED,KAAK;gBAAYC,MAAM;YAAU;YACnC;gBAAED,KAAK;gBAAYC,MAAM;YAAW;YACpC;gBAAED,KAAK;gBAAWC,MAAM;YAAU;YAClC;gBAAED,KAAK;gBAAOC,MAAM;YAAM;YAC1B;gBAAED,KAAK;gBAAOC,MAAM;YAAM;YAC1B;gBAAED,KAAK;gBAAUC,MAAM;YAAS;SACjC;QAED,KAAK,MAAM,EAAED,GAAG,EAAEC,IAAI,EAAE,IAAIF,SAAU;YACpC,MAAMG,WAAWC,MAAKC,IAAI,CAACR,UAAUI;YACrC,IAAIK,IAAGC,UAAU,CAACJ,aAAaG,IAAGE,QAAQ,CAACL,UAAUM,WAAW,IAAI;gBAClE,MAAMC,UAAUJ,IACbK,WAAW,CAACR,UAAU;oBAAES,eAAe;gBAAK,GAC5CC,MAAM,CAAC,CAACC,IAAMA,EAAEL,WAAW,MAAM,CAACK,EAAEC,IAAI,CAACC,UAAU,CAAC,QAAQF,EAAEC,IAAI,KAAK,gBACvEE,GAAG,CAAC,CAACH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