ai-first-cli 1.3.1 → 1.3.6

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 (514) hide show
  1. package/.ai-dev/index.db +0 -0
  2. package/CHANGELOG.md +241 -0
  3. package/PHASE1_USER_SIMULATION.md +56 -0
  4. package/PHASE2_USER_SIMULATION.md +81 -0
  5. package/PHASE3_USER_SIMULATION.md +176 -0
  6. package/README.es.md +73 -0
  7. package/README.md +119 -15
  8. package/ai/graph/knowledge-graph.json +10 -0
  9. package/ai-context/ai_context.md +130 -0
  10. package/{test-projects/react-app/.ai-dev → ai-context}/ai_rules.md +10 -5
  11. package/ai-context/architecture.md +136 -0
  12. package/ai-context/context/features/src.json +69 -0
  13. package/ai-context/context/features/test-projects.json +69 -0
  14. package/ai-context/context/flows/ai-first.json +9 -0
  15. package/ai-context/context/flows/auth.json +13 -0
  16. package/ai-context/context/flows/doctor.json +9 -0
  17. package/ai-context/context/flows/explore.json +9 -0
  18. package/ai-context/context/flows/routes.json +15 -0
  19. package/ai-context/context/flows/user.json +23 -0
  20. package/ai-context/context/flows/views.json +12 -0
  21. package/{test-projects/react-app/.ai-dev → ai-context}/conventions.md +3 -2
  22. package/ai-context/dependencies.json +3360 -0
  23. package/ai-context/entrypoints.md +45 -0
  24. package/ai-context/index-state.json +196 -0
  25. package/ai-context/modules.json +901 -0
  26. package/ai-context/project.json +33 -0
  27. package/ai-context/repo_map.json +8857 -0
  28. package/ai-context/repo_map.md +2002 -0
  29. package/{test-projects/flask-app/.ai-dev → ai-context}/schema.json +1 -1
  30. package/ai-context/summary.md +46 -0
  31. package/ai-context/symbols.json +82467 -0
  32. package/{test-projects/react-app/.ai-dev → ai-context}/tech_stack.md +15 -7
  33. package/ai-context-evaluation-report-1774223059505.md +206 -0
  34. package/dist/analyzers/architecture.d.ts.map +1 -1
  35. package/dist/analyzers/architecture.js +78 -5
  36. package/dist/analyzers/architecture.js.map +1 -1
  37. package/dist/analyzers/entrypoints.d.ts.map +1 -1
  38. package/dist/analyzers/entrypoints.js +358 -0
  39. package/dist/analyzers/entrypoints.js.map +1 -1
  40. package/dist/analyzers/symbols.d.ts.map +1 -1
  41. package/dist/analyzers/symbols.js +119 -3
  42. package/dist/analyzers/symbols.js.map +1 -1
  43. package/dist/analyzers/techStack.d.ts +8 -0
  44. package/dist/analyzers/techStack.d.ts.map +1 -1
  45. package/dist/analyzers/techStack.js +118 -0
  46. package/dist/analyzers/techStack.js.map +1 -1
  47. package/dist/utils/fileUtils.d.ts.map +1 -1
  48. package/dist/utils/fileUtils.js +5 -0
  49. package/dist/utils/fileUtils.js.map +1 -1
  50. package/package.json +1 -1
  51. package/scripts/ai-context-evaluator.ts +440 -0
  52. package/src/analyzers/architecture.ts +83 -6
  53. package/src/analyzers/entrypoints.ts +400 -0
  54. package/src/analyzers/symbols.ts +129 -3
  55. package/src/analyzers/techStack.ts +137 -0
  56. package/src/utils/fileUtils.ts +5 -0
  57. package/tests/apex-parser.test.ts +193 -0
  58. package/tests/cli-commands-batch1.test.ts +808 -0
  59. package/tests/cli-commands-batch2.test.ts +1113 -0
  60. package/tests/cli-commands-batch3.test.ts +1128 -0
  61. package/tests/cli-index.test.ts +1007 -0
  62. package/tests/cli-init.test.ts +761 -0
  63. package/tests/entrypoints-languages.test.ts +373 -0
  64. package/tests/framework-detection.test.ts +296 -0
  65. package/tests/salesforce-apex-classes.test.ts +713 -0
  66. package/tests/salesforce-apex-triggers.test.ts +871 -0
  67. package/tests/salesforce-custom-objects.test.ts +918 -0
  68. package/tests/salesforce-flows.test.ts +710 -0
  69. package/tests/salesforce-lwc.test.ts +963 -0
  70. package/tests/salesforce-sfdx-integration.test.ts +1125 -0
  71. package/ANALISIS_COMPLETO.md +0 -424
  72. package/ANALISIS_MEJORAS.md +0 -327
  73. package/CONTRIBUTING.md +0 -89
  74. package/FLOW.md +0 -129
  75. package/TEST_RESULTS.md +0 -198
  76. package/TEST_RESULTS_COMPARATIVE.md +0 -159
  77. package/TEST_RESULTS_COMPLETE.md +0 -127
  78. package/TEST_RESULTS_COMPREHENSIVE.md +0 -208
  79. package/install.sh +0 -188
  80. package/run-all-tests.sh +0 -184
  81. package/test-ai-context-understanding.sh +0 -21
  82. package/test-projects/django-app/.ai-dev/ai_context.md +0 -92
  83. package/test-projects/django-app/.ai-dev/ai_rules.md +0 -47
  84. package/test-projects/django-app/.ai-dev/architecture.md +0 -57
  85. package/test-projects/django-app/.ai-dev/cache.json +0 -169
  86. package/test-projects/django-app/.ai-dev/context/flows/views.json +0 -10
  87. package/test-projects/django-app/.ai-dev/conventions.md +0 -51
  88. package/test-projects/django-app/.ai-dev/dependencies.json +0 -312
  89. package/test-projects/django-app/.ai-dev/entrypoints.md +0 -4
  90. package/test-projects/django-app/.ai-dev/files.json +0 -209
  91. package/test-projects/django-app/.ai-dev/graph/knowledge-graph.json +0 -36
  92. package/test-projects/django-app/.ai-dev/graph/module-graph.json +0 -145
  93. package/test-projects/django-app/.ai-dev/graph/symbol-graph.json +0 -1488
  94. package/test-projects/django-app/.ai-dev/graph/symbol-references.json +0 -1
  95. package/test-projects/django-app/.ai-dev/index-state.json +0 -294
  96. package/test-projects/django-app/.ai-dev/modules.json +0 -35
  97. package/test-projects/django-app/.ai-dev/project.json +0 -11
  98. package/test-projects/django-app/.ai-dev/repo_map.json +0 -412
  99. package/test-projects/django-app/.ai-dev/repo_map.md +0 -105
  100. package/test-projects/django-app/.ai-dev/schema.json +0 -5
  101. package/test-projects/django-app/.ai-dev/summary.md +0 -15
  102. package/test-projects/django-app/.ai-dev/symbols.json +0 -1
  103. package/test-projects/django-app/.ai-dev/tech_stack.md +0 -32
  104. package/test-projects/django-app/README.md +0 -91
  105. package/test-projects/django-app/blog/__init__.py +0 -0
  106. package/test-projects/django-app/blog/admin.py +0 -31
  107. package/test-projects/django-app/blog/models.py +0 -55
  108. package/test-projects/django-app/blog/serializers.py +0 -69
  109. package/test-projects/django-app/blog/urls.py +0 -14
  110. package/test-projects/django-app/blog/views.py +0 -96
  111. package/test-projects/django-app/django_app/__init__.py +0 -0
  112. package/test-projects/django-app/django_app/settings.py +0 -90
  113. package/test-projects/django-app/django_app/urls.py +0 -11
  114. package/test-projects/django-app/django_app/wsgi.py +0 -9
  115. package/test-projects/django-app/manage.py +0 -23
  116. package/test-projects/django-app/requirements.txt +0 -3
  117. package/test-projects/django-app/users/__init__.py +0 -0
  118. package/test-projects/django-app/users/admin.py +0 -42
  119. package/test-projects/django-app/users/models.py +0 -54
  120. package/test-projects/django-app/users/serializers.py +0 -113
  121. package/test-projects/django-app/users/urls.py +0 -13
  122. package/test-projects/django-app/users/views.py +0 -135
  123. package/test-projects/express-api/.ai-dev/ai_context.md +0 -112
  124. package/test-projects/express-api/.ai-dev/ai_rules.md +0 -50
  125. package/test-projects/express-api/.ai-dev/architecture.md +0 -62
  126. package/test-projects/express-api/.ai-dev/context/features/controllers.json +0 -13
  127. package/test-projects/express-api/.ai-dev/context/features/services.json +0 -13
  128. package/test-projects/express-api/.ai-dev/context/flows/auth.json +0 -12
  129. package/test-projects/express-api/.ai-dev/context/flows/user.json +0 -13
  130. package/test-projects/express-api/.ai-dev/conventions.md +0 -51
  131. package/test-projects/express-api/.ai-dev/dependencies.json +0 -54
  132. package/test-projects/express-api/.ai-dev/entrypoints.md +0 -17
  133. package/test-projects/express-api/.ai-dev/modules.json +0 -30
  134. package/test-projects/express-api/.ai-dev/project.json +0 -15
  135. package/test-projects/express-api/.ai-dev/repo_map.json +0 -100
  136. package/test-projects/express-api/.ai-dev/repo_map.md +0 -36
  137. package/test-projects/express-api/.ai-dev/schema.json +0 -5
  138. package/test-projects/express-api/.ai-dev/summary.md +0 -14
  139. package/test-projects/express-api/.ai-dev/symbols.json +0 -7
  140. package/test-projects/express-api/.ai-dev/tech_stack.md +0 -38
  141. package/test-projects/express-api/.ai-dev/tools.json +0 -10
  142. package/test-projects/express-api/controllers/authController.js +0 -32
  143. package/test-projects/express-api/controllers/userController.js +0 -51
  144. package/test-projects/express-api/index.js +0 -30
  145. package/test-projects/express-api/middleware/authMiddleware.js +0 -30
  146. package/test-projects/express-api/models/userRepository.js +0 -25
  147. package/test-projects/express-api/package.json +0 -18
  148. package/test-projects/express-api/services/authService.js +0 -17
  149. package/test-projects/express-api/services/userService.js +0 -28
  150. package/test-projects/fastapi-app/.ai-dev/ai_context.md +0 -89
  151. package/test-projects/fastapi-app/.ai-dev/ai_rules.md +0 -47
  152. package/test-projects/fastapi-app/.ai-dev/architecture.md +0 -39
  153. package/test-projects/fastapi-app/.ai-dev/cache.json +0 -125
  154. package/test-projects/fastapi-app/.ai-dev/conventions.md +0 -51
  155. package/test-projects/fastapi-app/.ai-dev/dependencies.json +0 -244
  156. package/test-projects/fastapi-app/.ai-dev/entrypoints.md +0 -4
  157. package/test-projects/fastapi-app/.ai-dev/files.json +0 -154
  158. package/test-projects/fastapi-app/.ai-dev/graph/knowledge-graph.json +0 -15
  159. package/test-projects/fastapi-app/.ai-dev/graph/module-graph.json +0 -78
  160. package/test-projects/fastapi-app/.ai-dev/graph/symbol-graph.json +0 -1724
  161. package/test-projects/fastapi-app/.ai-dev/graph/symbol-references.json +0 -51
  162. package/test-projects/fastapi-app/.ai-dev/index-state.json +0 -217
  163. package/test-projects/fastapi-app/.ai-dev/modules.json +0 -16
  164. package/test-projects/fastapi-app/.ai-dev/project.json +0 -9
  165. package/test-projects/fastapi-app/.ai-dev/repo_map.json +0 -298
  166. package/test-projects/fastapi-app/.ai-dev/repo_map.md +0 -74
  167. package/test-projects/fastapi-app/.ai-dev/schema.json +0 -5
  168. package/test-projects/fastapi-app/.ai-dev/summary.md +0 -12
  169. package/test-projects/fastapi-app/.ai-dev/symbols.json +0 -1
  170. package/test-projects/fastapi-app/.ai-dev/tech_stack.md +0 -32
  171. package/test-projects/fastapi-app/.ai-dev/tools.json +0 -10
  172. package/test-projects/fastapi-app/README.md +0 -118
  173. package/test-projects/fastapi-app/app/database.py +0 -21
  174. package/test-projects/fastapi-app/app/dependencies.py +0 -107
  175. package/test-projects/fastapi-app/app/main.py +0 -47
  176. package/test-projects/fastapi-app/app/models.py +0 -149
  177. package/test-projects/fastapi-app/app/routers/auth.py +0 -117
  178. package/test-projects/fastapi-app/app/routers/posts.py +0 -272
  179. package/test-projects/fastapi-app/app/schemas.py +0 -191
  180. package/test-projects/fastapi-app/requirements.txt +0 -10
  181. package/test-projects/flask-app/.ai-dev/ai_context.md +0 -94
  182. package/test-projects/flask-app/.ai-dev/ai_rules.md +0 -47
  183. package/test-projects/flask-app/.ai-dev/architecture.md +0 -49
  184. package/test-projects/flask-app/.ai-dev/cache.json +0 -157
  185. package/test-projects/flask-app/.ai-dev/context/features/app.json +0 -25
  186. package/test-projects/flask-app/.ai-dev/context/flows/routes.json +0 -14
  187. package/test-projects/flask-app/.ai-dev/conventions.md +0 -51
  188. package/test-projects/flask-app/.ai-dev/dependencies.json +0 -298
  189. package/test-projects/flask-app/.ai-dev/entrypoints.md +0 -4
  190. package/test-projects/flask-app/.ai-dev/files.json +0 -194
  191. package/test-projects/flask-app/.ai-dev/graph/knowledge-graph.json +0 -60
  192. package/test-projects/flask-app/.ai-dev/graph/module-graph.json +0 -95
  193. package/test-projects/flask-app/.ai-dev/graph/symbol-graph.json +0 -1448
  194. package/test-projects/flask-app/.ai-dev/graph/symbol-references.json +0 -45
  195. package/test-projects/flask-app/.ai-dev/index-state.json +0 -273
  196. package/test-projects/flask-app/.ai-dev/modules.json +0 -21
  197. package/test-projects/flask-app/.ai-dev/project.json +0 -13
  198. package/test-projects/flask-app/.ai-dev/repo_map.json +0 -400
  199. package/test-projects/flask-app/.ai-dev/repo_map.md +0 -98
  200. package/test-projects/flask-app/.ai-dev/summary.md +0 -13
  201. package/test-projects/flask-app/.ai-dev/symbols.json +0 -1
  202. package/test-projects/flask-app/.ai-dev/tech_stack.md +0 -32
  203. package/test-projects/flask-app/.ai-dev/tools.json +0 -10
  204. package/test-projects/flask-app/README.md +0 -129
  205. package/test-projects/flask-app/app/__init__.py +0 -46
  206. package/test-projects/flask-app/app/api/__init__.py +0 -7
  207. package/test-projects/flask-app/app/api/routes.py +0 -122
  208. package/test-projects/flask-app/app/auth/__init__.py +0 -7
  209. package/test-projects/flask-app/app/auth/forms.py +0 -52
  210. package/test-projects/flask-app/app/auth/routes.py +0 -68
  211. package/test-projects/flask-app/app/blog/__init__.py +0 -7
  212. package/test-projects/flask-app/app/blog/forms.py +0 -35
  213. package/test-projects/flask-app/app/blog/routes.py +0 -140
  214. package/test-projects/flask-app/app/main/__init__.py +0 -7
  215. package/test-projects/flask-app/app/main/routes.py +0 -88
  216. package/test-projects/flask-app/app/models.py +0 -177
  217. package/test-projects/flask-app/config.py +0 -64
  218. package/test-projects/flask-app/requirements.txt +0 -10
  219. package/test-projects/laravel-app/.ai-dev/ai_context.md +0 -97
  220. package/test-projects/laravel-app/.ai-dev/ai_rules.md +0 -47
  221. package/test-projects/laravel-app/.ai-dev/architecture.md +0 -60
  222. package/test-projects/laravel-app/.ai-dev/cache.json +0 -161
  223. package/test-projects/laravel-app/.ai-dev/context/features/app.json +0 -21
  224. package/test-projects/laravel-app/.ai-dev/context/flows/.json +0 -9
  225. package/test-projects/laravel-app/.ai-dev/context/flows/category.json +0 -12
  226. package/test-projects/laravel-app/.ai-dev/context/flows/comment.json +0 -12
  227. package/test-projects/laravel-app/.ai-dev/context/flows/post.json +0 -12
  228. package/test-projects/laravel-app/.ai-dev/context/flows/unnamed.json +0 -9
  229. package/test-projects/laravel-app/.ai-dev/conventions.md +0 -51
  230. package/test-projects/laravel-app/.ai-dev/dependencies.json +0 -6
  231. package/test-projects/laravel-app/.ai-dev/entrypoints.md +0 -4
  232. package/test-projects/laravel-app/.ai-dev/files.json +0 -199
  233. package/test-projects/laravel-app/.ai-dev/graph/knowledge-graph.json +0 -98
  234. package/test-projects/laravel-app/.ai-dev/graph/module-graph.json +0 -30
  235. package/test-projects/laravel-app/.ai-dev/graph/symbol-graph.json +0 -5
  236. package/test-projects/laravel-app/.ai-dev/graph/symbol-references.json +0 -1
  237. package/test-projects/laravel-app/.ai-dev/index-state.json +0 -280
  238. package/test-projects/laravel-app/.ai-dev/modules.json +0 -29
  239. package/test-projects/laravel-app/.ai-dev/project.json +0 -17
  240. package/test-projects/laravel-app/.ai-dev/repo_map.json +0 -419
  241. package/test-projects/laravel-app/.ai-dev/repo_map.md +0 -106
  242. package/test-projects/laravel-app/.ai-dev/schema.json +0 -5
  243. package/test-projects/laravel-app/.ai-dev/summary.md +0 -15
  244. package/test-projects/laravel-app/.ai-dev/symbols.json +0 -1
  245. package/test-projects/laravel-app/.ai-dev/tech_stack.md +0 -34
  246. package/test-projects/laravel-app/.ai-dev/tools.json +0 -10
  247. package/test-projects/laravel-app/README.md +0 -107
  248. package/test-projects/laravel-app/app/Http/Controllers/Api/CategoryController.php +0 -88
  249. package/test-projects/laravel-app/app/Http/Controllers/Api/CommentController.php +0 -56
  250. package/test-projects/laravel-app/app/Http/Controllers/Api/PostController.php +0 -174
  251. package/test-projects/laravel-app/app/Http/Controllers/Controller.php +0 -12
  252. package/test-projects/laravel-app/app/Models/Category.php +0 -34
  253. package/test-projects/laravel-app/app/Models/Comment.php +0 -51
  254. package/test-projects/laravel-app/app/Models/Post.php +0 -108
  255. package/test-projects/laravel-app/app/Models/User.php +0 -85
  256. package/test-projects/laravel-app/bootstrap/app.php +0 -25
  257. package/test-projects/laravel-app/composer.json +0 -35
  258. package/test-projects/laravel-app/routes/api.php +0 -40
  259. package/test-projects/nestjs-backend/.ai-dev/ai_context.md +0 -111
  260. package/test-projects/nestjs-backend/.ai-dev/ai_rules.md +0 -52
  261. package/test-projects/nestjs-backend/.ai-dev/architecture.md +0 -49
  262. package/test-projects/nestjs-backend/.ai-dev/cache.json +0 -169
  263. package/test-projects/nestjs-backend/.ai-dev/context/features/src.json +0 -23
  264. package/test-projects/nestjs-backend/.ai-dev/context/flows/auth.controller.json +0 -14
  265. package/test-projects/nestjs-backend/.ai-dev/context/flows/auth.json +0 -10
  266. package/test-projects/nestjs-backend/.ai-dev/context/flows/users..json +0 -10
  267. package/test-projects/nestjs-backend/.ai-dev/context/flows/users.controller.json +0 -14
  268. package/test-projects/nestjs-backend/.ai-dev/context/flows/users.json +0 -10
  269. package/test-projects/nestjs-backend/.ai-dev/conventions.md +0 -52
  270. package/test-projects/nestjs-backend/.ai-dev/dependencies.json +0 -152
  271. package/test-projects/nestjs-backend/.ai-dev/entrypoints.md +0 -18
  272. package/test-projects/nestjs-backend/.ai-dev/files.json +0 -209
  273. package/test-projects/nestjs-backend/.ai-dev/graph/knowledge-graph.json +0 -132
  274. package/test-projects/nestjs-backend/.ai-dev/graph/module-graph.json +0 -29
  275. package/test-projects/nestjs-backend/.ai-dev/graph/symbol-graph.json +0 -304
  276. package/test-projects/nestjs-backend/.ai-dev/graph/symbol-references.json +0 -5
  277. package/test-projects/nestjs-backend/.ai-dev/index-state.json +0 -294
  278. package/test-projects/nestjs-backend/.ai-dev/modules.json +0 -19
  279. package/test-projects/nestjs-backend/.ai-dev/project.json +0 -18
  280. package/test-projects/nestjs-backend/.ai-dev/repo_map.json +0 -427
  281. package/test-projects/nestjs-backend/.ai-dev/repo_map.md +0 -104
  282. package/test-projects/nestjs-backend/.ai-dev/schema.json +0 -5
  283. package/test-projects/nestjs-backend/.ai-dev/summary.md +0 -13
  284. package/test-projects/nestjs-backend/.ai-dev/symbols.json +0 -1
  285. package/test-projects/nestjs-backend/.ai-dev/tech_stack.md +0 -38
  286. package/test-projects/nestjs-backend/.ai-dev/tools.json +0 -10
  287. package/test-projects/nestjs-backend/package.json +0 -22
  288. package/test-projects/nestjs-backend/src/app.module.ts +0 -8
  289. package/test-projects/nestjs-backend/src/auth/auth.controller.ts +0 -22
  290. package/test-projects/nestjs-backend/src/auth/auth.module.ts +0 -11
  291. package/test-projects/nestjs-backend/src/auth/auth.service.ts +0 -28
  292. package/test-projects/nestjs-backend/src/auth/dto/login.dto.ts +0 -4
  293. package/test-projects/nestjs-backend/src/auth/strategies/jwt.strategy.ts +0 -18
  294. package/test-projects/nestjs-backend/src/main.ts +0 -9
  295. package/test-projects/nestjs-backend/src/users/users.controller.ts +0 -32
  296. package/test-projects/nestjs-backend/src/users/users.module.ts +0 -10
  297. package/test-projects/nestjs-backend/src/users/users.service.ts +0 -42
  298. package/test-projects/nestjs-backend/tsconfig.json +0 -21
  299. package/test-projects/python-cli/.ai-dev/ai_context.md +0 -95
  300. package/test-projects/python-cli/.ai-dev/ai_rules.md +0 -47
  301. package/test-projects/python-cli/.ai-dev/architecture.md +0 -55
  302. package/test-projects/python-cli/.ai-dev/cache.json +0 -149
  303. package/test-projects/python-cli/.ai-dev/context/features/cli.json +0 -16
  304. package/test-projects/python-cli/.ai-dev/context/flows/list_.json +0 -9
  305. package/test-projects/python-cli/.ai-dev/context/flows/remove_.json +0 -9
  306. package/test-projects/python-cli/.ai-dev/conventions.md +0 -51
  307. package/test-projects/python-cli/.ai-dev/dependencies.json +0 -66
  308. package/test-projects/python-cli/.ai-dev/entrypoints.md +0 -4
  309. package/test-projects/python-cli/.ai-dev/files.json +0 -184
  310. package/test-projects/python-cli/.ai-dev/graph/knowledge-graph.json +0 -83
  311. package/test-projects/python-cli/.ai-dev/graph/module-graph.json +0 -31
  312. package/test-projects/python-cli/.ai-dev/graph/symbol-graph.json +0 -358
  313. package/test-projects/python-cli/.ai-dev/graph/symbol-references.json +0 -11
  314. package/test-projects/python-cli/.ai-dev/index-state.json +0 -259
  315. package/test-projects/python-cli/.ai-dev/modules.json +0 -21
  316. package/test-projects/python-cli/.ai-dev/project.json +0 -15
  317. package/test-projects/python-cli/.ai-dev/repo_map.json +0 -367
  318. package/test-projects/python-cli/.ai-dev/repo_map.md +0 -93
  319. package/test-projects/python-cli/.ai-dev/schema.json +0 -5
  320. package/test-projects/python-cli/.ai-dev/summary.md +0 -14
  321. package/test-projects/python-cli/.ai-dev/symbols.json +0 -1
  322. package/test-projects/python-cli/.ai-dev/tech_stack.md +0 -32
  323. package/test-projects/python-cli/.ai-dev/tools.json +0 -10
  324. package/test-projects/python-cli/__init__.py +0 -1
  325. package/test-projects/python-cli/cli/__init__.py +0 -1
  326. package/test-projects/python-cli/cli/add_command.py +0 -6
  327. package/test-projects/python-cli/cli/list_command.py +0 -7
  328. package/test-projects/python-cli/cli/remove_command.py +0 -6
  329. package/test-projects/python-cli/main.py +0 -34
  330. package/test-projects/python-cli/models/__init__.py +0 -2
  331. package/test-projects/python-cli/models/task.py +0 -19
  332. package/test-projects/python-cli/models/task_repository.py +0 -44
  333. package/test-projects/rails-app/.ai-dev/ai_context.md +0 -94
  334. package/test-projects/rails-app/.ai-dev/ai_rules.md +0 -47
  335. package/test-projects/rails-app/.ai-dev/architecture.md +0 -49
  336. package/test-projects/rails-app/.ai-dev/cache.json +0 -193
  337. package/test-projects/rails-app/.ai-dev/context/features/app.json +0 -24
  338. package/test-projects/rails-app/.ai-dev/context/features/config.json +0 -13
  339. package/test-projects/rails-app/.ai-dev/context/flows/application.json +0 -9
  340. package/test-projects/rails-app/.ai-dev/context/flows/application_.json +0 -9
  341. package/test-projects/rails-app/.ai-dev/context/flows/comments.json +0 -11
  342. package/test-projects/rails-app/.ai-dev/context/flows/comments_.json +0 -11
  343. package/test-projects/rails-app/.ai-dev/context/flows/posts.json +0 -11
  344. package/test-projects/rails-app/.ai-dev/context/flows/posts_.json +0 -11
  345. package/test-projects/rails-app/.ai-dev/context/flows/routes.json +0 -9
  346. package/test-projects/rails-app/.ai-dev/context/flows/users.json +0 -11
  347. package/test-projects/rails-app/.ai-dev/context/flows/users_.json +0 -11
  348. package/test-projects/rails-app/.ai-dev/conventions.md +0 -51
  349. package/test-projects/rails-app/.ai-dev/dependencies.json +0 -6
  350. package/test-projects/rails-app/.ai-dev/entrypoints.md +0 -4
  351. package/test-projects/rails-app/.ai-dev/files.json +0 -239
  352. package/test-projects/rails-app/.ai-dev/graph/knowledge-graph.json +0 -130
  353. package/test-projects/rails-app/.ai-dev/graph/module-graph.json +0 -27
  354. package/test-projects/rails-app/.ai-dev/graph/symbol-graph.json +0 -5
  355. package/test-projects/rails-app/.ai-dev/graph/symbol-references.json +0 -1
  356. package/test-projects/rails-app/.ai-dev/index-state.json +0 -336
  357. package/test-projects/rails-app/.ai-dev/modules.json +0 -26
  358. package/test-projects/rails-app/.ai-dev/project.json +0 -22
  359. package/test-projects/rails-app/.ai-dev/repo_map.json +0 -486
  360. package/test-projects/rails-app/.ai-dev/repo_map.md +0 -117
  361. package/test-projects/rails-app/.ai-dev/schema.json +0 -5
  362. package/test-projects/rails-app/.ai-dev/summary.md +0 -13
  363. package/test-projects/rails-app/.ai-dev/symbols.json +0 -1
  364. package/test-projects/rails-app/.ai-dev/tech_stack.md +0 -32
  365. package/test-projects/rails-app/.ai-dev/tools.json +0 -10
  366. package/test-projects/rails-app/Gemfile +0 -38
  367. package/test-projects/rails-app/README.md +0 -140
  368. package/test-projects/rails-app/Rakefile +0 -8
  369. package/test-projects/rails-app/app/controllers/api/comments_controller.rb +0 -75
  370. package/test-projects/rails-app/app/controllers/api/posts_controller.rb +0 -68
  371. package/test-projects/rails-app/app/controllers/api/users_controller.rb +0 -54
  372. package/test-projects/rails-app/app/controllers/application_controller.rb +0 -31
  373. package/test-projects/rails-app/app/models/comment.rb +0 -34
  374. package/test-projects/rails-app/app/models/post.rb +0 -36
  375. package/test-projects/rails-app/app/models/user.rb +0 -28
  376. package/test-projects/rails-app/app/services/post_service.rb +0 -92
  377. package/test-projects/rails-app/app/services/user_service.rb +0 -76
  378. package/test-projects/rails-app/config/application.rb +0 -27
  379. package/test-projects/rails-app/config/environment.rb +0 -7
  380. package/test-projects/rails-app/config/routes.rb +0 -15
  381. package/test-projects/react-app/.ai-dev/ai_context.md +0 -96
  382. package/test-projects/react-app/.ai-dev/architecture.md +0 -39
  383. package/test-projects/react-app/.ai-dev/cache.json +0 -153
  384. package/test-projects/react-app/.ai-dev/context/features/src.json +0 -18
  385. package/test-projects/react-app/.ai-dev/context/flows/UsersPage.json +0 -14
  386. package/test-projects/react-app/.ai-dev/context/flows/dashboard.json +0 -9
  387. package/test-projects/react-app/.ai-dev/context/flows/login.json +0 -9
  388. package/test-projects/react-app/.ai-dev/context/flows/users.json +0 -9
  389. package/test-projects/react-app/.ai-dev/dependencies.json +0 -128
  390. package/test-projects/react-app/.ai-dev/entrypoints.md +0 -4
  391. package/test-projects/react-app/.ai-dev/files.json +0 -189
  392. package/test-projects/react-app/.ai-dev/graph/knowledge-graph.json +0 -112
  393. package/test-projects/react-app/.ai-dev/graph/module-graph.json +0 -31
  394. package/test-projects/react-app/.ai-dev/graph/symbol-graph.json +0 -868
  395. package/test-projects/react-app/.ai-dev/graph/symbol-references.json +0 -31
  396. package/test-projects/react-app/.ai-dev/index-state.json +0 -266
  397. package/test-projects/react-app/.ai-dev/modules.json +0 -17
  398. package/test-projects/react-app/.ai-dev/project.json +0 -16
  399. package/test-projects/react-app/.ai-dev/repo_map.json +0 -391
  400. package/test-projects/react-app/.ai-dev/repo_map.md +0 -94
  401. package/test-projects/react-app/.ai-dev/schema.json +0 -5
  402. package/test-projects/react-app/.ai-dev/summary.md +0 -13
  403. package/test-projects/react-app/.ai-dev/symbols.json +0 -1
  404. package/test-projects/react-app/.ai-dev/tools.json +0 -10
  405. package/test-projects/react-app/package.json +0 -16
  406. package/test-projects/react-app/src/App.tsx +0 -21
  407. package/test-projects/react-app/src/context/AuthContext.tsx +0 -41
  408. package/test-projects/react-app/src/hooks/useAuth.ts +0 -10
  409. package/test-projects/react-app/src/main.tsx +0 -10
  410. package/test-projects/react-app/src/pages/DashboardPage.tsx +0 -17
  411. package/test-projects/react-app/src/pages/LoginPage.tsx +0 -41
  412. package/test-projects/react-app/src/pages/UsersPage.tsx +0 -36
  413. package/test-projects/react-app/src/services/userService.ts +0 -37
  414. package/test-projects/salesforce-cli/.ai-dev/ai_context.md +0 -89
  415. package/test-projects/salesforce-cli/.ai-dev/ai_rules.md +0 -47
  416. package/test-projects/salesforce-cli/.ai-dev/architecture.md +0 -39
  417. package/test-projects/salesforce-cli/.ai-dev/cache.json +0 -125
  418. package/test-projects/salesforce-cli/.ai-dev/context/features/force-app.json +0 -14
  419. package/test-projects/salesforce-cli/.ai-dev/context/flows/account.json +0 -9
  420. package/test-projects/salesforce-cli/.ai-dev/context/flows/opportunity.json +0 -9
  421. package/test-projects/salesforce-cli/.ai-dev/conventions.md +0 -51
  422. package/test-projects/salesforce-cli/.ai-dev/dependencies.json +0 -6
  423. package/test-projects/salesforce-cli/.ai-dev/entrypoints.md +0 -4
  424. package/test-projects/salesforce-cli/.ai-dev/files.json +0 -154
  425. package/test-projects/salesforce-cli/.ai-dev/graph/knowledge-graph.json +0 -64
  426. package/test-projects/salesforce-cli/.ai-dev/graph/module-graph.json +0 -13
  427. package/test-projects/salesforce-cli/.ai-dev/graph/symbol-graph.json +0 -148
  428. package/test-projects/salesforce-cli/.ai-dev/graph/symbol-references.json +0 -1
  429. package/test-projects/salesforce-cli/.ai-dev/index-state.json +0 -217
  430. package/test-projects/salesforce-cli/.ai-dev/modules.json +0 -12
  431. package/test-projects/salesforce-cli/.ai-dev/project.json +0 -14
  432. package/test-projects/salesforce-cli/.ai-dev/repo_map.json +0 -328
  433. package/test-projects/salesforce-cli/.ai-dev/repo_map.md +0 -80
  434. package/test-projects/salesforce-cli/.ai-dev/schema.json +0 -5
  435. package/test-projects/salesforce-cli/.ai-dev/summary.md +0 -13
  436. package/test-projects/salesforce-cli/.ai-dev/symbols.json +0 -1
  437. package/test-projects/salesforce-cli/.ai-dev/tech_stack.md +0 -31
  438. package/test-projects/salesforce-cli/.ai-dev/tools.json +0 -10
  439. package/test-projects/salesforce-cli/.forceignore +0 -27
  440. package/test-projects/salesforce-cli/force-app/main/default/classes/AccountController.cls +0 -24
  441. package/test-projects/salesforce-cli/force-app/main/default/classes/OpportunityController.cls +0 -25
  442. package/test-projects/salesforce-cli/force-app/main/default/objects/Project__c.object.xml +0 -45
  443. package/test-projects/salesforce-cli/force-app/main/default/triggers/AccountTrigger.trigger +0 -33
  444. package/test-projects/salesforce-cli/sfdx-project.json +0 -11
  445. package/test-projects/spring-boot-app/.ai-dev/ai_context.md +0 -91
  446. package/test-projects/spring-boot-app/.ai-dev/ai_rules.md +0 -48
  447. package/test-projects/spring-boot-app/.ai-dev/architecture.md +0 -39
  448. package/test-projects/spring-boot-app/.ai-dev/cache.json +0 -173
  449. package/test-projects/spring-boot-app/.ai-dev/context/features/src.json +0 -26
  450. package/test-projects/spring-boot-app/.ai-dev/context/flows/PostController.json +0 -19
  451. package/test-projects/spring-boot-app/.ai-dev/context/flows/UserController.json +0 -19
  452. package/test-projects/spring-boot-app/.ai-dev/context/flows/comment.json +0 -11
  453. package/test-projects/spring-boot-app/.ai-dev/context/flows/post.json +0 -14
  454. package/test-projects/spring-boot-app/.ai-dev/context/flows/user.json +0 -14
  455. package/test-projects/spring-boot-app/.ai-dev/conventions.md +0 -52
  456. package/test-projects/spring-boot-app/.ai-dev/dependencies.json +0 -326
  457. package/test-projects/spring-boot-app/.ai-dev/entrypoints.md +0 -4
  458. package/test-projects/spring-boot-app/.ai-dev/files.json +0 -214
  459. package/test-projects/spring-boot-app/.ai-dev/graph/knowledge-graph.json +0 -231
  460. package/test-projects/spring-boot-app/.ai-dev/graph/module-graph.json +0 -22
  461. package/test-projects/spring-boot-app/.ai-dev/graph/symbol-graph.json +0 -794
  462. package/test-projects/spring-boot-app/.ai-dev/graph/symbol-references.json +0 -70
  463. package/test-projects/spring-boot-app/.ai-dev/index-state.json +0 -301
  464. package/test-projects/spring-boot-app/.ai-dev/modules.json +0 -21
  465. package/test-projects/spring-boot-app/.ai-dev/project.json +0 -17
  466. package/test-projects/spring-boot-app/.ai-dev/repo_map.json +0 -461
  467. package/test-projects/spring-boot-app/.ai-dev/repo_map.md +0 -109
  468. package/test-projects/spring-boot-app/.ai-dev/schema.json +0 -5
  469. package/test-projects/spring-boot-app/.ai-dev/summary.md +0 -12
  470. package/test-projects/spring-boot-app/.ai-dev/symbols.json +0 -1
  471. package/test-projects/spring-boot-app/.ai-dev/tech_stack.md +0 -32
  472. package/test-projects/spring-boot-app/.ai-dev/tools.json +0 -10
  473. package/test-projects/spring-boot-app/.classpath +0 -57
  474. package/test-projects/spring-boot-app/.factorypath +0 -69
  475. package/test-projects/spring-boot-app/.project +0 -34
  476. package/test-projects/spring-boot-app/.settings/org.eclipse.core.resources.prefs +0 -4
  477. package/test-projects/spring-boot-app/.settings/org.eclipse.jdt.apt.core.prefs +0 -4
  478. package/test-projects/spring-boot-app/.settings/org.eclipse.jdt.core.prefs +0 -10
  479. package/test-projects/spring-boot-app/.settings/org.eclipse.m2e.core.prefs +0 -4
  480. package/test-projects/spring-boot-app/README.md +0 -122
  481. package/test-projects/spring-boot-app/pom.xml +0 -79
  482. package/test-projects/spring-boot-app/src/main/java/com/example/demo/DemoApplication.java +0 -12
  483. package/test-projects/spring-boot-app/src/main/java/com/example/demo/controllers/CommentController.java +0 -89
  484. package/test-projects/spring-boot-app/src/main/java/com/example/demo/controllers/PostController.java +0 -92
  485. package/test-projects/spring-boot-app/src/main/java/com/example/demo/controllers/UserController.java +0 -84
  486. package/test-projects/spring-boot-app/src/main/java/com/example/demo/models/Comment.java +0 -38
  487. package/test-projects/spring-boot-app/src/main/java/com/example/demo/models/Post.java +0 -56
  488. package/test-projects/spring-boot-app/src/main/java/com/example/demo/models/User.java +0 -44
  489. package/test-projects/spring-boot-app/src/main/java/com/example/demo/repositories/CommentRepository.java +0 -21
  490. package/test-projects/spring-boot-app/src/main/java/com/example/demo/repositories/PostRepository.java +0 -18
  491. package/test-projects/spring-boot-app/src/main/java/com/example/demo/repositories/UserRepository.java +0 -15
  492. package/test-projects/spring-boot-app/src/main/java/com/example/demo/services/PostService.java +0 -83
  493. package/test-projects/spring-boot-app/src/main/java/com/example/demo/services/UserService.java +0 -62
  494. package/test-projects/spring-boot-app/src/main/resources/application.properties +0 -22
  495. package/test-projects/spring-boot-app/target/classes/com/example/demo/DemoApplication.class +0 -0
  496. package/test-projects/spring-boot-app/target/classes/com/example/demo/controllers/CommentController$CommentCreateRequest.class +0 -0
  497. package/test-projects/spring-boot-app/target/classes/com/example/demo/controllers/CommentController$CommentUpdateRequest.class +0 -0
  498. package/test-projects/spring-boot-app/target/classes/com/example/demo/controllers/CommentController.class +0 -0
  499. package/test-projects/spring-boot-app/target/classes/com/example/demo/controllers/PostController$PostCreateRequest.class +0 -0
  500. package/test-projects/spring-boot-app/target/classes/com/example/demo/controllers/PostController$PostUpdateRequest.class +0 -0
  501. package/test-projects/spring-boot-app/target/classes/com/example/demo/controllers/PostController.class +0 -0
  502. package/test-projects/spring-boot-app/target/classes/com/example/demo/controllers/UserController$UserCreateRequest.class +0 -0
  503. package/test-projects/spring-boot-app/target/classes/com/example/demo/controllers/UserController$UserUpdateRequest.class +0 -0
  504. package/test-projects/spring-boot-app/target/classes/com/example/demo/controllers/UserController.class +0 -0
  505. package/test-projects/spring-boot-app/target/classes/com/example/demo/models/Comment.class +0 -0
  506. package/test-projects/spring-boot-app/target/classes/com/example/demo/models/Post.class +0 -0
  507. package/test-projects/spring-boot-app/target/classes/com/example/demo/models/User.class +0 -0
  508. package/test-projects/spring-boot-app/target/classes/com/example/demo/repositories/CommentRepository.class +0 -0
  509. package/test-projects/spring-boot-app/target/classes/com/example/demo/repositories/PostRepository.class +0 -0
  510. package/test-projects/spring-boot-app/target/classes/com/example/demo/repositories/UserRepository.class +0 -0
  511. package/test-projects/spring-boot-app/target/classes/com/example/demo/services/PostService.class +0 -0
  512. package/test-projects/spring-boot-app/target/classes/com/example/demo/services/UserService.class +0 -0
  513. package/tests/e2e/run-e2e.sh +0 -88
  514. /package/{test-projects/django-app/.ai-dev → ai-context}/tools.json +0 -0
@@ -1,55 +0,0 @@
1
- """Blog application models."""
2
-
3
- from django.db import models
4
- from django.contrib.auth.models import User
5
-
6
-
7
- class Post(models.Model):
8
- """Blog post model."""
9
-
10
- title = models.CharField(max_length=200)
11
- content = models.TextField()
12
- author = models.ForeignKey(User, on_delete=models.CASCADE, related_name="posts")
13
- created_at = models.DateTimeField(auto_now_add=True)
14
- updated_at = models.DateTimeField(auto_now=True)
15
- published = models.BooleanField(default=False)
16
-
17
- class Meta:
18
- ordering = ["-created_at"]
19
-
20
- def __str__(self):
21
- return self.title
22
-
23
- def publish(self):
24
- """Publish the post."""
25
- self.published = True
26
- self.save()
27
-
28
-
29
- class Comment(models.Model):
30
- """Comment model for blog posts."""
31
-
32
- post = models.ForeignKey(Post, on_delete=models.CASCADE, related_name="comments")
33
- author = models.ForeignKey(User, on_delete=models.CASCADE, related_name="comments")
34
- content = models.TextField()
35
- created_at = models.DateTimeField(auto_now_add=True)
36
-
37
- class Meta:
38
- ordering = ["-created_at"]
39
-
40
- def __str__(self):
41
- return f"Comment by {self.author.username} on {self.post.title}"
42
-
43
-
44
- class Category(models.Model):
45
- """Category model for organizing posts."""
46
-
47
- name = models.CharField(max_length=100, unique=True)
48
- description = models.TextField(blank=True)
49
- posts = models.ManyToManyField(Post, related_name="categories", blank=True)
50
-
51
- class Meta:
52
- verbose_name_plural = "categories"
53
-
54
- def __str__(self):
55
- return self.name
@@ -1,69 +0,0 @@
1
- """Blog application serializers."""
2
-
3
- from rest_framework import serializers
4
- from django.contrib.auth.models import User
5
- from .models import Post, Comment, Category
6
-
7
-
8
- class CategorySerializer(serializers.ModelSerializer):
9
- """Serializer for Category model."""
10
-
11
- class Meta:
12
- model = Category
13
- fields = ["id", "name", "description"]
14
-
15
-
16
- class CommentSerializer(serializers.ModelSerializer):
17
- """Serializer for Comment model."""
18
-
19
- author_username = serializers.CharField(source="author.username", read_only=True)
20
-
21
- class Meta:
22
- model = Comment
23
- fields = ["id", "post", "author", "author_username", "content", "created_at"]
24
- read_only_fields = ["author"]
25
-
26
-
27
- class PostSerializer(serializers.ModelSerializer):
28
- """Serializer for Post model."""
29
-
30
- author_username = serializers.CharField(source="author.username", read_only=True)
31
- comments_count = serializers.IntegerField(source="comments.count", read_only=True)
32
- categories = CategorySerializer(many=True, read_only=True)
33
-
34
- class Meta:
35
- model = Post
36
- fields = [
37
- "id",
38
- "title",
39
- "content",
40
- "author",
41
- "author_username",
42
- "created_at",
43
- "updated_at",
44
- "published",
45
- "comments_count",
46
- "categories",
47
- ]
48
- read_only_fields = ["author"]
49
-
50
-
51
- class PostCreateUpdateSerializer(serializers.ModelSerializer):
52
- """Serializer for creating and updating posts."""
53
-
54
- category_ids = serializers.ListField(
55
- child=serializers.IntegerField(), write_only=True, required=False
56
- )
57
-
58
- class Meta:
59
- model = Post
60
- fields = ["id", "title", "content", "published", "category_ids"]
61
-
62
- def create(self, validated_data):
63
- """Create a new post with categories."""
64
- category_ids = validated_data.pop("category_ids", [])
65
- post = Post.objects.create(**validated_data)
66
- if category_ids:
67
- categories = Category.objects.filter(id__in=category_ids)
68
- post.categories.set(categories)
69
- return post
@@ -1,14 +0,0 @@
1
- """Blog application URL configuration."""
2
-
3
- from django.urls import path, include
4
- from rest_framework.routers import DefaultRouter
5
- from .views import PostViewSet, CommentViewSet, CategoryViewSet
6
-
7
- router = DefaultRouter()
8
- router.register(r"posts", PostViewSet)
9
- router.register(r"comments", CommentViewSet)
10
- router.register(r"categories", CategoryViewSet)
11
-
12
- urlpatterns = [
13
- path("", include(router.urls)),
14
- ]
@@ -1,96 +0,0 @@
1
- """Blog application views."""
2
-
3
- from rest_framework import viewsets, status
4
- from rest_framework.decorators import action
5
- from rest_framework.response import Response
6
- from rest_framework.permissions import IsAuthenticated, AllowAny
7
- from django.contrib.auth.models import User
8
- from .models import Post, Comment, Category
9
- from .serializers import (
10
- PostSerializer,
11
- PostCreateUpdateSerializer,
12
- CommentSerializer,
13
- CategorySerializer,
14
- )
15
-
16
-
17
- class PostViewSet(viewsets.ModelViewSet):
18
- """ViewSet for blog posts."""
19
-
20
- queryset = Post.objects.all()
21
- permission_classes = [IsAuthenticated]
22
-
23
- def get_serializer_class(self):
24
- """Return appropriate serializer class."""
25
- if self.action in ["create", "update", "partial_update"]:
26
- return PostCreateUpdateSerializer
27
- return PostSerializer
28
-
29
- def get_permissions(self):
30
- """Allow anyone to view published posts."""
31
- if self.action in ["list", "retrieve"]:
32
- return [AllowAny()]
33
- return [IsAuthenticated()]
34
-
35
- def perform_create(self, serializer):
36
- """Set the author to the current user."""
37
- serializer.save(author=self.request.user)
38
-
39
- @action(detail=True, methods=["post"])
40
- def publish(self, request, pk=None):
41
- """Publish a blog post."""
42
- post = self.get_object()
43
- post.publish()
44
- return Response({"status": "post published"})
45
-
46
- @action(detail=False, methods=["get"])
47
- def my_posts(self, request):
48
- """Get posts by current user."""
49
- posts = Post.objects.filter(author=request.user)
50
- serializer = PostSerializer(posts, many=True)
51
- return Response(serializer.data)
52
-
53
- @action(detail=False, methods=["get"])
54
- def published(self, request):
55
- """Get all published posts."""
56
- posts = Post.objects.filter(published=True)
57
- serializer = PostSerializer(posts, many=True)
58
- return Response(serializer.data)
59
-
60
-
61
- class CommentViewSet(viewsets.ModelViewSet):
62
- """ViewSet for comments."""
63
-
64
- queryset = Comment.objects.all()
65
- serializer_class = CommentSerializer
66
- permission_classes = [IsAuthenticated]
67
-
68
- def perform_create(self, serializer):
69
- """Set the author to the current user."""
70
- serializer.save(author=self.request.user)
71
-
72
- def get_queryset(self):
73
- """Filter comments by post if provided."""
74
- queryset = Comment.objects.all()
75
- post_id = self.request.query_params.get("post", None)
76
- if post_id:
77
- queryset = queryset.filter(post_id=post_id)
78
- return queryset
79
-
80
-
81
- class CategoryViewSet(viewsets.ModelViewSet):
82
- """ViewSet for categories."""
83
-
84
- queryset = Category.objects.all()
85
- serializer_class = CategorySerializer
86
- permission_classes = [AllowAny]
87
-
88
- @action(detail=True, methods=["get"])
89
- def posts(self, request, pk=None):
90
- """Get posts in this category."""
91
- category = self.get_object()
92
- posts = category.posts.filter(published=True)
93
- from .serializers import PostSerializer
94
-
95
- serializer = PostSerializer(posts, many=True)
96
- return Response(serializer.data)
File without changes
@@ -1,90 +0,0 @@
1
- """
2
- Django settings for django_app project.
3
- """
4
-
5
- from pathlib import Path
6
-
7
- BASE_DIR = Path(__file__).resolve().parent.parent
8
-
9
- SECRET_KEY = "django-insecure-test-key-not-for-production"
10
-
11
- DEBUG = True
12
-
13
- ALLOWED_HOSTS = ["localhost", "127.0.0.1"]
14
-
15
- INSTALLED_APPS = [
16
- "django.contrib.admin",
17
- "django.contrib.auth",
18
- "django.contrib.contenttypes",
19
- "django.contrib.sessions",
20
- "django.contrib.messages",
21
- "django.contrib.staticfiles",
22
- "rest_framework",
23
- "blog",
24
- "users",
25
- ]
26
-
27
- MIDDLEWARE = [
28
- "django.middleware.security.SecurityMiddleware",
29
- "django.contrib.sessions.middleware.SessionMiddleware",
30
- "django.middleware.common.CommonMiddleware",
31
- "django.middleware.csrf.CsrfViewMiddleware",
32
- "django.contrib.auth.middleware.AuthenticationMiddleware",
33
- "django.contrib.messages.middleware.MessageMiddleware",
34
- "django.middleware.clickjacking.XFrameOptionsMiddleware",
35
- ]
36
-
37
- ROOT_URLCONF = "django_app.urls"
38
-
39
- TEMPLATES = [
40
- {
41
- "BACKEND": "django.template.backends.django.DjangoTemplates",
42
- "DIRS": [],
43
- "APP_DIRS": True,
44
- "OPTIONS": {
45
- "context_processors": [
46
- "django.template.context_processors.debug",
47
- "django.template.context_processors.request",
48
- "django.contrib.auth.context_processors.auth",
49
- "django.contrib.messages.context_processors.messages",
50
- ],
51
- },
52
- },
53
- ]
54
-
55
- WSGI_APPLICATION = "django_app.wsgi.application"
56
-
57
- DATABASES = {
58
- "default": {
59
- "ENGINE": "django.db.backends.sqlite3",
60
- "NAME": BASE_DIR / "db.sqlite3",
61
- }
62
- }
63
-
64
- AUTH_PASSWORD_VALIDATORS = [
65
- {
66
- "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
67
- },
68
- {
69
- "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
70
- },
71
- ]
72
-
73
- LANGUAGE_CODE = "en-us"
74
- TIME_ZONE = "UTC"
75
- USE_I18N = True
76
- USE_TZ = True
77
-
78
- STATIC_URL = "static/"
79
-
80
- DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
81
-
82
- REST_FRAMEWORK = {
83
- "DEFAULT_AUTHENTICATION_CLASSES": [
84
- "rest_framework.authentication.SessionAuthentication",
85
- "rest_framework.authentication.TokenAuthentication",
86
- ],
87
- "DEFAULT_PERMISSION_CLASSES": [
88
- "rest_framework.permissions.IsAuthenticated",
89
- ],
90
- }
@@ -1,11 +0,0 @@
1
- """django_app URL configuration."""
2
-
3
- from django.contrib import admin
4
- from django.urls import path, include
5
-
6
- urlpatterns = [
7
- path("admin/", admin.site.urls),
8
- path("api/blog/", include("blog.urls")),
9
- path("api/users/", include("users.urls")),
10
- path("api-auth/", include("rest_framework.urls")),
11
- ]
@@ -1,9 +0,0 @@
1
- """WSGI config for django_app project."""
2
-
3
- import os
4
-
5
- from django.core.wsgi import get_wsgi_application
6
-
7
- os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_app.settings")
8
-
9
- application = get_wsgi_application()
@@ -1,23 +0,0 @@
1
- #!/usr/bin/env python
2
- """Django's command-line utility for administrative tasks."""
3
-
4
- import os
5
- import sys
6
-
7
-
8
- def main():
9
- """Run administrative tasks."""
10
- os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_app.settings")
11
- try:
12
- from django.core.management import execute_from_command_line
13
- except ImportError as exc:
14
- raise ImportError(
15
- "Couldn't import Django. Are you sure it's installed and "
16
- "available on your PYTHONPATH environment variable? Did you "
17
- "forget to activate a virtual environment?"
18
- ) from exc
19
- execute_from_command_line(sys.argv)
20
-
21
-
22
- if __name__ == "__main__":
23
- main()
@@ -1,3 +0,0 @@
1
- Django>=4.2.0,<5.0
2
- djangorestframework>=3.14.0
3
- Pillow>=10.0.0
File without changes
@@ -1,42 +0,0 @@
1
- """Users application admin configuration."""
2
-
3
- from django.contrib import admin
4
- from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
5
- from django.contrib.auth.models import User
6
- from .models import UserProfile, Follow
7
-
8
-
9
- class UserProfileInline(admin.StackedInline):
10
- """Inline admin for UserProfile."""
11
-
12
- model = UserProfile
13
- can_delete = False
14
- verbose_name_plural = "Profile"
15
-
16
-
17
- class UserAdmin(BaseUserAdmin):
18
- """Extended User admin with profile."""
19
-
20
- inlines = [UserProfileInline]
21
- list_display = [
22
- "username",
23
- "email",
24
- "first_name",
25
- "last_name",
26
- "is_staff",
27
- "date_joined",
28
- ]
29
-
30
-
31
- # Re-register UserAdmin
32
- admin.site.unregister(User)
33
- admin.site.register(User, UserAdmin)
34
-
35
-
36
- @admin.register(Follow)
37
- class FollowAdmin(admin.ModelAdmin):
38
- """Admin configuration for Follow model."""
39
-
40
- list_display = ["follower", "following", "created_at"]
41
- list_filter = ["created_at"]
42
- search_fields = ["follower__username", "following__username"]
@@ -1,54 +0,0 @@
1
- """Users application models."""
2
-
3
- from django.db import models
4
- from django.contrib.auth.models import User
5
- from django.db.models.signals import post_save
6
- from django.dispatch import receiver
7
-
8
-
9
- class UserProfile(models.Model):
10
- """Extended user profile model."""
11
-
12
- user = models.OneToOneField(User, on_delete=models.CASCADE, related_name="profile")
13
- bio = models.TextField(max_length=500, blank=True)
14
- location = models.CharField(max_length=100, blank=True)
15
- birth_date = models.DateField(null=True, blank=True)
16
- avatar = models.ImageField(upload_to="avatars/", blank=True)
17
- website = models.URLField(blank=True)
18
- twitter = models.CharField(max_length=100, blank=True)
19
- github = models.CharField(max_length=100, blank=True)
20
-
21
- def __str__(self):
22
- return f"{self.user.username} Profile"
23
-
24
-
25
- @receiver(post_save, sender=User)
26
- def create_user_profile(sender, instance, created, **kwargs):
27
- """Create a user profile when a new user is created."""
28
- if created:
29
- UserProfile.objects.create(user=instance)
30
-
31
-
32
- @receiver(post_save, sender=User)
33
- def save_user_profile(sender, instance, **kwargs):
34
- """Save user profile when user is saved."""
35
- instance.profile.save()
36
-
37
-
38
- class Follow(models.Model):
39
- """Follow relationship model."""
40
-
41
- follower = models.ForeignKey(
42
- User, on_delete=models.CASCADE, related_name="following"
43
- )
44
- following = models.ForeignKey(
45
- User, on_delete=models.CASCADE, related_name="followers"
46
- )
47
- created_at = models.DateTimeField(auto_now_add=True)
48
-
49
- class Meta:
50
- unique_together = ["follower", "following"]
51
- ordering = ["-created_at"]
52
-
53
- def __str__(self):
54
- return f"{self.follower.username} follows {self.following.username}"
@@ -1,113 +0,0 @@
1
- """Users application serializers."""
2
-
3
- from rest_framework import serializers
4
- from django.contrib.auth.models import User
5
- from .models import UserProfile, Follow
6
-
7
-
8
- class UserProfileSerializer(serializers.ModelSerializer):
9
- """Serializer for UserProfile model."""
10
-
11
- class Meta:
12
- model = UserProfile
13
- fields = [
14
- "bio",
15
- "location",
16
- "birth_date",
17
- "avatar",
18
- "website",
19
- "twitter",
20
- "github",
21
- ]
22
-
23
-
24
- class UserSerializer(serializers.ModelSerializer):
25
- """Serializer for User model."""
26
-
27
- profile = UserProfileSerializer()
28
- posts_count = serializers.IntegerField(source="posts.count", read_only=True)
29
- followers_count = serializers.IntegerField(source="followers.count", read_only=True)
30
- following_count = serializers.IntegerField(source="following.count", read_only=True)
31
-
32
- class Meta:
33
- model = User
34
- fields = [
35
- "id",
36
- "username",
37
- "email",
38
- "first_name",
39
- "last_name",
40
- "profile",
41
- "posts_count",
42
- "followers_count",
43
- "following_count",
44
- "date_joined",
45
- ]
46
- read_only_fields = ["date_joined"]
47
-
48
-
49
- class UserCreateSerializer(serializers.ModelSerializer):
50
- """Serializer for creating new users."""
51
-
52
- password = serializers.CharField(write_only=True)
53
- password_confirm = serializers.CharField(write_only=True)
54
-
55
- class Meta:
56
- model = User
57
- fields = [
58
- "username",
59
- "email",
60
- "password",
61
- "password_confirm",
62
- "first_name",
63
- "last_name",
64
- ]
65
-
66
- def validate(self, data):
67
- """Validate that passwords match."""
68
- if data["password"] != data["password_confirm"]:
69
- raise serializers.ValidationError("Passwords don't match")
70
- return data
71
-
72
- def create(self, validated_data):
73
- """Create a new user."""
74
- validated_data.pop("password_confirm")
75
- user = User.objects.create_user(**validated_data)
76
- return user
77
-
78
-
79
- class FollowSerializer(serializers.ModelSerializer):
80
- """Serializer for Follow model."""
81
-
82
- follower_username = serializers.CharField(
83
- source="follower.username", read_only=True
84
- )
85
- following_username = serializers.CharField(
86
- source="following.username", read_only=True
87
- )
88
-
89
- class Meta:
90
- model = Follow
91
- fields = [
92
- "id",
93
- "follower",
94
- "follower_username",
95
- "following",
96
- "following_username",
97
- "created_at",
98
- ]
99
- read_only_fields = ["follower"]
100
-
101
-
102
- class ChangePasswordSerializer(serializers.Serializer):
103
- """Serializer for password change."""
104
-
105
- old_password = serializers.CharField(required=True)
106
- new_password = serializers.CharField(required=True)
107
- new_password_confirm = serializers.CharField(required=True)
108
-
109
- def validate(self, data):
110
- """Validate new passwords match."""
111
- if data["new_password"] != data["new_password_confirm"]:
112
- raise serializers.ValidationError("New passwords don't match")
113
- return data
@@ -1,13 +0,0 @@
1
- """Users application URL configuration."""
2
-
3
- from django.urls import path, include
4
- from rest_framework.routers import DefaultRouter
5
- from .views import UserViewSet, UserProfileViewSet
6
-
7
- router = DefaultRouter()
8
- router.register(r"users", UserViewSet)
9
- router.register(r"profiles", UserProfileViewSet)
10
-
11
- urlpatterns = [
12
- path("", include(router.urls)),
13
- ]