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,38 @@
1
+ # Technology Stack
2
+
3
+ **Languages**: JavaScript, JSON
4
+
5
+ **Frameworks**: Express.js
6
+
7
+ **Libraries**: Bcrypt, JWT
8
+
9
+ **Package Managers**: npm
10
+
11
+ ## Languages
12
+ - JavaScript
13
+ - JSON
14
+
15
+ ## Frameworks
16
+ - Express.js
17
+
18
+ ## Key Libraries
19
+ - Bcrypt
20
+ - JWT
21
+
22
+ ## Development Tools
23
+ - None detected
24
+
25
+ ## Package Managers
26
+ - npm
27
+
28
+ ## Testing
29
+ - None detected
30
+
31
+ ## Linters
32
+ - None detected
33
+
34
+ ## Formatters
35
+ - None detected
36
+
37
+ ---
38
+ *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,32 @@
1
+ const jwt = require('jsonwebtoken');
2
+ const authService = require('../services/authService');
3
+
4
+ const SECRET = process.env.JWT_SECRET || 'secret';
5
+
6
+ async function login(req, res) {
7
+ try {
8
+ const { email, password } = req.body;
9
+ const user = await authService.verifyCredentials(email, password);
10
+
11
+ if (!user) {
12
+ return res.status(401).json({ error: 'Invalid credentials' });
13
+ }
14
+
15
+ const token = jwt.sign({ userId: user.id }, SECRET, { expiresIn: '24h' });
16
+ res.json({ token, user: { id: user.id, email: user.email } });
17
+ } catch (error) {
18
+ res.status(500).json({ error: error.message });
19
+ }
20
+ }
21
+
22
+ async function register(req, res) {
23
+ try {
24
+ const { email, password } = req.body;
25
+ const user = await authService.createUser(email, password);
26
+ res.status(201).json({ user });
27
+ } catch (error) {
28
+ res.status(500).json({ error: error.message });
29
+ }
30
+ }
31
+
32
+ module.exports = { login, register };
@@ -0,0 +1,51 @@
1
+ const userService = require('../services/userService');
2
+
3
+ async function getAll(req, res) {
4
+ try {
5
+ const users = await userService.findAll();
6
+ res.json(users);
7
+ } catch (error) {
8
+ res.status(500).json({ error: error.message });
9
+ }
10
+ }
11
+
12
+ async function getById(req, res) {
13
+ try {
14
+ const user = await userService.findById(req.params.id);
15
+ if (!user) {
16
+ return res.status(404).json({ error: 'User not found' });
17
+ }
18
+ res.json(user);
19
+ } catch (error) {
20
+ res.status(500).json({ error: error.message });
21
+ }
22
+ }
23
+
24
+ async function create(req, res) {
25
+ try {
26
+ const user = await userService.create(req.body);
27
+ res.status(201).json(user);
28
+ } catch (error) {
29
+ res.status(500).json({ error: error.message });
30
+ }
31
+ }
32
+
33
+ async function update(req, res) {
34
+ try {
35
+ const user = await userService.update(req.params.id, req.body);
36
+ res.json(user);
37
+ } catch (error) {
38
+ res.status(500).json({ error: error.message });
39
+ }
40
+ }
41
+
42
+ async function remove(req, res) {
43
+ try {
44
+ await userService.remove(req.params.id);
45
+ res.status(204).send();
46
+ } catch (error) {
47
+ res.status(500).json({ error: error.message });
48
+ }
49
+ }
50
+
51
+ module.exports = { getAll, getById, create, update, delete: remove };
@@ -0,0 +1,21 @@
1
+ const express = require('express');
2
+ const authController = require('./controllers/authController');
3
+ const userController = require('./controllers/userController');
4
+
5
+ const app = express();
6
+ app.use(express.json());
7
+
8
+ app.post('/auth/login', authController.login);
9
+ app.post('/auth/register', authController.register);
10
+ app.get('/users', userController.getAll);
11
+ app.get('/users/:id', userController.getById);
12
+ app.post('/users', userController.create);
13
+ app.put('/users/:id', userController.update);
14
+ app.delete('/users/:id', userController.delete);
15
+
16
+ const PORT = process.env.PORT || 3000;
17
+ app.listen(PORT, () => {
18
+ console.log(`Server running on port ${PORT}`);
19
+ });
20
+
21
+ module.exports = app;
@@ -0,0 +1,30 @@
1
+ const jwt = require('jsonwebtoken');
2
+
3
+ const SECRET = process.env.JWT_SECRET || 'secret';
4
+
5
+ function authenticate(req, res, next) {
6
+ const token = req.headers.authorization?.split(' ')[1];
7
+
8
+ if (!token) {
9
+ return res.status(401).json({ error: 'No token provided' });
10
+ }
11
+
12
+ try {
13
+ const decoded = jwt.verify(token, SECRET);
14
+ req.user = decoded;
15
+ next();
16
+ } catch (error) {
17
+ res.status(401).json({ error: 'Invalid token' });
18
+ }
19
+ }
20
+
21
+ function authorize(roles = []) {
22
+ return (req, res, next) => {
23
+ if (!roles.includes(req.user?.role)) {
24
+ return res.status(403).json({ error: 'Forbidden' });
25
+ }
26
+ next();
27
+ };
28
+ }
29
+
30
+ module.exports = { authenticate, authorize };
@@ -0,0 +1,25 @@
1
+ const users = [];
2
+
3
+ const db = {
4
+ findAll: () => Promise.resolve(users),
5
+ findById: (id) => Promise.resolve(users.find(u => u.id === id)),
6
+ findByEmail: (email) => Promise.resolve(users.find(u => u.email === email)),
7
+ create: (data) => {
8
+ const user = { id: String(users.length + 1), ...data };
9
+ users.push(user);
10
+ return Promise.resolve(user);
11
+ },
12
+ update: (id, data) => {
13
+ const index = users.findIndex(u => u.id === id);
14
+ if (index === -1) return Promise.resolve(null);
15
+ users[index] = { ...users[index], ...data };
16
+ return Promise.resolve(users[index]);
17
+ },
18
+ delete: (id) => {
19
+ const index = users.findIndex(u => u.id === id);
20
+ if (index !== -1) users.splice(index, 1);
21
+ return Promise.resolve();
22
+ }
23
+ };
24
+
25
+ module.exports = db;
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "express-api",
3
+ "version": "1.0.0",
4
+ "description": "Express.js API with auth and users",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "start": "node index.js",
8
+ "dev": "nodemon index.js"
9
+ },
10
+ "dependencies": {
11
+ "express": "^4.18.2",
12
+ "jsonwebtoken": "^9.0.0",
13
+ "bcrypt": "^5.1.0"
14
+ },
15
+ "devDependencies": {
16
+ "nodemon": "^3.0.0"
17
+ }
18
+ }
@@ -0,0 +1,17 @@
1
+ const bcrypt = require('bcrypt');
2
+ const userRepository = require('../models/userRepository');
3
+
4
+ async function verifyCredentials(email, password) {
5
+ const user = await userRepository.findByEmail(email);
6
+ if (!user) return null;
7
+
8
+ const valid = await bcrypt.compare(password, user.password);
9
+ return valid ? user : null;
10
+ }
11
+
12
+ async function createUser(email, password) {
13
+ const hashedPassword = await bcrypt.hash(password, 10);
14
+ return userRepository.create({ email, password: hashedPassword });
15
+ }
16
+
17
+ module.exports = { verifyCredentials, createUser };
@@ -0,0 +1,28 @@
1
+ class UserService {
2
+ constructor(repository) {
3
+ this.repository = repository;
4
+ }
5
+
6
+ async findAll() {
7
+ return this.repository.findAll();
8
+ }
9
+
10
+ async findById(id) {
11
+ return this.repository.findById(id);
12
+ }
13
+
14
+ async create(data) {
15
+ return this.repository.create(data);
16
+ }
17
+
18
+ async update(id, data) {
19
+ return this.repository.update(id, data);
20
+ }
21
+
22
+ async remove(id) {
23
+ return this.repository.delete(id);
24
+ }
25
+ }
26
+
27
+ const repository = require('../models/userRepository');
28
+ module.exports = new UserService(repository);
@@ -0,0 +1,110 @@
1
+ # AI Context
2
+
3
+ > This file provides a comprehensive overview of the repository for AI coding assistants.
4
+
5
+ ---
6
+
7
+ ## Quick Overview
8
+
9
+ - **Pattern**: Flat / Simple Structure
10
+ - **Languages**: JSON, TypeScript
11
+ - **Frameworks**: TypeScript
12
+ - **Total Files**: 12
13
+
14
+ ---
15
+
16
+ ## Table of Contents
17
+
18
+ 1. [Tech Stack](#tech-stack)
19
+ 2. [Architecture](#architecture)
20
+ 3. [Key Entrypoints](#key-entrypoints)
21
+ 4. [Code Conventions](#code-conventions)
22
+ 5. [AI Rules](#ai-rules)
23
+ 6. [Repository Map](#repository-map)
24
+
25
+ ---
26
+
27
+ ## Tech Stack
28
+
29
+ **Languages**: JSON, TypeScript
30
+
31
+ **Frameworks**: TypeScript
32
+
33
+ **Libraries**: Passport.js
34
+
35
+ **Package Managers**: npm
36
+
37
+ ---
38
+
39
+ ## Architecture
40
+
41
+ ## Architectural Pattern
42
+ **Primary**: Flat / Simple Structure
43
+
44
+ ## Layers Identified
45
+ - Infrastructure
46
+ - Config
47
+
48
+ ## Key Modules
49
+ | Module | Responsibility |
50
+ |--------|----------------|
51
+ | `package.json` | Contains 0 files |
52
+ | `src` | Contains 10 files |
53
+ | `tsconfig.json` | Configuration management |
54
+
55
+
56
+ ---
57
+
58
+ ## Key Entrypoints
59
+
60
+ ### Build
61
+ - `package.json#scripts.build` - build: nest build
62
+
63
+ ### Server
64
+ - `package.json#scripts.start` - start: nest start
65
+ - `package.json#scripts.start:dev` - start:dev: nest start --watch
66
+ - `src/main.ts` - Main
67
+
68
+ ---
69
+
70
+ ## Code Conventions
71
+
72
+ ## Naming Conventions
73
+ - **Files**: camelCase
74
+
75
+ ## Project Structure
76
+ - **Source**: src/
77
+
78
+ ## Code Style
79
+ - **Semicolons**: Required
80
+
81
+
82
+ ---
83
+
84
+ ## AI Rules
85
+
86
+ - Language: Use JSON, TypeScript
87
+ - Frameworks: TypeScript
88
+ - Architecture: Follow Flat / Simple Structure pattern
89
+ - File naming: camelCase
90
+ - Source directory: src/
91
+
92
+ ---
93
+
94
+ ## Repository Map
95
+
96
+ See repo_map.md for the full structure.
97
+
98
+ ---
99
+
100
+ ## Notes for AI Assistants
101
+
102
+ 1. Follow the established naming conventions (see conventions.md)
103
+ 2. Use the detected frameworks and libraries
104
+ 3. Target the correct entrypoints for modifications
105
+ 4. Maintain the detected architecture patterns
106
+ 5. Follow AI rules in ai_rules.md
107
+
108
+ ---
109
+
110
+ *Generated by ai-first*
@@ -0,0 +1,52 @@
1
+ # AI Rules
2
+
3
+ > Guidelines for AI assistants working on this project
4
+
5
+ ---
6
+
7
+ ## Guidelines
8
+
9
+ - Language: Use JSON, TypeScript
10
+ - Frameworks: TypeScript
11
+ - Architecture: Follow Flat / Simple Structure pattern
12
+ - File naming: camelCase
13
+ - Source directory: src/
14
+ - Main entry: package.json#scripts.start
15
+ - Dev command: npm run start:dev
16
+ - Build command: npm run build
17
+
18
+ ## Patterns
19
+
20
+ - Layer structure: infrastructure → config
21
+
22
+ ## Constraints
23
+
24
+ - Always use semicolons
25
+
26
+ ---
27
+
28
+ ## Quick Reference
29
+
30
+ | Category | Value |
31
+ |----------|-------|
32
+ | Language | JSON, TypeScript |
33
+ | Framework | TypeScript |
34
+ | Architecture | Flat / Simple Structure |
35
+ | Naming | camelCase |
36
+ | Indentation | unknown |
37
+
38
+ ---
39
+
40
+ ## Best Practices
41
+
42
+ 1. Follow the established naming conventions
43
+ 2. Keep functions small and focused
44
+ 3. Write tests for new features
45
+ 4. Use descriptive variable names
46
+ 5. Keep the architecture consistent
47
+ 6. Document complex logic
48
+ 7. Review code before committing
49
+
50
+ ---
51
+
52
+ *Generated by ai-first*
@@ -0,0 +1,43 @@
1
+ # Architecture
2
+
3
+ ## Architectural Pattern
4
+ **Primary**: Flat / Simple Structure
5
+
6
+ ## Layers Identified
7
+ - Infrastructure
8
+ - Config
9
+
10
+ ## Key Modules
11
+ | Module | Responsibility |
12
+ |--------|----------------|
13
+ | `package.json` | Contains 0 files |
14
+ | `src` | Contains 10 files |
15
+ | `tsconfig.json` | Configuration management |
16
+
17
+
18
+ ## Module Details
19
+
20
+ ### package.json
21
+ - **Path**: `package.json`
22
+ - **Responsibility**: Contains 0 files
23
+
24
+
25
+ ### src
26
+ - **Path**: `src`
27
+ - **Responsibility**: Contains 10 files
28
+
29
+
30
+ ### tsconfig.json
31
+ - **Path**: `tsconfig.json`
32
+ - **Responsibility**: Configuration management
33
+
34
+
35
+
36
+ ## Recommendations
37
+
38
+ - Keep the architecture consistent as the project grows
39
+ - Follow the established layer structure
40
+ - Use dependency injection to manage module relationships
41
+
42
+ ---
43
+ *Generated by ai-first*
@@ -0,0 +1,137 @@
1
+ {
2
+ "files": {
3
+ "ai/ai_context.md": {
4
+ "hash": "01e94675a8faa5d598f2782c09e3d5ad",
5
+ "mtime": 1773796492431.4038
6
+ },
7
+ "ai/ai_rules.md": {
8
+ "hash": "0056c2b3f1d212bd870734924f577d09",
9
+ "mtime": 1773796492431.4038
10
+ },
11
+ "ai/architecture.md": {
12
+ "hash": "b763c79531f89caf3a6731d8c6b4f157",
13
+ "mtime": 1773796492425.4036
14
+ },
15
+ "ai/context/features/src.json": {
16
+ "hash": "e62d7f714439c64f0a0051436687b023",
17
+ "mtime": 1773796492433.4038
18
+ },
19
+ "ai/context/flows/auth..json": {
20
+ "hash": "064519d0be7978f42c408cf2f99edaf9",
21
+ "mtime": 1773796492433.4038
22
+ },
23
+ "ai/context/flows/users..json": {
24
+ "hash": "743cdda74793f8b1d4fac2656267c24b",
25
+ "mtime": 1773796492433.4038
26
+ },
27
+ "ai/conventions.md": {
28
+ "hash": "9924468f87cfd5d2328fa48737aac075",
29
+ "mtime": 1773796492427.4036
30
+ },
31
+ "ai/dependencies.json": {
32
+ "hash": "7dbe8e380f477563ed486728fc7d796e",
33
+ "mtime": 1773796492430.4038
34
+ },
35
+ "ai/entrypoints.md": {
36
+ "hash": "31bc6c36186b7db7764086f994a34fcf",
37
+ "mtime": 1773796492426.4036
38
+ },
39
+ "ai/files.json": {
40
+ "hash": "6fc0e5f9f769544e4d28bbd29197b2f5",
41
+ "mtime": 1773796517474.7942
42
+ },
43
+ "ai/graph/module-graph.json": {
44
+ "hash": "0e4d69958d08b9aaf402549b2cfe2b3a",
45
+ "mtime": 1773796517467.7942
46
+ },
47
+ "ai/modules.json": {
48
+ "hash": "11513775b7ba2c22e59f9bd915ea33fa",
49
+ "mtime": 1773796517464.7942
50
+ },
51
+ "ai/project.json": {
52
+ "hash": "3dccdf21bae258d5c57bd9001b4b39e6",
53
+ "mtime": 1773796492433.4038
54
+ },
55
+ "ai/repo-map.json": {
56
+ "hash": "d0781e3898006491005ab603b6fe5f2a",
57
+ "mtime": 1773796517466.0496
58
+ },
59
+ "ai/repo_map.json": {
60
+ "hash": "7646f8ddcac9b2573aefd42e6dbf7186",
61
+ "mtime": 1773796492423.4036
62
+ },
63
+ "ai/repo_map.md": {
64
+ "hash": "d3b93db63ba7b92c1bcba98b7682b487",
65
+ "mtime": 1773796492423.4036
66
+ },
67
+ "ai/schema.json": {
68
+ "hash": "b7af586eb15247e9b5c644920a03afa4",
69
+ "mtime": 1773796492433.4038
70
+ },
71
+ "ai/summary.md": {
72
+ "hash": "c97180815314cb04e69623f705703641",
73
+ "mtime": 1773796492424.4036
74
+ },
75
+ "ai/symbols.json": {
76
+ "hash": "86f0962de99584aca04f8773850703ba",
77
+ "mtime": 1773796492428.4036
78
+ },
79
+ "ai/tech_stack.md": {
80
+ "hash": "a84eb022eb8e5959365181abc81e5f9d",
81
+ "mtime": 1773796492426.4036
82
+ },
83
+ "ai/tools.json": {
84
+ "hash": "b1356e52c74e9b3b6a0d397b790a4968",
85
+ "mtime": 1773796492433.4038
86
+ },
87
+ "package.json": {
88
+ "hash": "54188023d3f4898db4ed5ecb0963ad7c",
89
+ "mtime": 1773776957019.264
90
+ },
91
+ "src/app.module.ts": {
92
+ "hash": "340f55f1f816bff231e0d7cceb640a6a",
93
+ "mtime": 1773777098469.8062
94
+ },
95
+ "src/auth/auth.controller.ts": {
96
+ "hash": "042f9828f736d2cd17f81a9f38e92902",
97
+ "mtime": 1773776992110.6333
98
+ },
99
+ "src/auth/auth.module.ts": {
100
+ "hash": "d77f0da16ab8259e61017e585aa84ba1",
101
+ "mtime": 1773776981771.5234
102
+ },
103
+ "src/auth/auth.service.ts": {
104
+ "hash": "82d1c6ef4273438c42f5ec7a6d11af7e",
105
+ "mtime": 1773777003294.753
106
+ },
107
+ "src/auth/dto/login.dto.ts": {
108
+ "hash": "ea30ef087078e1172bffc80a370ebff3",
109
+ "mtime": 1773777024191.979
110
+ },
111
+ "src/auth/strategies/jwt.strategy.ts": {
112
+ "hash": "0f76815e6d72c4b1d3324713b6c09853",
113
+ "mtime": 1773777033163.077
114
+ },
115
+ "src/main.ts": {
116
+ "hash": "37685b56941c1e865638bae7fd76d81c",
117
+ "mtime": 1773777107555.9097
118
+ },
119
+ "src/users/users.controller.ts": {
120
+ "hash": "41b4cfa3872766fb0578a901abd294fa",
121
+ "mtime": 1773777065483.4343
122
+ },
123
+ "src/users/users.module.ts": {
124
+ "hash": "f3eb2901994d3dcf77b5bb6766f937aa",
125
+ "mtime": 1773777054886.3164
126
+ },
127
+ "src/users/users.service.ts": {
128
+ "hash": "34c037f935826f26a9f72d53774a3223",
129
+ "mtime": 1773777078186.5767
130
+ },
131
+ "tsconfig.json": {
132
+ "hash": "f0902e207501d022c8048ac457251ecc",
133
+ "mtime": 1773777131755.1877
134
+ }
135
+ },
136
+ "lastIndexed": "2026-03-18T01:15:17.476Z"
137
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "src",
3
+ "path": "src",
4
+ "files": [
5
+ "src/app.module.ts",
6
+ "src/auth/auth.controller.ts",
7
+ "src/auth/auth.module.ts",
8
+ "src/auth/auth.service.ts",
9
+ "src/auth/dto/login.dto.ts",
10
+ "src/auth/strategies/jwt.strategy.ts",
11
+ "src/main.ts",
12
+ "src/users/users.controller.ts",
13
+ "src/users/users.module.ts",
14
+ "src/users/users.service.ts"
15
+ ],
16
+ "entrypoints": [
17
+ "src/auth/auth.controller.ts",
18
+ "src/auth/auth.service.ts",
19
+ "src/users/users.controller.ts",
20
+ "src/users/users.service.ts"
21
+ ],
22
+ "dependencies": []
23
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "auth.",
3
+ "entrypoint": "src/auth/auth.controller.ts",
4
+ "files": [
5
+ "src/auth/auth.controller.ts",
6
+ "src/auth/auth.service.ts"
7
+ ],
8
+ "depth": 0,
9
+ "layers": []
10
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "users.",
3
+ "entrypoint": "src/users/users.controller.ts",
4
+ "files": [
5
+ "src/users/users.controller.ts",
6
+ "src/users/users.service.ts"
7
+ ],
8
+ "depth": 0,
9
+ "layers": []
10
+ }