ai-first-cli 1.1.2 → 1.1.5

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 (264) hide show
  1. package/ANALISIS_MEJORAS.md +327 -0
  2. package/BUGS.md +455 -0
  3. package/CHANGELOG.md +100 -225
  4. package/TEST_RESULTS.md +198 -0
  5. package/TEST_RESULTS_COMPARATIVE.md +159 -0
  6. package/TEST_RESULTS_COMPLETE.md +127 -0
  7. package/TEST_RESULTS_COMPREHENSIVE.md +208 -0
  8. package/ai/ai_context.md +17 -10
  9. package/ai/ai_rules.md +5 -3
  10. package/ai/architecture.md +28 -7
  11. package/ai/cache.json +832 -52
  12. package/ai/context/features/commands.json +18 -0
  13. package/ai/context/features/src.json +61 -0
  14. package/ai/context/features/test-projects.json +56 -0
  15. package/ai/context/flows/account.json +9 -0
  16. package/ai/context/flows/add_.json +9 -0
  17. package/ai/context/flows/ai-first.json +9 -0
  18. package/ai/context/flows/auth..json +10 -0
  19. package/ai/context/flows/auth.json +12 -0
  20. package/ai/context/flows/dashboard.json +9 -0
  21. package/ai/context/flows/doctor.json +9 -0
  22. package/ai/context/flows/explore.json +9 -0
  23. package/ai/context/flows/list_.json +9 -0
  24. package/ai/context/flows/login.json +9 -0
  25. package/ai/context/flows/opportunity.json +9 -0
  26. package/ai/context/flows/remove_.json +9 -0
  27. package/ai/context/flows/user.json +14 -0
  28. package/ai/context/flows/users..json +10 -0
  29. package/ai/context/flows/users.json +9 -0
  30. package/ai/conventions.md +3 -2
  31. package/ai/dependencies.json +429 -251
  32. package/ai/entrypoints.md +10 -0
  33. package/ai/files.json +822 -46
  34. package/ai/git/commit-activity.json +126 -39
  35. package/ai/git/recent-features.json +3 -1
  36. package/ai/git/recent-files.json +6 -6
  37. package/ai/git/recent-flows.json +3 -1
  38. package/ai/graph/knowledge-graph.json +954 -182
  39. package/ai/graph/module-graph.json +270 -0
  40. package/ai/graph/symbol-graph.json +48991 -16523
  41. package/ai/graph/symbol-references.json +953 -56
  42. package/ai/hierarchy.json +3 -24
  43. package/ai/index-state.json +1261 -253
  44. package/ai/index.db +0 -0
  45. package/ai/modules.json +226 -0
  46. package/ai/project.json +29 -0
  47. package/ai/repo-map.json +2284 -250
  48. package/ai/repo_map.json +2731 -231
  49. package/ai/repo_map.md +559 -2
  50. package/ai/schema.json +5 -0
  51. package/ai/summary.md +16 -7
  52. package/ai/tech_stack.md +4 -1
  53. package/ai/tools.json +10 -0
  54. package/dist/analyzers/dependencies.d.ts.map +1 -1
  55. package/dist/analyzers/dependencies.js +8 -16
  56. package/dist/analyzers/dependencies.js.map +1 -1
  57. package/dist/analyzers/symbols.d.ts.map +1 -1
  58. package/dist/analyzers/symbols.js +60 -0
  59. package/dist/analyzers/symbols.js.map +1 -1
  60. package/dist/commands/ai-first.d.ts +1 -0
  61. package/dist/commands/ai-first.d.ts.map +1 -1
  62. package/dist/commands/ai-first.js +29 -6
  63. package/dist/commands/ai-first.js.map +1 -1
  64. package/dist/core/semanticContexts.d.ts.map +1 -1
  65. package/dist/core/semanticContexts.js +48 -26
  66. package/dist/core/semanticContexts.js.map +1 -1
  67. package/dist/core/symbolGraph.d.ts.map +1 -1
  68. package/dist/core/symbolGraph.js +14 -2
  69. package/dist/core/symbolGraph.js.map +1 -1
  70. package/dist/utils/fileUtils.d.ts.map +1 -1
  71. package/dist/utils/fileUtils.js +5 -0
  72. package/dist/utils/fileUtils.js.map +1 -1
  73. package/package.json +2 -2
  74. package/src/analyzers/dependencies.ts +10 -20
  75. package/src/analyzers/symbols.ts +64 -0
  76. package/src/commands/ai-first.ts +32 -8
  77. package/src/core/semanticContexts.ts +54 -29
  78. package/src/core/symbolGraph.ts +16 -2
  79. package/src/utils/fileUtils.ts +5 -0
  80. package/test-projects/express-api/ai/ai_context.md +112 -0
  81. package/test-projects/express-api/ai/ai_rules.md +50 -0
  82. package/test-projects/express-api/ai/architecture.md +62 -0
  83. package/test-projects/express-api/ai/cache.json +125 -0
  84. package/test-projects/express-api/ai/context/features/controllers.json +13 -0
  85. package/test-projects/express-api/ai/context/features/services.json +13 -0
  86. package/test-projects/express-api/ai/context/flows/auth.json +12 -0
  87. package/test-projects/express-api/ai/context/flows/user.json +13 -0
  88. package/test-projects/express-api/ai/conventions.md +51 -0
  89. package/test-projects/express-api/ai/dependencies.json +54 -0
  90. package/test-projects/express-api/ai/entrypoints.md +17 -0
  91. package/test-projects/express-api/ai/files.json +169 -0
  92. package/test-projects/express-api/ai/graph/knowledge-graph.json +98 -0
  93. package/test-projects/express-api/ai/graph/module-graph.json +44 -0
  94. package/test-projects/express-api/ai/graph/symbol-graph.json +882 -0
  95. package/test-projects/express-api/ai/graph/symbol-references.json +51 -0
  96. package/test-projects/express-api/ai/index-state.json +238 -0
  97. package/test-projects/express-api/ai/index.db +0 -0
  98. package/test-projects/express-api/ai/modules.json +30 -0
  99. package/test-projects/express-api/ai/project.json +15 -0
  100. package/test-projects/express-api/ai/repo-map.json +291 -0
  101. package/test-projects/express-api/ai/repo_map.json +100 -0
  102. package/test-projects/express-api/ai/repo_map.md +36 -0
  103. package/test-projects/express-api/ai/schema.json +5 -0
  104. package/test-projects/express-api/ai/summary.md +14 -0
  105. package/test-projects/express-api/ai/symbols.json +1174 -0
  106. package/test-projects/express-api/ai/tech_stack.md +38 -0
  107. package/test-projects/express-api/ai/tools.json +10 -0
  108. package/test-projects/express-api/controllers/authController.js +32 -0
  109. package/test-projects/express-api/controllers/userController.js +51 -0
  110. package/test-projects/express-api/index.js +21 -0
  111. package/test-projects/express-api/middleware/authMiddleware.js +30 -0
  112. package/test-projects/express-api/models/userRepository.js +25 -0
  113. package/test-projects/express-api/package.json +18 -0
  114. package/test-projects/express-api/services/authService.js +17 -0
  115. package/test-projects/express-api/services/userService.js +28 -0
  116. package/test-projects/nestjs-backend/ai/ai_context.md +110 -0
  117. package/test-projects/nestjs-backend/ai/ai_rules.md +52 -0
  118. package/test-projects/nestjs-backend/ai/architecture.md +43 -0
  119. package/test-projects/nestjs-backend/ai/cache.json +137 -0
  120. package/test-projects/nestjs-backend/ai/context/features/src.json +23 -0
  121. package/test-projects/nestjs-backend/ai/context/flows/auth..json +10 -0
  122. package/test-projects/nestjs-backend/ai/context/flows/users..json +10 -0
  123. package/test-projects/nestjs-backend/ai/conventions.md +52 -0
  124. package/test-projects/nestjs-backend/ai/dependencies.json +152 -0
  125. package/test-projects/nestjs-backend/ai/entrypoints.md +18 -0
  126. package/test-projects/nestjs-backend/ai/files.json +184 -0
  127. package/test-projects/nestjs-backend/ai/graph/knowledge-graph.json +74 -0
  128. package/test-projects/nestjs-backend/ai/graph/module-graph.json +29 -0
  129. package/test-projects/nestjs-backend/ai/graph/symbol-graph.json +304 -0
  130. package/test-projects/nestjs-backend/ai/graph/symbol-references.json +5 -0
  131. package/test-projects/nestjs-backend/ai/index-state.json +259 -0
  132. package/test-projects/nestjs-backend/ai/index.db +0 -0
  133. package/test-projects/nestjs-backend/ai/modules.json +19 -0
  134. package/test-projects/nestjs-backend/ai/project.json +14 -0
  135. package/test-projects/nestjs-backend/ai/repo-map.json +323 -0
  136. package/test-projects/nestjs-backend/ai/repo_map.json +141 -0
  137. package/test-projects/nestjs-backend/ai/repo_map.md +39 -0
  138. package/test-projects/nestjs-backend/ai/schema.json +5 -0
  139. package/test-projects/nestjs-backend/ai/summary.md +11 -0
  140. package/test-projects/nestjs-backend/ai/symbols.json +527 -0
  141. package/test-projects/nestjs-backend/ai/tech_stack.md +37 -0
  142. package/test-projects/nestjs-backend/ai/tools.json +10 -0
  143. package/test-projects/nestjs-backend/package.json +22 -0
  144. package/test-projects/nestjs-backend/src/app.module.ts +8 -0
  145. package/test-projects/nestjs-backend/src/auth/auth.controller.ts +22 -0
  146. package/test-projects/nestjs-backend/src/auth/auth.module.ts +11 -0
  147. package/test-projects/nestjs-backend/src/auth/auth.service.ts +28 -0
  148. package/test-projects/nestjs-backend/src/auth/dto/login.dto.ts +4 -0
  149. package/test-projects/nestjs-backend/src/auth/strategies/jwt.strategy.ts +18 -0
  150. package/test-projects/nestjs-backend/src/main.ts +9 -0
  151. package/test-projects/nestjs-backend/src/users/users.controller.ts +32 -0
  152. package/test-projects/nestjs-backend/src/users/users.module.ts +10 -0
  153. package/test-projects/nestjs-backend/src/users/users.service.ts +42 -0
  154. package/test-projects/nestjs-backend/tsconfig.json +21 -0
  155. package/test-projects/python-cli/__init__.py +1 -0
  156. package/test-projects/python-cli/ai/ai_context.md +94 -0
  157. package/test-projects/python-cli/ai/ai_rules.md +47 -0
  158. package/test-projects/python-cli/ai/architecture.md +49 -0
  159. package/test-projects/python-cli/ai/cache.json +129 -0
  160. package/test-projects/python-cli/ai/context/features/cli.json +16 -0
  161. package/test-projects/python-cli/ai/context/flows/add_.json +9 -0
  162. package/test-projects/python-cli/ai/context/flows/list_.json +9 -0
  163. package/test-projects/python-cli/ai/context/flows/remove_.json +9 -0
  164. package/test-projects/python-cli/ai/conventions.md +51 -0
  165. package/test-projects/python-cli/ai/dependencies.json +66 -0
  166. package/test-projects/python-cli/ai/entrypoints.md +4 -0
  167. package/test-projects/python-cli/ai/files.json +174 -0
  168. package/test-projects/python-cli/ai/graph/knowledge-graph.json +83 -0
  169. package/test-projects/python-cli/ai/graph/module-graph.json +31 -0
  170. package/test-projects/python-cli/ai/graph/symbol-graph.json +358 -0
  171. package/test-projects/python-cli/ai/graph/symbol-references.json +11 -0
  172. package/test-projects/python-cli/ai/index-state.json +245 -0
  173. package/test-projects/python-cli/ai/index.db +0 -0
  174. package/test-projects/python-cli/ai/modules.json +21 -0
  175. package/test-projects/python-cli/ai/project.json +15 -0
  176. package/test-projects/python-cli/ai/repo-map.json +290 -0
  177. package/test-projects/python-cli/ai/repo_map.json +99 -0
  178. package/test-projects/python-cli/ai/repo_map.md +32 -0
  179. package/test-projects/python-cli/ai/schema.json +5 -0
  180. package/test-projects/python-cli/ai/summary.md +11 -0
  181. package/test-projects/python-cli/ai/symbols.json +475 -0
  182. package/test-projects/python-cli/ai/tech_stack.md +30 -0
  183. package/test-projects/python-cli/ai/tools.json +10 -0
  184. package/test-projects/python-cli/cli/__init__.py +1 -0
  185. package/test-projects/python-cli/cli/add_command.py +6 -0
  186. package/test-projects/python-cli/cli/list_command.py +7 -0
  187. package/test-projects/python-cli/cli/remove_command.py +6 -0
  188. package/test-projects/python-cli/main.py +34 -0
  189. package/test-projects/python-cli/models/__init__.py +2 -0
  190. package/test-projects/python-cli/models/task.py +19 -0
  191. package/test-projects/python-cli/models/task_repository.py +44 -0
  192. package/test-projects/react-app/ai/ai_context.md +95 -0
  193. package/test-projects/react-app/ai/ai_rules.md +49 -0
  194. package/test-projects/react-app/ai/architecture.md +33 -0
  195. package/test-projects/react-app/ai/cache.json +129 -0
  196. package/test-projects/react-app/ai/context/features/src.json +18 -0
  197. package/test-projects/react-app/ai/context/flows/dashboard.json +9 -0
  198. package/test-projects/react-app/ai/context/flows/login.json +9 -0
  199. package/test-projects/react-app/ai/context/flows/users.json +9 -0
  200. package/test-projects/react-app/ai/conventions.md +52 -0
  201. package/test-projects/react-app/ai/dependencies.json +128 -0
  202. package/test-projects/react-app/ai/entrypoints.md +4 -0
  203. package/test-projects/react-app/ai/files.json +174 -0
  204. package/test-projects/react-app/ai/graph/knowledge-graph.json +83 -0
  205. package/test-projects/react-app/ai/graph/module-graph.json +31 -0
  206. package/test-projects/react-app/ai/graph/symbol-graph.json +868 -0
  207. package/test-projects/react-app/ai/graph/symbol-references.json +31 -0
  208. package/test-projects/react-app/ai/index-state.json +245 -0
  209. package/test-projects/react-app/ai/index.db +0 -0
  210. package/test-projects/react-app/ai/modules.json +17 -0
  211. package/test-projects/react-app/ai/project.json +15 -0
  212. package/test-projects/react-app/ai/repo-map.json +305 -0
  213. package/test-projects/react-app/ai/repo_map.json +114 -0
  214. package/test-projects/react-app/ai/repo_map.md +31 -0
  215. package/test-projects/react-app/ai/schema.json +5 -0
  216. package/test-projects/react-app/ai/summary.md +11 -0
  217. package/test-projects/react-app/ai/symbols.json +985 -0
  218. package/test-projects/react-app/ai/tech_stack.md +38 -0
  219. package/test-projects/react-app/ai/tools.json +10 -0
  220. package/test-projects/react-app/package.json +16 -0
  221. package/test-projects/react-app/src/App.tsx +21 -0
  222. package/test-projects/react-app/src/context/AuthContext.tsx +41 -0
  223. package/test-projects/react-app/src/hooks/useAuth.ts +10 -0
  224. package/test-projects/react-app/src/main.tsx +10 -0
  225. package/test-projects/react-app/src/pages/DashboardPage.tsx +17 -0
  226. package/test-projects/react-app/src/pages/LoginPage.tsx +41 -0
  227. package/test-projects/react-app/src/pages/UsersPage.tsx +36 -0
  228. package/test-projects/react-app/src/services/userService.ts +37 -0
  229. package/test-projects/salesforce-cli/.forceignore +27 -0
  230. package/test-projects/salesforce-cli/ai/ai_context.md +88 -0
  231. package/test-projects/salesforce-cli/ai/ai_rules.md +47 -0
  232. package/test-projects/salesforce-cli/ai/architecture.md +33 -0
  233. package/test-projects/salesforce-cli/ai/cache.json +105 -0
  234. package/test-projects/salesforce-cli/ai/context/features/force-app.json +14 -0
  235. package/test-projects/salesforce-cli/ai/context/flows/account.json +9 -0
  236. package/test-projects/salesforce-cli/ai/context/flows/opportunity.json +9 -0
  237. package/test-projects/salesforce-cli/ai/conventions.md +51 -0
  238. package/test-projects/salesforce-cli/ai/dependencies.json +6 -0
  239. package/test-projects/salesforce-cli/ai/entrypoints.md +4 -0
  240. package/test-projects/salesforce-cli/ai/files.json +144 -0
  241. package/test-projects/salesforce-cli/ai/graph/knowledge-graph.json +64 -0
  242. package/test-projects/salesforce-cli/ai/graph/module-graph.json +13 -0
  243. package/test-projects/salesforce-cli/ai/graph/symbol-graph.json +148 -0
  244. package/test-projects/salesforce-cli/ai/graph/symbol-references.json +1 -0
  245. package/test-projects/salesforce-cli/ai/index-state.json +203 -0
  246. package/test-projects/salesforce-cli/ai/index.db +0 -0
  247. package/test-projects/salesforce-cli/ai/modules.json +12 -0
  248. package/test-projects/salesforce-cli/ai/project.json +14 -0
  249. package/test-projects/salesforce-cli/ai/repo-map.json +251 -0
  250. package/test-projects/salesforce-cli/ai/repo_map.json +69 -0
  251. package/test-projects/salesforce-cli/ai/repo_map.md +21 -0
  252. package/test-projects/salesforce-cli/ai/schema.json +5 -0
  253. package/test-projects/salesforce-cli/ai/summary.md +11 -0
  254. package/test-projects/salesforce-cli/ai/symbols.json +245 -0
  255. package/test-projects/salesforce-cli/ai/tech_stack.md +30 -0
  256. package/test-projects/salesforce-cli/ai/tools.json +10 -0
  257. package/test-projects/salesforce-cli/force-app/main/default/classes/AccountController.cls +24 -0
  258. package/test-projects/salesforce-cli/force-app/main/default/classes/OpportunityController.cls +25 -0
  259. package/test-projects/salesforce-cli/force-app/main/default/objects/Project__c.object.xml +45 -0
  260. package/test-projects/salesforce-cli/force-app/main/default/triggers/AccountTrigger.trigger +33 -0
  261. package/test-projects/salesforce-cli/sfdx-project.json +11 -0
  262. package/tests/e2e/README.md +85 -0
  263. package/tests/e2e/run-e2e.sh +88 -0
  264. package/tests/semanticContexts.test.ts +23 -25
@@ -0,0 +1,527 @@
1
+ {
2
+ "symbols": {
3
+ "src/app.module.ts#AppModule": {
4
+ "name": "AppModule",
5
+ "type": "class",
6
+ "file": "src/app.module.ts",
7
+ "line": 8,
8
+ "module": "src",
9
+ "export": true
10
+ },
11
+ "src/auth/auth.controller.ts#AuthController": {
12
+ "name": "AuthController",
13
+ "type": "class",
14
+ "file": "src/auth/auth.controller.ts",
15
+ "line": 6,
16
+ "module": "src",
17
+ "export": true
18
+ },
19
+ "src/auth/auth.controller.ts#user": {
20
+ "name": "user",
21
+ "type": "const",
22
+ "file": "src/auth/auth.controller.ts",
23
+ "line": 11,
24
+ "module": "src",
25
+ "export": false
26
+ },
27
+ "src/auth/auth.module.ts#AuthModule": {
28
+ "name": "AuthModule",
29
+ "type": "class",
30
+ "file": "src/auth/auth.module.ts",
31
+ "line": 11,
32
+ "module": "src",
33
+ "export": true
34
+ },
35
+ "src/auth/auth.service.ts#AuthService": {
36
+ "name": "AuthService",
37
+ "type": "class",
38
+ "file": "src/auth/auth.service.ts",
39
+ "line": 5,
40
+ "module": "src",
41
+ "export": true
42
+ },
43
+ "src/auth/auth.service.ts#payload": {
44
+ "name": "payload",
45
+ "type": "const",
46
+ "file": "src/auth/auth.service.ts",
47
+ "line": 17,
48
+ "module": "src",
49
+ "export": false
50
+ },
51
+ "src/auth/dto/login.dto.ts#LoginDto": {
52
+ "name": "LoginDto",
53
+ "type": "class",
54
+ "file": "src/auth/dto/login.dto.ts",
55
+ "line": 1,
56
+ "module": "src",
57
+ "export": true
58
+ },
59
+ "src/auth/strategies/jwt.strategy.ts#JwtStrategy": {
60
+ "name": "JwtStrategy",
61
+ "type": "class",
62
+ "file": "src/auth/strategies/jwt.strategy.ts",
63
+ "line": 6,
64
+ "module": "src",
65
+ "export": true
66
+ },
67
+ "src/main.ts#bootstrap": {
68
+ "name": "bootstrap",
69
+ "type": "function",
70
+ "file": "src/main.ts",
71
+ "line": 4,
72
+ "module": "src",
73
+ "export": false
74
+ },
75
+ "src/main.ts#app": {
76
+ "name": "app",
77
+ "type": "const",
78
+ "file": "src/main.ts",
79
+ "line": 5,
80
+ "module": "src",
81
+ "export": false
82
+ },
83
+ "src/users/users.controller.ts#UsersController": {
84
+ "name": "UsersController",
85
+ "type": "class",
86
+ "file": "src/users/users.controller.ts",
87
+ "line": 5,
88
+ "module": "src",
89
+ "export": true
90
+ },
91
+ "src/users/users.module.ts#UsersModule": {
92
+ "name": "UsersModule",
93
+ "type": "class",
94
+ "file": "src/users/users.module.ts",
95
+ "line": 10,
96
+ "module": "src",
97
+ "export": true
98
+ },
99
+ "src/users/users.service.ts#User": {
100
+ "name": "User",
101
+ "type": "interface",
102
+ "file": "src/users/users.service.ts",
103
+ "line": 3,
104
+ "module": "src",
105
+ "export": false
106
+ },
107
+ "src/users/users.service.ts#UsersService": {
108
+ "name": "UsersService",
109
+ "type": "class",
110
+ "file": "src/users/users.service.ts",
111
+ "line": 10,
112
+ "module": "src",
113
+ "export": true
114
+ },
115
+ "src/users/users.service.ts#user": {
116
+ "name": "user",
117
+ "type": "const",
118
+ "file": "src/users/users.service.ts",
119
+ "line": 26,
120
+ "module": "src",
121
+ "export": false
122
+ },
123
+ "src/users/users.service.ts#index": {
124
+ "name": "index",
125
+ "type": "const",
126
+ "file": "src/users/users.service.ts",
127
+ "line": 39,
128
+ "module": "src",
129
+ "export": false
130
+ }
131
+ },
132
+ "total": 18,
133
+ "byType": {
134
+ "class": [
135
+ {
136
+ "id": "src/app.module.ts#AppModule",
137
+ "name": "AppModule",
138
+ "type": "class",
139
+ "file": "src/app.module.ts",
140
+ "line": 8,
141
+ "export": true
142
+ },
143
+ {
144
+ "id": "src/auth/auth.controller.ts#AuthController",
145
+ "name": "AuthController",
146
+ "type": "class",
147
+ "file": "src/auth/auth.controller.ts",
148
+ "line": 6,
149
+ "export": true
150
+ },
151
+ {
152
+ "id": "src/auth/auth.module.ts#AuthModule",
153
+ "name": "AuthModule",
154
+ "type": "class",
155
+ "file": "src/auth/auth.module.ts",
156
+ "line": 11,
157
+ "export": true
158
+ },
159
+ {
160
+ "id": "src/auth/auth.service.ts#AuthService",
161
+ "name": "AuthService",
162
+ "type": "class",
163
+ "file": "src/auth/auth.service.ts",
164
+ "line": 5,
165
+ "export": true
166
+ },
167
+ {
168
+ "id": "src/auth/dto/login.dto.ts#LoginDto",
169
+ "name": "LoginDto",
170
+ "type": "class",
171
+ "file": "src/auth/dto/login.dto.ts",
172
+ "line": 1,
173
+ "export": true
174
+ },
175
+ {
176
+ "id": "src/auth/strategies/jwt.strategy.ts#JwtStrategy",
177
+ "name": "JwtStrategy",
178
+ "type": "class",
179
+ "file": "src/auth/strategies/jwt.strategy.ts",
180
+ "line": 6,
181
+ "export": true
182
+ },
183
+ {
184
+ "id": "src/users/users.controller.ts#UsersController",
185
+ "name": "UsersController",
186
+ "type": "class",
187
+ "file": "src/users/users.controller.ts",
188
+ "line": 5,
189
+ "export": true
190
+ },
191
+ {
192
+ "id": "src/users/users.module.ts#UsersModule",
193
+ "name": "UsersModule",
194
+ "type": "class",
195
+ "file": "src/users/users.module.ts",
196
+ "line": 10,
197
+ "export": true
198
+ },
199
+ {
200
+ "id": "src/users/users.service.ts#UsersService",
201
+ "name": "UsersService",
202
+ "type": "class",
203
+ "file": "src/users/users.service.ts",
204
+ "line": 10,
205
+ "export": true
206
+ }
207
+ ],
208
+ "const": [
209
+ {
210
+ "id": "src/auth/auth.controller.ts#user",
211
+ "name": "user",
212
+ "type": "const",
213
+ "file": "src/auth/auth.controller.ts",
214
+ "line": 11,
215
+ "export": false
216
+ },
217
+ {
218
+ "id": "src/auth/auth.service.ts#payload",
219
+ "name": "payload",
220
+ "type": "const",
221
+ "file": "src/auth/auth.service.ts",
222
+ "line": 17,
223
+ "export": false
224
+ },
225
+ {
226
+ "id": "src/main.ts#app",
227
+ "name": "app",
228
+ "type": "const",
229
+ "file": "src/main.ts",
230
+ "line": 5,
231
+ "export": false
232
+ },
233
+ {
234
+ "id": "src/users/users.service.ts#user",
235
+ "name": "user",
236
+ "type": "const",
237
+ "file": "src/users/users.service.ts",
238
+ "line": 20,
239
+ "export": false
240
+ },
241
+ {
242
+ "id": "src/users/users.service.ts#user",
243
+ "name": "user",
244
+ "type": "const",
245
+ "file": "src/users/users.service.ts",
246
+ "line": 26,
247
+ "export": false
248
+ },
249
+ {
250
+ "id": "src/users/users.service.ts#index",
251
+ "name": "index",
252
+ "type": "const",
253
+ "file": "src/users/users.service.ts",
254
+ "line": 32,
255
+ "export": false
256
+ },
257
+ {
258
+ "id": "src/users/users.service.ts#index",
259
+ "name": "index",
260
+ "type": "const",
261
+ "file": "src/users/users.service.ts",
262
+ "line": 39,
263
+ "export": false
264
+ }
265
+ ],
266
+ "function": [
267
+ {
268
+ "id": "src/main.ts#bootstrap",
269
+ "name": "bootstrap",
270
+ "type": "function",
271
+ "file": "src/main.ts",
272
+ "line": 4,
273
+ "export": false
274
+ }
275
+ ],
276
+ "interface": [
277
+ {
278
+ "id": "src/users/users.service.ts#User",
279
+ "name": "User",
280
+ "type": "interface",
281
+ "file": "src/users/users.service.ts",
282
+ "line": 3,
283
+ "export": false
284
+ }
285
+ ]
286
+ },
287
+ "byFile": {
288
+ "src/app.module.ts": [
289
+ {
290
+ "id": "src/app.module.ts#AppModule",
291
+ "name": "AppModule",
292
+ "type": "class",
293
+ "file": "src/app.module.ts",
294
+ "line": 8,
295
+ "export": true
296
+ }
297
+ ],
298
+ "src/auth/auth.controller.ts": [
299
+ {
300
+ "id": "src/auth/auth.controller.ts#AuthController",
301
+ "name": "AuthController",
302
+ "type": "class",
303
+ "file": "src/auth/auth.controller.ts",
304
+ "line": 6,
305
+ "export": true
306
+ },
307
+ {
308
+ "id": "src/auth/auth.controller.ts#user",
309
+ "name": "user",
310
+ "type": "const",
311
+ "file": "src/auth/auth.controller.ts",
312
+ "line": 11,
313
+ "export": false
314
+ }
315
+ ],
316
+ "src/auth/auth.module.ts": [
317
+ {
318
+ "id": "src/auth/auth.module.ts#AuthModule",
319
+ "name": "AuthModule",
320
+ "type": "class",
321
+ "file": "src/auth/auth.module.ts",
322
+ "line": 11,
323
+ "export": true
324
+ }
325
+ ],
326
+ "src/auth/auth.service.ts": [
327
+ {
328
+ "id": "src/auth/auth.service.ts#AuthService",
329
+ "name": "AuthService",
330
+ "type": "class",
331
+ "file": "src/auth/auth.service.ts",
332
+ "line": 5,
333
+ "export": true
334
+ },
335
+ {
336
+ "id": "src/auth/auth.service.ts#payload",
337
+ "name": "payload",
338
+ "type": "const",
339
+ "file": "src/auth/auth.service.ts",
340
+ "line": 17,
341
+ "export": false
342
+ }
343
+ ],
344
+ "src/auth/dto/login.dto.ts": [
345
+ {
346
+ "id": "src/auth/dto/login.dto.ts#LoginDto",
347
+ "name": "LoginDto",
348
+ "type": "class",
349
+ "file": "src/auth/dto/login.dto.ts",
350
+ "line": 1,
351
+ "export": true
352
+ }
353
+ ],
354
+ "src/auth/strategies/jwt.strategy.ts": [
355
+ {
356
+ "id": "src/auth/strategies/jwt.strategy.ts#JwtStrategy",
357
+ "name": "JwtStrategy",
358
+ "type": "class",
359
+ "file": "src/auth/strategies/jwt.strategy.ts",
360
+ "line": 6,
361
+ "export": true
362
+ }
363
+ ],
364
+ "src/main.ts": [
365
+ {
366
+ "id": "src/main.ts#bootstrap",
367
+ "name": "bootstrap",
368
+ "type": "function",
369
+ "file": "src/main.ts",
370
+ "line": 4,
371
+ "export": false
372
+ },
373
+ {
374
+ "id": "src/main.ts#app",
375
+ "name": "app",
376
+ "type": "const",
377
+ "file": "src/main.ts",
378
+ "line": 5,
379
+ "export": false
380
+ }
381
+ ],
382
+ "src/users/users.controller.ts": [
383
+ {
384
+ "id": "src/users/users.controller.ts#UsersController",
385
+ "name": "UsersController",
386
+ "type": "class",
387
+ "file": "src/users/users.controller.ts",
388
+ "line": 5,
389
+ "export": true
390
+ }
391
+ ],
392
+ "src/users/users.module.ts": [
393
+ {
394
+ "id": "src/users/users.module.ts#UsersModule",
395
+ "name": "UsersModule",
396
+ "type": "class",
397
+ "file": "src/users/users.module.ts",
398
+ "line": 10,
399
+ "export": true
400
+ }
401
+ ],
402
+ "src/users/users.service.ts": [
403
+ {
404
+ "id": "src/users/users.service.ts#User",
405
+ "name": "User",
406
+ "type": "interface",
407
+ "file": "src/users/users.service.ts",
408
+ "line": 3,
409
+ "export": false
410
+ },
411
+ {
412
+ "id": "src/users/users.service.ts#UsersService",
413
+ "name": "UsersService",
414
+ "type": "class",
415
+ "file": "src/users/users.service.ts",
416
+ "line": 10,
417
+ "export": true
418
+ },
419
+ {
420
+ "id": "src/users/users.service.ts#user",
421
+ "name": "user",
422
+ "type": "const",
423
+ "file": "src/users/users.service.ts",
424
+ "line": 20,
425
+ "export": false
426
+ },
427
+ {
428
+ "id": "src/users/users.service.ts#user",
429
+ "name": "user",
430
+ "type": "const",
431
+ "file": "src/users/users.service.ts",
432
+ "line": 26,
433
+ "export": false
434
+ },
435
+ {
436
+ "id": "src/users/users.service.ts#index",
437
+ "name": "index",
438
+ "type": "const",
439
+ "file": "src/users/users.service.ts",
440
+ "line": 32,
441
+ "export": false
442
+ },
443
+ {
444
+ "id": "src/users/users.service.ts#index",
445
+ "name": "index",
446
+ "type": "const",
447
+ "file": "src/users/users.service.ts",
448
+ "line": 39,
449
+ "export": false
450
+ }
451
+ ]
452
+ },
453
+ "exported": [
454
+ {
455
+ "id": "src/app.module.ts#AppModule",
456
+ "name": "AppModule",
457
+ "type": "class",
458
+ "file": "src/app.module.ts",
459
+ "line": 8,
460
+ "export": true
461
+ },
462
+ {
463
+ "id": "src/auth/auth.controller.ts#AuthController",
464
+ "name": "AuthController",
465
+ "type": "class",
466
+ "file": "src/auth/auth.controller.ts",
467
+ "line": 6,
468
+ "export": true
469
+ },
470
+ {
471
+ "id": "src/auth/auth.module.ts#AuthModule",
472
+ "name": "AuthModule",
473
+ "type": "class",
474
+ "file": "src/auth/auth.module.ts",
475
+ "line": 11,
476
+ "export": true
477
+ },
478
+ {
479
+ "id": "src/auth/auth.service.ts#AuthService",
480
+ "name": "AuthService",
481
+ "type": "class",
482
+ "file": "src/auth/auth.service.ts",
483
+ "line": 5,
484
+ "export": true
485
+ },
486
+ {
487
+ "id": "src/auth/dto/login.dto.ts#LoginDto",
488
+ "name": "LoginDto",
489
+ "type": "class",
490
+ "file": "src/auth/dto/login.dto.ts",
491
+ "line": 1,
492
+ "export": true
493
+ },
494
+ {
495
+ "id": "src/auth/strategies/jwt.strategy.ts#JwtStrategy",
496
+ "name": "JwtStrategy",
497
+ "type": "class",
498
+ "file": "src/auth/strategies/jwt.strategy.ts",
499
+ "line": 6,
500
+ "export": true
501
+ },
502
+ {
503
+ "id": "src/users/users.controller.ts#UsersController",
504
+ "name": "UsersController",
505
+ "type": "class",
506
+ "file": "src/users/users.controller.ts",
507
+ "line": 5,
508
+ "export": true
509
+ },
510
+ {
511
+ "id": "src/users/users.module.ts#UsersModule",
512
+ "name": "UsersModule",
513
+ "type": "class",
514
+ "file": "src/users/users.module.ts",
515
+ "line": 10,
516
+ "export": true
517
+ },
518
+ {
519
+ "id": "src/users/users.service.ts#UsersService",
520
+ "name": "UsersService",
521
+ "type": "class",
522
+ "file": "src/users/users.service.ts",
523
+ "line": 10,
524
+ "export": true
525
+ }
526
+ ]
527
+ }
@@ -0,0 +1,37 @@
1
+ # Technology Stack
2
+
3
+ **Languages**: JSON, TypeScript
4
+
5
+ **Frameworks**: TypeScript
6
+
7
+ **Libraries**: Passport.js
8
+
9
+ **Package Managers**: npm
10
+
11
+ ## Languages
12
+ - JSON
13
+ - TypeScript
14
+
15
+ ## Frameworks
16
+ - TypeScript
17
+
18
+ ## Key Libraries
19
+ - Passport.js
20
+
21
+ ## Development Tools
22
+ - None detected
23
+
24
+ ## Package Managers
25
+ - npm
26
+
27
+ ## Testing
28
+ - None detected
29
+
30
+ ## Linters
31
+ - None detected
32
+
33
+ ## Formatters
34
+ - None detected
35
+
36
+ ---
37
+ *Generated by ai-first*
@@ -0,0 +1,10 @@
1
+ {
2
+ "compatibleAgents": [
3
+ "ai-first-bridge",
4
+ "opencode",
5
+ "cursor",
6
+ "windsurf",
7
+ "cline"
8
+ ],
9
+ "schemaVersion": "1.0"
10
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "nestjs-backend",
3
+ "version": "1.0.0",
4
+ "scripts": {
5
+ "build": "nest build",
6
+ "start": "nest start",
7
+ "start:dev": "nest start --watch"
8
+ },
9
+ "dependencies": {
10
+ "@nestjs/common": "^10.0.0",
11
+ "@nestjs/core": "^10.0.0",
12
+ "@nestjs/platform-express": "^10.0.0",
13
+ "@nestjs/jwt": "^10.0.0",
14
+ "@nestjs/passport": "^10.0.0",
15
+ "passport": "^0.7.0",
16
+ "passport-jwt": "^4.0.1"
17
+ },
18
+ "devDependencies": {
19
+ "@nestjs/cli": "^10.0.0",
20
+ "@types/node": "^20.0.0"
21
+ }
22
+ }
@@ -0,0 +1,8 @@
1
+ import { Module } from '@nestjs/common';
2
+ import { AuthModule } from './auth/auth.module';
3
+ import { UsersModule } from './users/users.module';
4
+
5
+ @Module({
6
+ imports: [AuthModule, UsersModule],
7
+ })
8
+ export class AppModule {}
@@ -0,0 +1,22 @@
1
+ import { Controller, Post, Body, UnauthorizedException } from '@nestjs/common';
2
+ import { AuthService } from './auth.service';
3
+ import { LoginDto } from './dto/login.dto';
4
+
5
+ @Controller('auth')
6
+ export class AuthController {
7
+ constructor(private readonly authService: AuthService) {}
8
+
9
+ @Post('login')
10
+ async login(@Body() loginDto: LoginDto) {
11
+ const user = await this.authService.validateUser(loginDto.email, loginDto.password);
12
+ if (!user) {
13
+ throw new UnauthorizedException('Invalid credentials');
14
+ }
15
+ return this.authService.login(user);
16
+ }
17
+
18
+ @Post('register')
19
+ async register(@Body() body: { email: string; password: string }) {
20
+ return this.authService.register(body.email, body.password);
21
+ }
22
+ }
@@ -0,0 +1,11 @@
1
+ import { Module } from '@nestjs/common';
2
+ import { AuthController } from './auth.controller';
3
+ import { AuthService } from './auth.service';
4
+ import { JwtStrategy } from './strategies/jwt.strategy';
5
+
6
+ @Module({
7
+ controllers: [AuthController],
8
+ providers: [AuthService, JwtStrategy],
9
+ exports: [AuthService],
10
+ })
11
+ export class AuthModule {}
@@ -0,0 +1,28 @@
1
+ import { Injectable, UnauthorizedException } from '@nestjs/common';
2
+ import { JwtService } from '@nestjs/jwt';
3
+
4
+ @Injectable()
5
+ export class AuthService {
6
+ constructor(private jwtService: JwtService) {}
7
+
8
+ async validateUser(email: string, password: string): Promise<any> {
9
+ // Simplified for testing
10
+ if (email === 'test@test.com' && password === 'password') {
11
+ return { id: 1, email, role: 'admin' };
12
+ }
13
+ return null;
14
+ }
15
+
16
+ async login(user: any) {
17
+ const payload = { email: user.email, sub: user.id, role: user.role };
18
+ return {
19
+ access_token: this.jwtService.sign(payload),
20
+ user: { id: user.id, email: user.email }
21
+ };
22
+ }
23
+
24
+ async register(email: string, password: string) {
25
+ // Simplified for testing
26
+ return { id: 2, email };
27
+ }
28
+ }
@@ -0,0 +1,4 @@
1
+ export class LoginDto {
2
+ email: string;
3
+ password: string;
4
+ }
@@ -0,0 +1,18 @@
1
+ import { Injectable } from '@nestjs/common';
2
+ import { PassportStrategy } from '@nestjs/passport';
3
+ import { ExtractJwt, Strategy } from 'passport-jwt';
4
+
5
+ @Injectable()
6
+ export class JwtStrategy extends PassportStrategy(Strategy) {
7
+ constructor() {
8
+ super({
9
+ jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
10
+ ignoreExpiration: false,
11
+ secretOrKey: 'secret',
12
+ });
13
+ }
14
+
15
+ async validate(payload: any) {
16
+ return { userId: payload.sub, email: payload.email, role: payload.role };
17
+ }
18
+ }