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.
- package/ANALISIS_MEJORAS.md +327 -0
- package/BUGS.md +455 -0
- package/CHANGELOG.md +100 -225
- package/TEST_RESULTS.md +198 -0
- package/TEST_RESULTS_COMPARATIVE.md +159 -0
- package/TEST_RESULTS_COMPLETE.md +127 -0
- package/TEST_RESULTS_COMPREHENSIVE.md +208 -0
- package/ai/ai_context.md +17 -10
- package/ai/ai_rules.md +5 -3
- package/ai/architecture.md +28 -7
- package/ai/cache.json +832 -52
- package/ai/context/features/commands.json +18 -0
- package/ai/context/features/src.json +61 -0
- package/ai/context/features/test-projects.json +56 -0
- package/ai/context/flows/account.json +9 -0
- package/ai/context/flows/add_.json +9 -0
- package/ai/context/flows/ai-first.json +9 -0
- package/ai/context/flows/auth..json +10 -0
- package/ai/context/flows/auth.json +12 -0
- package/ai/context/flows/dashboard.json +9 -0
- package/ai/context/flows/doctor.json +9 -0
- package/ai/context/flows/explore.json +9 -0
- package/ai/context/flows/list_.json +9 -0
- package/ai/context/flows/login.json +9 -0
- package/ai/context/flows/opportunity.json +9 -0
- package/ai/context/flows/remove_.json +9 -0
- package/ai/context/flows/user.json +14 -0
- package/ai/context/flows/users..json +10 -0
- package/ai/context/flows/users.json +9 -0
- package/ai/conventions.md +3 -2
- package/ai/dependencies.json +429 -251
- package/ai/entrypoints.md +10 -0
- package/ai/files.json +822 -46
- package/ai/git/commit-activity.json +126 -39
- package/ai/git/recent-features.json +3 -1
- package/ai/git/recent-files.json +6 -6
- package/ai/git/recent-flows.json +3 -1
- package/ai/graph/knowledge-graph.json +954 -182
- package/ai/graph/module-graph.json +270 -0
- package/ai/graph/symbol-graph.json +48991 -16523
- package/ai/graph/symbol-references.json +953 -56
- package/ai/hierarchy.json +3 -24
- package/ai/index-state.json +1261 -253
- package/ai/index.db +0 -0
- package/ai/modules.json +226 -0
- package/ai/project.json +29 -0
- package/ai/repo-map.json +2284 -250
- package/ai/repo_map.json +2731 -231
- package/ai/repo_map.md +559 -2
- package/ai/schema.json +5 -0
- package/ai/summary.md +16 -7
- package/ai/tech_stack.md +4 -1
- package/ai/tools.json +10 -0
- package/dist/analyzers/dependencies.d.ts.map +1 -1
- package/dist/analyzers/dependencies.js +8 -16
- package/dist/analyzers/dependencies.js.map +1 -1
- package/dist/analyzers/symbols.d.ts.map +1 -1
- package/dist/analyzers/symbols.js +60 -0
- package/dist/analyzers/symbols.js.map +1 -1
- package/dist/commands/ai-first.d.ts +1 -0
- package/dist/commands/ai-first.d.ts.map +1 -1
- package/dist/commands/ai-first.js +29 -6
- package/dist/commands/ai-first.js.map +1 -1
- package/dist/core/semanticContexts.d.ts.map +1 -1
- package/dist/core/semanticContexts.js +48 -26
- package/dist/core/semanticContexts.js.map +1 -1
- package/dist/core/symbolGraph.d.ts.map +1 -1
- package/dist/core/symbolGraph.js +14 -2
- package/dist/core/symbolGraph.js.map +1 -1
- package/dist/utils/fileUtils.d.ts.map +1 -1
- package/dist/utils/fileUtils.js +5 -0
- package/dist/utils/fileUtils.js.map +1 -1
- package/package.json +2 -2
- package/src/analyzers/dependencies.ts +10 -20
- package/src/analyzers/symbols.ts +64 -0
- package/src/commands/ai-first.ts +32 -8
- package/src/core/semanticContexts.ts +54 -29
- package/src/core/symbolGraph.ts +16 -2
- package/src/utils/fileUtils.ts +5 -0
- package/test-projects/express-api/ai/ai_context.md +112 -0
- package/test-projects/express-api/ai/ai_rules.md +50 -0
- package/test-projects/express-api/ai/architecture.md +62 -0
- package/test-projects/express-api/ai/cache.json +125 -0
- package/test-projects/express-api/ai/context/features/controllers.json +13 -0
- package/test-projects/express-api/ai/context/features/services.json +13 -0
- package/test-projects/express-api/ai/context/flows/auth.json +12 -0
- package/test-projects/express-api/ai/context/flows/user.json +13 -0
- package/test-projects/express-api/ai/conventions.md +51 -0
- package/test-projects/express-api/ai/dependencies.json +54 -0
- package/test-projects/express-api/ai/entrypoints.md +17 -0
- package/test-projects/express-api/ai/files.json +169 -0
- package/test-projects/express-api/ai/graph/knowledge-graph.json +98 -0
- package/test-projects/express-api/ai/graph/module-graph.json +44 -0
- package/test-projects/express-api/ai/graph/symbol-graph.json +882 -0
- package/test-projects/express-api/ai/graph/symbol-references.json +51 -0
- package/test-projects/express-api/ai/index-state.json +238 -0
- package/test-projects/express-api/ai/index.db +0 -0
- package/test-projects/express-api/ai/modules.json +30 -0
- package/test-projects/express-api/ai/project.json +15 -0
- package/test-projects/express-api/ai/repo-map.json +291 -0
- package/test-projects/express-api/ai/repo_map.json +100 -0
- package/test-projects/express-api/ai/repo_map.md +36 -0
- package/test-projects/express-api/ai/schema.json +5 -0
- package/test-projects/express-api/ai/summary.md +14 -0
- package/test-projects/express-api/ai/symbols.json +1174 -0
- package/test-projects/express-api/ai/tech_stack.md +38 -0
- package/test-projects/express-api/ai/tools.json +10 -0
- package/test-projects/express-api/controllers/authController.js +32 -0
- package/test-projects/express-api/controllers/userController.js +51 -0
- package/test-projects/express-api/index.js +21 -0
- package/test-projects/express-api/middleware/authMiddleware.js +30 -0
- package/test-projects/express-api/models/userRepository.js +25 -0
- package/test-projects/express-api/package.json +18 -0
- package/test-projects/express-api/services/authService.js +17 -0
- package/test-projects/express-api/services/userService.js +28 -0
- package/test-projects/nestjs-backend/ai/ai_context.md +110 -0
- package/test-projects/nestjs-backend/ai/ai_rules.md +52 -0
- package/test-projects/nestjs-backend/ai/architecture.md +43 -0
- package/test-projects/nestjs-backend/ai/cache.json +137 -0
- package/test-projects/nestjs-backend/ai/context/features/src.json +23 -0
- package/test-projects/nestjs-backend/ai/context/flows/auth..json +10 -0
- package/test-projects/nestjs-backend/ai/context/flows/users..json +10 -0
- package/test-projects/nestjs-backend/ai/conventions.md +52 -0
- package/test-projects/nestjs-backend/ai/dependencies.json +152 -0
- package/test-projects/nestjs-backend/ai/entrypoints.md +18 -0
- package/test-projects/nestjs-backend/ai/files.json +184 -0
- package/test-projects/nestjs-backend/ai/graph/knowledge-graph.json +74 -0
- package/test-projects/nestjs-backend/ai/graph/module-graph.json +29 -0
- package/test-projects/nestjs-backend/ai/graph/symbol-graph.json +304 -0
- package/test-projects/nestjs-backend/ai/graph/symbol-references.json +5 -0
- package/test-projects/nestjs-backend/ai/index-state.json +259 -0
- package/test-projects/nestjs-backend/ai/index.db +0 -0
- package/test-projects/nestjs-backend/ai/modules.json +19 -0
- package/test-projects/nestjs-backend/ai/project.json +14 -0
- package/test-projects/nestjs-backend/ai/repo-map.json +323 -0
- package/test-projects/nestjs-backend/ai/repo_map.json +141 -0
- package/test-projects/nestjs-backend/ai/repo_map.md +39 -0
- package/test-projects/nestjs-backend/ai/schema.json +5 -0
- package/test-projects/nestjs-backend/ai/summary.md +11 -0
- package/test-projects/nestjs-backend/ai/symbols.json +527 -0
- package/test-projects/nestjs-backend/ai/tech_stack.md +37 -0
- package/test-projects/nestjs-backend/ai/tools.json +10 -0
- package/test-projects/nestjs-backend/package.json +22 -0
- package/test-projects/nestjs-backend/src/app.module.ts +8 -0
- package/test-projects/nestjs-backend/src/auth/auth.controller.ts +22 -0
- package/test-projects/nestjs-backend/src/auth/auth.module.ts +11 -0
- package/test-projects/nestjs-backend/src/auth/auth.service.ts +28 -0
- package/test-projects/nestjs-backend/src/auth/dto/login.dto.ts +4 -0
- package/test-projects/nestjs-backend/src/auth/strategies/jwt.strategy.ts +18 -0
- package/test-projects/nestjs-backend/src/main.ts +9 -0
- package/test-projects/nestjs-backend/src/users/users.controller.ts +32 -0
- package/test-projects/nestjs-backend/src/users/users.module.ts +10 -0
- package/test-projects/nestjs-backend/src/users/users.service.ts +42 -0
- package/test-projects/nestjs-backend/tsconfig.json +21 -0
- package/test-projects/python-cli/__init__.py +1 -0
- package/test-projects/python-cli/ai/ai_context.md +94 -0
- package/test-projects/python-cli/ai/ai_rules.md +47 -0
- package/test-projects/python-cli/ai/architecture.md +49 -0
- package/test-projects/python-cli/ai/cache.json +129 -0
- package/test-projects/python-cli/ai/context/features/cli.json +16 -0
- package/test-projects/python-cli/ai/context/flows/add_.json +9 -0
- package/test-projects/python-cli/ai/context/flows/list_.json +9 -0
- package/test-projects/python-cli/ai/context/flows/remove_.json +9 -0
- package/test-projects/python-cli/ai/conventions.md +51 -0
- package/test-projects/python-cli/ai/dependencies.json +66 -0
- package/test-projects/python-cli/ai/entrypoints.md +4 -0
- package/test-projects/python-cli/ai/files.json +174 -0
- package/test-projects/python-cli/ai/graph/knowledge-graph.json +83 -0
- package/test-projects/python-cli/ai/graph/module-graph.json +31 -0
- package/test-projects/python-cli/ai/graph/symbol-graph.json +358 -0
- package/test-projects/python-cli/ai/graph/symbol-references.json +11 -0
- package/test-projects/python-cli/ai/index-state.json +245 -0
- package/test-projects/python-cli/ai/index.db +0 -0
- package/test-projects/python-cli/ai/modules.json +21 -0
- package/test-projects/python-cli/ai/project.json +15 -0
- package/test-projects/python-cli/ai/repo-map.json +290 -0
- package/test-projects/python-cli/ai/repo_map.json +99 -0
- package/test-projects/python-cli/ai/repo_map.md +32 -0
- package/test-projects/python-cli/ai/schema.json +5 -0
- package/test-projects/python-cli/ai/summary.md +11 -0
- package/test-projects/python-cli/ai/symbols.json +475 -0
- package/test-projects/python-cli/ai/tech_stack.md +30 -0
- package/test-projects/python-cli/ai/tools.json +10 -0
- package/test-projects/python-cli/cli/__init__.py +1 -0
- package/test-projects/python-cli/cli/add_command.py +6 -0
- package/test-projects/python-cli/cli/list_command.py +7 -0
- package/test-projects/python-cli/cli/remove_command.py +6 -0
- package/test-projects/python-cli/main.py +34 -0
- package/test-projects/python-cli/models/__init__.py +2 -0
- package/test-projects/python-cli/models/task.py +19 -0
- package/test-projects/python-cli/models/task_repository.py +44 -0
- package/test-projects/react-app/ai/ai_context.md +95 -0
- package/test-projects/react-app/ai/ai_rules.md +49 -0
- package/test-projects/react-app/ai/architecture.md +33 -0
- package/test-projects/react-app/ai/cache.json +129 -0
- package/test-projects/react-app/ai/context/features/src.json +18 -0
- package/test-projects/react-app/ai/context/flows/dashboard.json +9 -0
- package/test-projects/react-app/ai/context/flows/login.json +9 -0
- package/test-projects/react-app/ai/context/flows/users.json +9 -0
- package/test-projects/react-app/ai/conventions.md +52 -0
- package/test-projects/react-app/ai/dependencies.json +128 -0
- package/test-projects/react-app/ai/entrypoints.md +4 -0
- package/test-projects/react-app/ai/files.json +174 -0
- package/test-projects/react-app/ai/graph/knowledge-graph.json +83 -0
- package/test-projects/react-app/ai/graph/module-graph.json +31 -0
- package/test-projects/react-app/ai/graph/symbol-graph.json +868 -0
- package/test-projects/react-app/ai/graph/symbol-references.json +31 -0
- package/test-projects/react-app/ai/index-state.json +245 -0
- package/test-projects/react-app/ai/index.db +0 -0
- package/test-projects/react-app/ai/modules.json +17 -0
- package/test-projects/react-app/ai/project.json +15 -0
- package/test-projects/react-app/ai/repo-map.json +305 -0
- package/test-projects/react-app/ai/repo_map.json +114 -0
- package/test-projects/react-app/ai/repo_map.md +31 -0
- package/test-projects/react-app/ai/schema.json +5 -0
- package/test-projects/react-app/ai/summary.md +11 -0
- package/test-projects/react-app/ai/symbols.json +985 -0
- package/test-projects/react-app/ai/tech_stack.md +38 -0
- package/test-projects/react-app/ai/tools.json +10 -0
- package/test-projects/react-app/package.json +16 -0
- package/test-projects/react-app/src/App.tsx +21 -0
- package/test-projects/react-app/src/context/AuthContext.tsx +41 -0
- package/test-projects/react-app/src/hooks/useAuth.ts +10 -0
- package/test-projects/react-app/src/main.tsx +10 -0
- package/test-projects/react-app/src/pages/DashboardPage.tsx +17 -0
- package/test-projects/react-app/src/pages/LoginPage.tsx +41 -0
- package/test-projects/react-app/src/pages/UsersPage.tsx +36 -0
- package/test-projects/react-app/src/services/userService.ts +37 -0
- package/test-projects/salesforce-cli/.forceignore +27 -0
- package/test-projects/salesforce-cli/ai/ai_context.md +88 -0
- package/test-projects/salesforce-cli/ai/ai_rules.md +47 -0
- package/test-projects/salesforce-cli/ai/architecture.md +33 -0
- package/test-projects/salesforce-cli/ai/cache.json +105 -0
- package/test-projects/salesforce-cli/ai/context/features/force-app.json +14 -0
- package/test-projects/salesforce-cli/ai/context/flows/account.json +9 -0
- package/test-projects/salesforce-cli/ai/context/flows/opportunity.json +9 -0
- package/test-projects/salesforce-cli/ai/conventions.md +51 -0
- package/test-projects/salesforce-cli/ai/dependencies.json +6 -0
- package/test-projects/salesforce-cli/ai/entrypoints.md +4 -0
- package/test-projects/salesforce-cli/ai/files.json +144 -0
- package/test-projects/salesforce-cli/ai/graph/knowledge-graph.json +64 -0
- package/test-projects/salesforce-cli/ai/graph/module-graph.json +13 -0
- package/test-projects/salesforce-cli/ai/graph/symbol-graph.json +148 -0
- package/test-projects/salesforce-cli/ai/graph/symbol-references.json +1 -0
- package/test-projects/salesforce-cli/ai/index-state.json +203 -0
- package/test-projects/salesforce-cli/ai/index.db +0 -0
- package/test-projects/salesforce-cli/ai/modules.json +12 -0
- package/test-projects/salesforce-cli/ai/project.json +14 -0
- package/test-projects/salesforce-cli/ai/repo-map.json +251 -0
- package/test-projects/salesforce-cli/ai/repo_map.json +69 -0
- package/test-projects/salesforce-cli/ai/repo_map.md +21 -0
- package/test-projects/salesforce-cli/ai/schema.json +5 -0
- package/test-projects/salesforce-cli/ai/summary.md +11 -0
- package/test-projects/salesforce-cli/ai/symbols.json +245 -0
- package/test-projects/salesforce-cli/ai/tech_stack.md +30 -0
- package/test-projects/salesforce-cli/ai/tools.json +10 -0
- package/test-projects/salesforce-cli/force-app/main/default/classes/AccountController.cls +24 -0
- package/test-projects/salesforce-cli/force-app/main/default/classes/OpportunityController.cls +25 -0
- package/test-projects/salesforce-cli/force-app/main/default/objects/Project__c.object.xml +45 -0
- package/test-projects/salesforce-cli/force-app/main/default/triggers/AccountTrigger.trigger +33 -0
- package/test-projects/salesforce-cli/sfdx-project.json +11 -0
- package/tests/e2e/README.md +85 -0
- package/tests/e2e/run-e2e.sh +88 -0
- 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,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,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,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
|
+
}
|