ai-first-cli 1.3.0 → 1.3.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/.ai-dev/index.db +0 -0
- package/.github/workflows/publish.yml +4 -1
- package/BETA_EVALUATION_REPORT.md +151 -0
- package/CHANGELOG.md +178 -0
- package/PHASE1_USER_SIMULATION.md +56 -0
- package/PHASE2_USER_SIMULATION.md +81 -0
- package/PHASE3_USER_SIMULATION.md +176 -0
- package/README.es.md +18 -0
- package/README.md +80 -1
- package/ai/graph/knowledge-graph.json +10 -0
- package/ai-context/ai_context.md +130 -0
- package/{test-projects/react-app/.ai-dev → ai-context}/ai_rules.md +10 -5
- package/ai-context/architecture.md +136 -0
- package/ai-context/context/features/src.json +69 -0
- package/ai-context/context/features/test-projects.json +69 -0
- package/ai-context/context/flows/App.json +17 -0
- package/ai-context/context/flows/DashboardPage.json +14 -0
- package/ai-context/context/flows/LoginPage.json +14 -0
- package/ai-context/context/flows/admin.json +10 -0
- package/ai-context/context/flows/ai-first.json +9 -0
- package/ai-context/context/flows/androidresources.json +11 -0
- package/ai-context/context/flows/auth.json +13 -0
- package/ai-context/context/flows/authController.json +14 -0
- package/ai-context/context/flows/doctor.json +9 -0
- package/ai-context/context/flows/entrypoints.json +9 -0
- package/ai-context/context/flows/explore.json +9 -0
- package/ai-context/context/flows/fastapiAdapter.json +14 -0
- package/ai-context/context/flows/fastapiadapter.json +11 -0
- package/ai-context/context/flows/index.json +19 -0
- package/ai-context/context/flows/indexer.json +9 -0
- package/ai-context/context/flows/indexstate.json +9 -0
- package/ai-context/context/flows/init.json +22 -0
- package/ai-context/context/flows/main.json +18 -0
- package/ai-context/context/flows/mainactivity.json +9 -0
- package/ai-context/context/flows/models.json +15 -0
- package/ai-context/context/flows/posts.json +15 -0
- package/ai-context/context/flows/repoMapper.json +20 -0
- package/ai-context/context/flows/repomapper.json +11 -0
- package/ai-context/context/flows/routes.json +15 -0
- package/ai-context/context/flows/serializers.json +10 -0
- package/ai-context/context/flows/user.json +23 -0
- package/ai-context/context/flows/views.json +12 -0
- package/{test-projects/react-app/.ai-dev → ai-context}/conventions.md +3 -2
- package/ai-context/dependencies.json +3360 -0
- package/ai-context/entrypoints.md +45 -0
- package/ai-context/index-state.json +196 -0
- package/ai-context/modules.json +901 -0
- package/ai-context/project.json +33 -0
- package/ai-context/repo_map.json +8857 -0
- package/ai-context/repo_map.md +2002 -0
- package/{test-projects/flask-app/.ai-dev → ai-context}/schema.json +1 -1
- package/ai-context/summary.md +46 -0
- package/ai-context/symbols.json +82467 -0
- package/{test-projects/react-app/.ai-dev → ai-context}/tech_stack.md +15 -7
- package/ai-context-evaluation-report-1774223059505.md +206 -0
- package/dist/analyzers/architecture.d.ts.map +1 -1
- package/dist/analyzers/architecture.js +6 -0
- package/dist/analyzers/architecture.js.map +1 -1
- package/dist/analyzers/entrypoints.d.ts.map +1 -1
- package/dist/analyzers/entrypoints.js +105 -0
- package/dist/analyzers/entrypoints.js.map +1 -1
- package/dist/analyzers/symbols.d.ts.map +1 -1
- package/dist/analyzers/symbols.js +72 -1
- package/dist/analyzers/symbols.js.map +1 -1
- package/dist/analyzers/techStack.d.ts +8 -0
- package/dist/analyzers/techStack.d.ts.map +1 -1
- package/dist/analyzers/techStack.js +75 -0
- package/dist/analyzers/techStack.js.map +1 -1
- package/dist/scripts/ai-context-evaluator.js +367 -0
- package/package.json +1 -1
- package/quick-evaluation-report-1774396002305.md +64 -0
- package/quick-evaluator.ts +200 -0
- package/scripts/ai-context-evaluator.ts +440 -0
- package/src/analyzers/architecture.ts +8 -0
- package/src/analyzers/entrypoints.ts +115 -0
- package/src/analyzers/symbols.ts +77 -1
- package/src/analyzers/techStack.ts +93 -0
- package/test_adapters.mjs +11 -11
- package/tests/apex-parser.test.ts +193 -0
- package/tests/cli-commands-batch1.test.ts +808 -0
- package/tests/cli-commands-batch2.test.ts +1113 -0
- package/tests/cli-commands-batch3.test.ts +1128 -0
- package/tests/cli-index.test.ts +1007 -0
- package/tests/cli-init.test.ts +761 -0
- package/tests/salesforce-apex-classes.test.ts +713 -0
- package/tests/salesforce-apex-triggers.test.ts +871 -0
- package/tests/salesforce-custom-objects.test.ts +918 -0
- package/tests/salesforce-flows.test.ts +710 -0
- package/tests/salesforce-lwc.test.ts +963 -0
- package/tests/salesforce-sfdx-integration.test.ts +1125 -0
- package/CONTRIBUTING.md +0 -89
- package/FLOW.md +0 -129
- package/install.sh +0 -188
- package/run-all-tests.sh +0 -184
- package/test-projects/django-app/.ai-dev/ai_context.md +0 -92
- package/test-projects/django-app/.ai-dev/ai_rules.md +0 -47
- package/test-projects/django-app/.ai-dev/architecture.md +0 -57
- package/test-projects/django-app/.ai-dev/cache.json +0 -169
- package/test-projects/django-app/.ai-dev/context/flows/views.json +0 -10
- package/test-projects/django-app/.ai-dev/conventions.md +0 -51
- package/test-projects/django-app/.ai-dev/dependencies.json +0 -312
- package/test-projects/django-app/.ai-dev/entrypoints.md +0 -4
- package/test-projects/django-app/.ai-dev/files.json +0 -209
- package/test-projects/django-app/.ai-dev/graph/knowledge-graph.json +0 -36
- package/test-projects/django-app/.ai-dev/graph/module-graph.json +0 -145
- package/test-projects/django-app/.ai-dev/graph/symbol-graph.json +0 -1488
- package/test-projects/django-app/.ai-dev/graph/symbol-references.json +0 -1
- package/test-projects/django-app/.ai-dev/index-state.json +0 -294
- package/test-projects/django-app/.ai-dev/modules.json +0 -35
- package/test-projects/django-app/.ai-dev/project.json +0 -11
- package/test-projects/django-app/.ai-dev/repo_map.json +0 -412
- package/test-projects/django-app/.ai-dev/repo_map.md +0 -105
- package/test-projects/django-app/.ai-dev/schema.json +0 -5
- package/test-projects/django-app/.ai-dev/summary.md +0 -15
- package/test-projects/django-app/.ai-dev/symbols.json +0 -1
- package/test-projects/django-app/.ai-dev/tech_stack.md +0 -32
- package/test-projects/django-app/README.md +0 -91
- package/test-projects/django-app/blog/__init__.py +0 -0
- package/test-projects/django-app/blog/admin.py +0 -31
- package/test-projects/django-app/blog/models.py +0 -55
- package/test-projects/django-app/blog/serializers.py +0 -69
- package/test-projects/django-app/blog/urls.py +0 -14
- package/test-projects/django-app/blog/views.py +0 -96
- package/test-projects/django-app/django_app/__init__.py +0 -0
- package/test-projects/django-app/django_app/settings.py +0 -90
- package/test-projects/django-app/django_app/urls.py +0 -11
- package/test-projects/django-app/django_app/wsgi.py +0 -9
- package/test-projects/django-app/manage.py +0 -23
- package/test-projects/django-app/requirements.txt +0 -3
- package/test-projects/django-app/users/__init__.py +0 -0
- package/test-projects/django-app/users/admin.py +0 -42
- package/test-projects/django-app/users/models.py +0 -54
- package/test-projects/django-app/users/serializers.py +0 -113
- package/test-projects/django-app/users/urls.py +0 -13
- package/test-projects/django-app/users/views.py +0 -135
- package/test-projects/express-api/.ai-dev/ai_context.md +0 -112
- package/test-projects/express-api/.ai-dev/ai_rules.md +0 -50
- package/test-projects/express-api/.ai-dev/architecture.md +0 -62
- package/test-projects/express-api/.ai-dev/context/features/controllers.json +0 -13
- package/test-projects/express-api/.ai-dev/context/features/services.json +0 -13
- package/test-projects/express-api/.ai-dev/context/flows/auth.json +0 -12
- package/test-projects/express-api/.ai-dev/context/flows/user.json +0 -13
- package/test-projects/express-api/.ai-dev/conventions.md +0 -51
- package/test-projects/express-api/.ai-dev/dependencies.json +0 -54
- package/test-projects/express-api/.ai-dev/entrypoints.md +0 -17
- package/test-projects/express-api/.ai-dev/modules.json +0 -30
- package/test-projects/express-api/.ai-dev/project.json +0 -15
- package/test-projects/express-api/.ai-dev/repo_map.json +0 -100
- package/test-projects/express-api/.ai-dev/repo_map.md +0 -36
- package/test-projects/express-api/.ai-dev/schema.json +0 -5
- package/test-projects/express-api/.ai-dev/summary.md +0 -14
- package/test-projects/express-api/.ai-dev/symbols.json +0 -7
- package/test-projects/express-api/.ai-dev/tech_stack.md +0 -38
- package/test-projects/express-api/.ai-dev/tools.json +0 -10
- package/test-projects/express-api/controllers/authController.js +0 -32
- package/test-projects/express-api/controllers/userController.js +0 -51
- package/test-projects/express-api/index.js +0 -30
- package/test-projects/express-api/middleware/authMiddleware.js +0 -30
- package/test-projects/express-api/models/userRepository.js +0 -25
- package/test-projects/express-api/package.json +0 -18
- package/test-projects/express-api/services/authService.js +0 -17
- package/test-projects/express-api/services/userService.js +0 -28
- package/test-projects/fastapi-app/.ai-dev/ai_context.md +0 -89
- package/test-projects/fastapi-app/.ai-dev/ai_rules.md +0 -47
- package/test-projects/fastapi-app/.ai-dev/architecture.md +0 -39
- package/test-projects/fastapi-app/.ai-dev/cache.json +0 -125
- package/test-projects/fastapi-app/.ai-dev/conventions.md +0 -51
- package/test-projects/fastapi-app/.ai-dev/dependencies.json +0 -244
- package/test-projects/fastapi-app/.ai-dev/entrypoints.md +0 -4
- package/test-projects/fastapi-app/.ai-dev/files.json +0 -154
- package/test-projects/fastapi-app/.ai-dev/graph/knowledge-graph.json +0 -15
- package/test-projects/fastapi-app/.ai-dev/graph/module-graph.json +0 -78
- package/test-projects/fastapi-app/.ai-dev/graph/symbol-graph.json +0 -1724
- package/test-projects/fastapi-app/.ai-dev/graph/symbol-references.json +0 -51
- package/test-projects/fastapi-app/.ai-dev/index-state.json +0 -217
- package/test-projects/fastapi-app/.ai-dev/modules.json +0 -16
- package/test-projects/fastapi-app/.ai-dev/project.json +0 -9
- package/test-projects/fastapi-app/.ai-dev/repo_map.json +0 -298
- package/test-projects/fastapi-app/.ai-dev/repo_map.md +0 -74
- package/test-projects/fastapi-app/.ai-dev/schema.json +0 -5
- package/test-projects/fastapi-app/.ai-dev/summary.md +0 -12
- package/test-projects/fastapi-app/.ai-dev/symbols.json +0 -1
- package/test-projects/fastapi-app/.ai-dev/tech_stack.md +0 -32
- package/test-projects/fastapi-app/.ai-dev/tools.json +0 -10
- package/test-projects/fastapi-app/README.md +0 -118
- package/test-projects/fastapi-app/app/database.py +0 -21
- package/test-projects/fastapi-app/app/dependencies.py +0 -107
- package/test-projects/fastapi-app/app/main.py +0 -47
- package/test-projects/fastapi-app/app/models.py +0 -149
- package/test-projects/fastapi-app/app/routers/auth.py +0 -117
- package/test-projects/fastapi-app/app/routers/posts.py +0 -272
- package/test-projects/fastapi-app/app/schemas.py +0 -191
- package/test-projects/fastapi-app/requirements.txt +0 -10
- package/test-projects/flask-app/.ai-dev/ai_context.md +0 -94
- package/test-projects/flask-app/.ai-dev/ai_rules.md +0 -47
- package/test-projects/flask-app/.ai-dev/architecture.md +0 -49
- package/test-projects/flask-app/.ai-dev/cache.json +0 -157
- package/test-projects/flask-app/.ai-dev/context/features/app.json +0 -25
- package/test-projects/flask-app/.ai-dev/context/flows/routes.json +0 -14
- package/test-projects/flask-app/.ai-dev/conventions.md +0 -51
- package/test-projects/flask-app/.ai-dev/dependencies.json +0 -298
- package/test-projects/flask-app/.ai-dev/entrypoints.md +0 -4
- package/test-projects/flask-app/.ai-dev/files.json +0 -194
- package/test-projects/flask-app/.ai-dev/graph/knowledge-graph.json +0 -60
- package/test-projects/flask-app/.ai-dev/graph/module-graph.json +0 -95
- package/test-projects/flask-app/.ai-dev/graph/symbol-graph.json +0 -1448
- package/test-projects/flask-app/.ai-dev/graph/symbol-references.json +0 -45
- package/test-projects/flask-app/.ai-dev/index-state.json +0 -273
- package/test-projects/flask-app/.ai-dev/modules.json +0 -21
- package/test-projects/flask-app/.ai-dev/project.json +0 -13
- package/test-projects/flask-app/.ai-dev/repo_map.json +0 -400
- package/test-projects/flask-app/.ai-dev/repo_map.md +0 -98
- package/test-projects/flask-app/.ai-dev/summary.md +0 -13
- package/test-projects/flask-app/.ai-dev/symbols.json +0 -1
- package/test-projects/flask-app/.ai-dev/tech_stack.md +0 -32
- package/test-projects/flask-app/.ai-dev/tools.json +0 -10
- package/test-projects/flask-app/README.md +0 -129
- package/test-projects/flask-app/app/__init__.py +0 -46
- package/test-projects/flask-app/app/api/__init__.py +0 -7
- package/test-projects/flask-app/app/api/routes.py +0 -122
- package/test-projects/flask-app/app/auth/__init__.py +0 -7
- package/test-projects/flask-app/app/auth/forms.py +0 -52
- package/test-projects/flask-app/app/auth/routes.py +0 -68
- package/test-projects/flask-app/app/blog/__init__.py +0 -7
- package/test-projects/flask-app/app/blog/forms.py +0 -35
- package/test-projects/flask-app/app/blog/routes.py +0 -140
- package/test-projects/flask-app/app/main/__init__.py +0 -7
- package/test-projects/flask-app/app/main/routes.py +0 -88
- package/test-projects/flask-app/app/models.py +0 -177
- package/test-projects/flask-app/config.py +0 -64
- package/test-projects/flask-app/requirements.txt +0 -10
- package/test-projects/laravel-app/.ai-dev/ai_context.md +0 -97
- package/test-projects/laravel-app/.ai-dev/ai_rules.md +0 -47
- package/test-projects/laravel-app/.ai-dev/architecture.md +0 -60
- package/test-projects/laravel-app/.ai-dev/cache.json +0 -161
- package/test-projects/laravel-app/.ai-dev/context/features/app.json +0 -21
- package/test-projects/laravel-app/.ai-dev/context/flows/.json +0 -9
- package/test-projects/laravel-app/.ai-dev/context/flows/category.json +0 -12
- package/test-projects/laravel-app/.ai-dev/context/flows/comment.json +0 -12
- package/test-projects/laravel-app/.ai-dev/context/flows/post.json +0 -12
- package/test-projects/laravel-app/.ai-dev/context/flows/unnamed.json +0 -9
- package/test-projects/laravel-app/.ai-dev/conventions.md +0 -51
- package/test-projects/laravel-app/.ai-dev/dependencies.json +0 -6
- package/test-projects/laravel-app/.ai-dev/entrypoints.md +0 -4
- package/test-projects/laravel-app/.ai-dev/files.json +0 -199
- package/test-projects/laravel-app/.ai-dev/graph/knowledge-graph.json +0 -98
- package/test-projects/laravel-app/.ai-dev/graph/module-graph.json +0 -30
- package/test-projects/laravel-app/.ai-dev/graph/symbol-graph.json +0 -5
- package/test-projects/laravel-app/.ai-dev/graph/symbol-references.json +0 -1
- package/test-projects/laravel-app/.ai-dev/index-state.json +0 -280
- package/test-projects/laravel-app/.ai-dev/modules.json +0 -29
- package/test-projects/laravel-app/.ai-dev/project.json +0 -17
- package/test-projects/laravel-app/.ai-dev/repo_map.json +0 -419
- package/test-projects/laravel-app/.ai-dev/repo_map.md +0 -106
- package/test-projects/laravel-app/.ai-dev/schema.json +0 -5
- package/test-projects/laravel-app/.ai-dev/summary.md +0 -15
- package/test-projects/laravel-app/.ai-dev/symbols.json +0 -1
- package/test-projects/laravel-app/.ai-dev/tech_stack.md +0 -34
- package/test-projects/laravel-app/.ai-dev/tools.json +0 -10
- package/test-projects/laravel-app/README.md +0 -107
- package/test-projects/laravel-app/app/Http/Controllers/Api/CategoryController.php +0 -88
- package/test-projects/laravel-app/app/Http/Controllers/Api/CommentController.php +0 -56
- package/test-projects/laravel-app/app/Http/Controllers/Api/PostController.php +0 -174
- package/test-projects/laravel-app/app/Http/Controllers/Controller.php +0 -12
- package/test-projects/laravel-app/app/Models/Category.php +0 -34
- package/test-projects/laravel-app/app/Models/Comment.php +0 -51
- package/test-projects/laravel-app/app/Models/Post.php +0 -108
- package/test-projects/laravel-app/app/Models/User.php +0 -85
- package/test-projects/laravel-app/bootstrap/app.php +0 -25
- package/test-projects/laravel-app/composer.json +0 -35
- package/test-projects/laravel-app/routes/api.php +0 -40
- package/test-projects/nestjs-backend/.ai-dev/ai_context.md +0 -111
- package/test-projects/nestjs-backend/.ai-dev/ai_rules.md +0 -52
- package/test-projects/nestjs-backend/.ai-dev/architecture.md +0 -49
- package/test-projects/nestjs-backend/.ai-dev/cache.json +0 -169
- package/test-projects/nestjs-backend/.ai-dev/context/features/src.json +0 -23
- package/test-projects/nestjs-backend/.ai-dev/context/flows/auth.controller.json +0 -14
- package/test-projects/nestjs-backend/.ai-dev/context/flows/auth.json +0 -10
- package/test-projects/nestjs-backend/.ai-dev/context/flows/users..json +0 -10
- package/test-projects/nestjs-backend/.ai-dev/context/flows/users.controller.json +0 -14
- package/test-projects/nestjs-backend/.ai-dev/context/flows/users.json +0 -10
- package/test-projects/nestjs-backend/.ai-dev/conventions.md +0 -52
- package/test-projects/nestjs-backend/.ai-dev/dependencies.json +0 -152
- package/test-projects/nestjs-backend/.ai-dev/entrypoints.md +0 -18
- package/test-projects/nestjs-backend/.ai-dev/files.json +0 -209
- package/test-projects/nestjs-backend/.ai-dev/graph/knowledge-graph.json +0 -132
- package/test-projects/nestjs-backend/.ai-dev/graph/module-graph.json +0 -29
- package/test-projects/nestjs-backend/.ai-dev/graph/symbol-graph.json +0 -304
- package/test-projects/nestjs-backend/.ai-dev/graph/symbol-references.json +0 -5
- package/test-projects/nestjs-backend/.ai-dev/index-state.json +0 -294
- package/test-projects/nestjs-backend/.ai-dev/modules.json +0 -19
- package/test-projects/nestjs-backend/.ai-dev/project.json +0 -18
- package/test-projects/nestjs-backend/.ai-dev/repo_map.json +0 -427
- package/test-projects/nestjs-backend/.ai-dev/repo_map.md +0 -104
- package/test-projects/nestjs-backend/.ai-dev/schema.json +0 -5
- package/test-projects/nestjs-backend/.ai-dev/summary.md +0 -13
- package/test-projects/nestjs-backend/.ai-dev/symbols.json +0 -1
- package/test-projects/nestjs-backend/.ai-dev/tech_stack.md +0 -38
- package/test-projects/nestjs-backend/.ai-dev/tools.json +0 -10
- package/test-projects/nestjs-backend/package.json +0 -22
- package/test-projects/nestjs-backend/src/app.module.ts +0 -8
- package/test-projects/nestjs-backend/src/auth/auth.controller.ts +0 -22
- package/test-projects/nestjs-backend/src/auth/auth.module.ts +0 -11
- package/test-projects/nestjs-backend/src/auth/auth.service.ts +0 -28
- package/test-projects/nestjs-backend/src/auth/dto/login.dto.ts +0 -4
- package/test-projects/nestjs-backend/src/auth/strategies/jwt.strategy.ts +0 -18
- package/test-projects/nestjs-backend/src/main.ts +0 -9
- package/test-projects/nestjs-backend/src/users/users.controller.ts +0 -32
- package/test-projects/nestjs-backend/src/users/users.module.ts +0 -10
- package/test-projects/nestjs-backend/src/users/users.service.ts +0 -42
- package/test-projects/nestjs-backend/tsconfig.json +0 -21
- package/test-projects/python-cli/.ai-dev/ai_context.md +0 -95
- package/test-projects/python-cli/.ai-dev/ai_rules.md +0 -47
- package/test-projects/python-cli/.ai-dev/architecture.md +0 -55
- package/test-projects/python-cli/.ai-dev/cache.json +0 -149
- package/test-projects/python-cli/.ai-dev/context/features/cli.json +0 -16
- package/test-projects/python-cli/.ai-dev/context/flows/list_.json +0 -9
- package/test-projects/python-cli/.ai-dev/context/flows/remove_.json +0 -9
- package/test-projects/python-cli/.ai-dev/conventions.md +0 -51
- package/test-projects/python-cli/.ai-dev/dependencies.json +0 -66
- package/test-projects/python-cli/.ai-dev/entrypoints.md +0 -4
- package/test-projects/python-cli/.ai-dev/files.json +0 -184
- package/test-projects/python-cli/.ai-dev/graph/knowledge-graph.json +0 -83
- package/test-projects/python-cli/.ai-dev/graph/module-graph.json +0 -31
- package/test-projects/python-cli/.ai-dev/graph/symbol-graph.json +0 -358
- package/test-projects/python-cli/.ai-dev/graph/symbol-references.json +0 -11
- package/test-projects/python-cli/.ai-dev/index-state.json +0 -259
- package/test-projects/python-cli/.ai-dev/modules.json +0 -21
- package/test-projects/python-cli/.ai-dev/project.json +0 -15
- package/test-projects/python-cli/.ai-dev/repo_map.json +0 -367
- package/test-projects/python-cli/.ai-dev/repo_map.md +0 -93
- package/test-projects/python-cli/.ai-dev/schema.json +0 -5
- package/test-projects/python-cli/.ai-dev/summary.md +0 -14
- package/test-projects/python-cli/.ai-dev/symbols.json +0 -1
- package/test-projects/python-cli/.ai-dev/tech_stack.md +0 -32
- package/test-projects/python-cli/.ai-dev/tools.json +0 -10
- package/test-projects/python-cli/__init__.py +0 -1
- package/test-projects/python-cli/cli/__init__.py +0 -1
- package/test-projects/python-cli/cli/add_command.py +0 -6
- package/test-projects/python-cli/cli/list_command.py +0 -7
- package/test-projects/python-cli/cli/remove_command.py +0 -6
- package/test-projects/python-cli/main.py +0 -34
- package/test-projects/python-cli/models/__init__.py +0 -2
- package/test-projects/python-cli/models/task.py +0 -19
- package/test-projects/python-cli/models/task_repository.py +0 -44
- package/test-projects/rails-app/.ai-dev/ai_context.md +0 -94
- package/test-projects/rails-app/.ai-dev/ai_rules.md +0 -47
- package/test-projects/rails-app/.ai-dev/architecture.md +0 -49
- package/test-projects/rails-app/.ai-dev/cache.json +0 -193
- package/test-projects/rails-app/.ai-dev/context/features/app.json +0 -24
- package/test-projects/rails-app/.ai-dev/context/features/config.json +0 -13
- package/test-projects/rails-app/.ai-dev/context/flows/application.json +0 -9
- package/test-projects/rails-app/.ai-dev/context/flows/application_.json +0 -9
- package/test-projects/rails-app/.ai-dev/context/flows/comments.json +0 -11
- package/test-projects/rails-app/.ai-dev/context/flows/comments_.json +0 -11
- package/test-projects/rails-app/.ai-dev/context/flows/posts.json +0 -11
- package/test-projects/rails-app/.ai-dev/context/flows/posts_.json +0 -11
- package/test-projects/rails-app/.ai-dev/context/flows/routes.json +0 -9
- package/test-projects/rails-app/.ai-dev/context/flows/users.json +0 -11
- package/test-projects/rails-app/.ai-dev/context/flows/users_.json +0 -11
- package/test-projects/rails-app/.ai-dev/conventions.md +0 -51
- package/test-projects/rails-app/.ai-dev/dependencies.json +0 -6
- package/test-projects/rails-app/.ai-dev/entrypoints.md +0 -4
- package/test-projects/rails-app/.ai-dev/files.json +0 -239
- package/test-projects/rails-app/.ai-dev/graph/knowledge-graph.json +0 -130
- package/test-projects/rails-app/.ai-dev/graph/module-graph.json +0 -27
- package/test-projects/rails-app/.ai-dev/graph/symbol-graph.json +0 -5
- package/test-projects/rails-app/.ai-dev/graph/symbol-references.json +0 -1
- package/test-projects/rails-app/.ai-dev/index-state.json +0 -336
- package/test-projects/rails-app/.ai-dev/modules.json +0 -26
- package/test-projects/rails-app/.ai-dev/project.json +0 -22
- package/test-projects/rails-app/.ai-dev/repo_map.json +0 -486
- package/test-projects/rails-app/.ai-dev/repo_map.md +0 -117
- package/test-projects/rails-app/.ai-dev/schema.json +0 -5
- package/test-projects/rails-app/.ai-dev/summary.md +0 -13
- package/test-projects/rails-app/.ai-dev/symbols.json +0 -1
- package/test-projects/rails-app/.ai-dev/tech_stack.md +0 -32
- package/test-projects/rails-app/.ai-dev/tools.json +0 -10
- package/test-projects/rails-app/Gemfile +0 -38
- package/test-projects/rails-app/README.md +0 -140
- package/test-projects/rails-app/Rakefile +0 -8
- package/test-projects/rails-app/app/controllers/api/comments_controller.rb +0 -75
- package/test-projects/rails-app/app/controllers/api/posts_controller.rb +0 -68
- package/test-projects/rails-app/app/controllers/api/users_controller.rb +0 -54
- package/test-projects/rails-app/app/controllers/application_controller.rb +0 -31
- package/test-projects/rails-app/app/models/comment.rb +0 -34
- package/test-projects/rails-app/app/models/post.rb +0 -36
- package/test-projects/rails-app/app/models/user.rb +0 -28
- package/test-projects/rails-app/app/services/post_service.rb +0 -92
- package/test-projects/rails-app/app/services/user_service.rb +0 -76
- package/test-projects/rails-app/config/application.rb +0 -27
- package/test-projects/rails-app/config/environment.rb +0 -7
- package/test-projects/rails-app/config/routes.rb +0 -15
- package/test-projects/react-app/.ai-dev/ai_context.md +0 -96
- package/test-projects/react-app/.ai-dev/architecture.md +0 -39
- package/test-projects/react-app/.ai-dev/cache.json +0 -153
- package/test-projects/react-app/.ai-dev/context/features/src.json +0 -18
- package/test-projects/react-app/.ai-dev/context/flows/UsersPage.json +0 -14
- package/test-projects/react-app/.ai-dev/context/flows/dashboard.json +0 -9
- package/test-projects/react-app/.ai-dev/context/flows/login.json +0 -9
- package/test-projects/react-app/.ai-dev/context/flows/users.json +0 -9
- package/test-projects/react-app/.ai-dev/dependencies.json +0 -128
- package/test-projects/react-app/.ai-dev/entrypoints.md +0 -4
- package/test-projects/react-app/.ai-dev/files.json +0 -189
- package/test-projects/react-app/.ai-dev/graph/knowledge-graph.json +0 -112
- package/test-projects/react-app/.ai-dev/graph/module-graph.json +0 -31
- package/test-projects/react-app/.ai-dev/graph/symbol-graph.json +0 -868
- package/test-projects/react-app/.ai-dev/graph/symbol-references.json +0 -31
- package/test-projects/react-app/.ai-dev/index-state.json +0 -266
- package/test-projects/react-app/.ai-dev/modules.json +0 -17
- package/test-projects/react-app/.ai-dev/project.json +0 -16
- package/test-projects/react-app/.ai-dev/repo_map.json +0 -391
- package/test-projects/react-app/.ai-dev/repo_map.md +0 -94
- package/test-projects/react-app/.ai-dev/schema.json +0 -5
- package/test-projects/react-app/.ai-dev/summary.md +0 -13
- package/test-projects/react-app/.ai-dev/symbols.json +0 -1
- package/test-projects/react-app/.ai-dev/tools.json +0 -10
- package/test-projects/react-app/package.json +0 -16
- package/test-projects/react-app/src/App.tsx +0 -21
- package/test-projects/react-app/src/context/AuthContext.tsx +0 -41
- package/test-projects/react-app/src/hooks/useAuth.ts +0 -10
- package/test-projects/react-app/src/main.tsx +0 -10
- package/test-projects/react-app/src/pages/DashboardPage.tsx +0 -17
- package/test-projects/react-app/src/pages/LoginPage.tsx +0 -41
- package/test-projects/react-app/src/pages/UsersPage.tsx +0 -36
- package/test-projects/react-app/src/services/userService.ts +0 -37
- package/test-projects/salesforce-cli/.ai-dev/ai_context.md +0 -89
- package/test-projects/salesforce-cli/.ai-dev/ai_rules.md +0 -47
- package/test-projects/salesforce-cli/.ai-dev/architecture.md +0 -39
- package/test-projects/salesforce-cli/.ai-dev/cache.json +0 -125
- package/test-projects/salesforce-cli/.ai-dev/context/features/force-app.json +0 -14
- package/test-projects/salesforce-cli/.ai-dev/context/flows/account.json +0 -9
- package/test-projects/salesforce-cli/.ai-dev/context/flows/opportunity.json +0 -9
- package/test-projects/salesforce-cli/.ai-dev/conventions.md +0 -51
- package/test-projects/salesforce-cli/.ai-dev/dependencies.json +0 -6
- package/test-projects/salesforce-cli/.ai-dev/entrypoints.md +0 -4
- package/test-projects/salesforce-cli/.ai-dev/files.json +0 -154
- package/test-projects/salesforce-cli/.ai-dev/graph/knowledge-graph.json +0 -64
- package/test-projects/salesforce-cli/.ai-dev/graph/module-graph.json +0 -13
- package/test-projects/salesforce-cli/.ai-dev/graph/symbol-graph.json +0 -148
- package/test-projects/salesforce-cli/.ai-dev/graph/symbol-references.json +0 -1
- package/test-projects/salesforce-cli/.ai-dev/index-state.json +0 -217
- package/test-projects/salesforce-cli/.ai-dev/modules.json +0 -12
- package/test-projects/salesforce-cli/.ai-dev/project.json +0 -14
- package/test-projects/salesforce-cli/.ai-dev/repo_map.json +0 -328
- package/test-projects/salesforce-cli/.ai-dev/repo_map.md +0 -80
- package/test-projects/salesforce-cli/.ai-dev/schema.json +0 -5
- package/test-projects/salesforce-cli/.ai-dev/summary.md +0 -13
- package/test-projects/salesforce-cli/.ai-dev/symbols.json +0 -1
- package/test-projects/salesforce-cli/.ai-dev/tech_stack.md +0 -31
- package/test-projects/salesforce-cli/.ai-dev/tools.json +0 -10
- package/test-projects/salesforce-cli/.forceignore +0 -27
- package/test-projects/salesforce-cli/force-app/main/default/classes/AccountController.cls +0 -24
- package/test-projects/salesforce-cli/force-app/main/default/classes/OpportunityController.cls +0 -25
- package/test-projects/salesforce-cli/force-app/main/default/objects/Project__c.object.xml +0 -45
- package/test-projects/salesforce-cli/force-app/main/default/triggers/AccountTrigger.trigger +0 -33
- package/test-projects/salesforce-cli/sfdx-project.json +0 -11
- package/test-projects/spring-boot-app/.ai-dev/ai_context.md +0 -91
- package/test-projects/spring-boot-app/.ai-dev/ai_rules.md +0 -48
- package/test-projects/spring-boot-app/.ai-dev/architecture.md +0 -39
- package/test-projects/spring-boot-app/.ai-dev/cache.json +0 -173
- package/test-projects/spring-boot-app/.ai-dev/context/features/src.json +0 -26
- package/test-projects/spring-boot-app/.ai-dev/context/flows/PostController.json +0 -19
- package/test-projects/spring-boot-app/.ai-dev/context/flows/UserController.json +0 -19
- package/test-projects/spring-boot-app/.ai-dev/context/flows/comment.json +0 -11
- package/test-projects/spring-boot-app/.ai-dev/context/flows/post.json +0 -14
- package/test-projects/spring-boot-app/.ai-dev/context/flows/user.json +0 -14
- package/test-projects/spring-boot-app/.ai-dev/conventions.md +0 -52
- package/test-projects/spring-boot-app/.ai-dev/dependencies.json +0 -326
- package/test-projects/spring-boot-app/.ai-dev/entrypoints.md +0 -4
- package/test-projects/spring-boot-app/.ai-dev/files.json +0 -214
- package/test-projects/spring-boot-app/.ai-dev/graph/knowledge-graph.json +0 -231
- package/test-projects/spring-boot-app/.ai-dev/graph/module-graph.json +0 -22
- package/test-projects/spring-boot-app/.ai-dev/graph/symbol-graph.json +0 -794
- package/test-projects/spring-boot-app/.ai-dev/graph/symbol-references.json +0 -70
- package/test-projects/spring-boot-app/.ai-dev/index-state.json +0 -301
- package/test-projects/spring-boot-app/.ai-dev/modules.json +0 -21
- package/test-projects/spring-boot-app/.ai-dev/project.json +0 -17
- package/test-projects/spring-boot-app/.ai-dev/repo_map.json +0 -461
- package/test-projects/spring-boot-app/.ai-dev/repo_map.md +0 -109
- package/test-projects/spring-boot-app/.ai-dev/schema.json +0 -5
- package/test-projects/spring-boot-app/.ai-dev/summary.md +0 -12
- package/test-projects/spring-boot-app/.ai-dev/symbols.json +0 -1
- package/test-projects/spring-boot-app/.ai-dev/tech_stack.md +0 -32
- package/test-projects/spring-boot-app/.ai-dev/tools.json +0 -10
- package/test-projects/spring-boot-app/.classpath +0 -57
- package/test-projects/spring-boot-app/.factorypath +0 -69
- package/test-projects/spring-boot-app/.project +0 -34
- package/test-projects/spring-boot-app/.settings/org.eclipse.core.resources.prefs +0 -4
- package/test-projects/spring-boot-app/.settings/org.eclipse.jdt.apt.core.prefs +0 -4
- package/test-projects/spring-boot-app/.settings/org.eclipse.jdt.core.prefs +0 -10
- package/test-projects/spring-boot-app/.settings/org.eclipse.m2e.core.prefs +0 -4
- package/test-projects/spring-boot-app/README.md +0 -122
- package/test-projects/spring-boot-app/pom.xml +0 -79
- package/test-projects/spring-boot-app/src/main/java/com/example/demo/DemoApplication.java +0 -12
- package/test-projects/spring-boot-app/src/main/java/com/example/demo/controllers/CommentController.java +0 -89
- package/test-projects/spring-boot-app/src/main/java/com/example/demo/controllers/PostController.java +0 -92
- package/test-projects/spring-boot-app/src/main/java/com/example/demo/controllers/UserController.java +0 -84
- package/test-projects/spring-boot-app/src/main/java/com/example/demo/models/Comment.java +0 -38
- package/test-projects/spring-boot-app/src/main/java/com/example/demo/models/Post.java +0 -56
- package/test-projects/spring-boot-app/src/main/java/com/example/demo/models/User.java +0 -44
- package/test-projects/spring-boot-app/src/main/java/com/example/demo/repositories/CommentRepository.java +0 -21
- package/test-projects/spring-boot-app/src/main/java/com/example/demo/repositories/PostRepository.java +0 -18
- package/test-projects/spring-boot-app/src/main/java/com/example/demo/repositories/UserRepository.java +0 -15
- package/test-projects/spring-boot-app/src/main/java/com/example/demo/services/PostService.java +0 -83
- package/test-projects/spring-boot-app/src/main/java/com/example/demo/services/UserService.java +0 -62
- package/test-projects/spring-boot-app/src/main/resources/application.properties +0 -22
- package/test-projects/spring-boot-app/target/classes/com/example/demo/DemoApplication.class +0 -0
- package/test-projects/spring-boot-app/target/classes/com/example/demo/controllers/CommentController$CommentCreateRequest.class +0 -0
- package/test-projects/spring-boot-app/target/classes/com/example/demo/controllers/CommentController$CommentUpdateRequest.class +0 -0
- package/test-projects/spring-boot-app/target/classes/com/example/demo/controllers/CommentController.class +0 -0
- package/test-projects/spring-boot-app/target/classes/com/example/demo/controllers/PostController$PostCreateRequest.class +0 -0
- package/test-projects/spring-boot-app/target/classes/com/example/demo/controllers/PostController$PostUpdateRequest.class +0 -0
- package/test-projects/spring-boot-app/target/classes/com/example/demo/controllers/PostController.class +0 -0
- package/test-projects/spring-boot-app/target/classes/com/example/demo/controllers/UserController$UserCreateRequest.class +0 -0
- package/test-projects/spring-boot-app/target/classes/com/example/demo/controllers/UserController$UserUpdateRequest.class +0 -0
- package/test-projects/spring-boot-app/target/classes/com/example/demo/controllers/UserController.class +0 -0
- package/test-projects/spring-boot-app/target/classes/com/example/demo/models/Comment.class +0 -0
- package/test-projects/spring-boot-app/target/classes/com/example/demo/models/Post.class +0 -0
- package/test-projects/spring-boot-app/target/classes/com/example/demo/models/User.class +0 -0
- package/test-projects/spring-boot-app/target/classes/com/example/demo/repositories/CommentRepository.class +0 -0
- package/test-projects/spring-boot-app/target/classes/com/example/demo/repositories/PostRepository.class +0 -0
- package/test-projects/spring-boot-app/target/classes/com/example/demo/repositories/UserRepository.class +0 -0
- package/test-projects/spring-boot-app/target/classes/com/example/demo/services/PostService.class +0 -0
- package/test-projects/spring-boot-app/target/classes/com/example/demo/services/UserService.class +0 -0
- package/tests/e2e/run-e2e.sh +0 -88
- /package/{test-projects/django-app/.ai-dev → ai-context}/tools.json +0 -0
|
@@ -1,272 +0,0 @@
|
|
|
1
|
-
from typing import List, Optional
|
|
2
|
-
from fastapi import APIRouter, Depends, HTTPException, Query, status
|
|
3
|
-
from sqlalchemy.orm import Session
|
|
4
|
-
from sqlalchemy import func
|
|
5
|
-
from app import models, schemas
|
|
6
|
-
from app.database import get_db
|
|
7
|
-
from app.dependencies import get_current_active_user, get_current_superuser
|
|
8
|
-
|
|
9
|
-
router = APIRouter(prefix="/posts", tags=["posts"])
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def generate_slug(title: str) -> str:
|
|
13
|
-
"""Generate URL slug from title."""
|
|
14
|
-
import re
|
|
15
|
-
|
|
16
|
-
slug = re.sub(r"[^\w\s-]", "", title.lower())
|
|
17
|
-
slug = re.sub(r"[-\s]+", "-", slug)
|
|
18
|
-
return slug.strip("-")
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
@router.get("/", response_model=List[schemas.PostList])
|
|
22
|
-
def list_posts(
|
|
23
|
-
skip: int = 0,
|
|
24
|
-
limit: int = 10,
|
|
25
|
-
category_slug: Optional[str] = None,
|
|
26
|
-
tag_slug: Optional[str] = None,
|
|
27
|
-
search: Optional[str] = None,
|
|
28
|
-
published_only: bool = True,
|
|
29
|
-
db: Session = Depends(get_db),
|
|
30
|
-
):
|
|
31
|
-
"""List all posts with filters."""
|
|
32
|
-
query = db.query(models.Post)
|
|
33
|
-
|
|
34
|
-
# Filter by published status
|
|
35
|
-
if published_only:
|
|
36
|
-
query = query.filter(models.Post.is_published == True)
|
|
37
|
-
|
|
38
|
-
# Filter by category
|
|
39
|
-
if category_slug:
|
|
40
|
-
query = query.join(models.Category).filter(
|
|
41
|
-
models.Category.slug == category_slug
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
# Filter by tag
|
|
45
|
-
if tag_slug:
|
|
46
|
-
query = (
|
|
47
|
-
query.join(models.post_tags)
|
|
48
|
-
.join(models.Tag)
|
|
49
|
-
.filter(models.Tag.slug == tag_slug)
|
|
50
|
-
)
|
|
51
|
-
|
|
52
|
-
# Search
|
|
53
|
-
if search:
|
|
54
|
-
search_filter = f"%{search}%"
|
|
55
|
-
query = query.filter(
|
|
56
|
-
models.Post.title.ilike(search_filter)
|
|
57
|
-
| models.Post.content.ilike(search_filter)
|
|
58
|
-
)
|
|
59
|
-
|
|
60
|
-
posts = (
|
|
61
|
-
query.order_by(models.Post.created_at.desc()).offset(skip).limit(limit).all()
|
|
62
|
-
)
|
|
63
|
-
|
|
64
|
-
# Convert to response format
|
|
65
|
-
result = []
|
|
66
|
-
for post in posts:
|
|
67
|
-
post_dict = {
|
|
68
|
-
"id": post.id,
|
|
69
|
-
"title": post.title,
|
|
70
|
-
"slug": post.slug,
|
|
71
|
-
"summary": post.summary,
|
|
72
|
-
"is_published": post.is_published,
|
|
73
|
-
"published_at": post.published_at,
|
|
74
|
-
"view_count": post.view_count,
|
|
75
|
-
"created_at": post.created_at,
|
|
76
|
-
"author_id": post.author_id,
|
|
77
|
-
"author_username": post.author.username,
|
|
78
|
-
"category_name": post.category.name if post.category else None,
|
|
79
|
-
"tags": [tag.name for tag in post.tags],
|
|
80
|
-
}
|
|
81
|
-
result.append(post_dict)
|
|
82
|
-
|
|
83
|
-
return result
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
@router.post("/", response_model=schemas.Post, status_code=status.HTTP_201_CREATED)
|
|
87
|
-
def create_post(
|
|
88
|
-
post: schemas.PostCreate,
|
|
89
|
-
current_user: models.User = Depends(get_current_active_user),
|
|
90
|
-
db: Session = Depends(get_db),
|
|
91
|
-
):
|
|
92
|
-
"""Create a new post."""
|
|
93
|
-
# Generate slug
|
|
94
|
-
slug = generate_slug(post.title)
|
|
95
|
-
|
|
96
|
-
# Check if slug exists
|
|
97
|
-
existing = db.query(models.Post).filter(models.Post.slug == slug).first()
|
|
98
|
-
if existing:
|
|
99
|
-
import uuid
|
|
100
|
-
|
|
101
|
-
slug = f"{slug}-{uuid.uuid4().hex[:8]}"
|
|
102
|
-
|
|
103
|
-
# Create post
|
|
104
|
-
db_post = models.Post(
|
|
105
|
-
title=post.title,
|
|
106
|
-
slug=slug,
|
|
107
|
-
content=post.content,
|
|
108
|
-
summary=post.summary,
|
|
109
|
-
is_published=post.is_published,
|
|
110
|
-
author_id=current_user.id,
|
|
111
|
-
category_id=post.category_id,
|
|
112
|
-
)
|
|
113
|
-
|
|
114
|
-
# Add tags
|
|
115
|
-
if post.tag_ids:
|
|
116
|
-
tags = db.query(models.Tag).filter(models.Tag.id.in_(post.tag_ids)).all()
|
|
117
|
-
db_post.tags = tags
|
|
118
|
-
|
|
119
|
-
db.add(db_post)
|
|
120
|
-
db.commit()
|
|
121
|
-
db.refresh(db_post)
|
|
122
|
-
|
|
123
|
-
# Publish if requested
|
|
124
|
-
if post.is_published:
|
|
125
|
-
db_post.publish()
|
|
126
|
-
db.commit()
|
|
127
|
-
db.refresh(db_post)
|
|
128
|
-
|
|
129
|
-
return db_post
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
@router.get("/{slug}", response_model=schemas.Post)
|
|
133
|
-
def get_post(slug: str, db: Session = Depends(get_db)):
|
|
134
|
-
"""Get a single post by slug."""
|
|
135
|
-
post = db.query(models.Post).filter(models.Post.slug == slug).first()
|
|
136
|
-
|
|
137
|
-
if not post:
|
|
138
|
-
raise HTTPException(
|
|
139
|
-
status_code=status.HTTP_404_NOT_FOUND, detail="Post not found"
|
|
140
|
-
)
|
|
141
|
-
|
|
142
|
-
# Increment view count
|
|
143
|
-
post.view_count += 1
|
|
144
|
-
db.commit()
|
|
145
|
-
|
|
146
|
-
return post
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
@router.put("/{post_id}", response_model=schemas.Post)
|
|
150
|
-
def update_post(
|
|
151
|
-
post_id: int,
|
|
152
|
-
post_update: schemas.PostUpdate,
|
|
153
|
-
current_user: models.User = Depends(get_current_active_user),
|
|
154
|
-
db: Session = Depends(get_db),
|
|
155
|
-
):
|
|
156
|
-
"""Update a post."""
|
|
157
|
-
db_post = db.query(models.Post).filter(models.Post.id == post_id).first()
|
|
158
|
-
|
|
159
|
-
if not db_post:
|
|
160
|
-
raise HTTPException(
|
|
161
|
-
status_code=status.HTTP_404_NOT_FOUND, detail="Post not found"
|
|
162
|
-
)
|
|
163
|
-
|
|
164
|
-
# Check ownership
|
|
165
|
-
if db_post.author_id != current_user.id and not current_user.is_superuser:
|
|
166
|
-
raise HTTPException(
|
|
167
|
-
status_code=status.HTTP_403_FORBIDDEN,
|
|
168
|
-
detail="Not authorized to update this post",
|
|
169
|
-
)
|
|
170
|
-
|
|
171
|
-
# Update fields
|
|
172
|
-
update_data = post_update.model_dump(exclude_unset=True)
|
|
173
|
-
|
|
174
|
-
# Handle tags separately
|
|
175
|
-
tag_ids = update_data.pop("tag_ids", None)
|
|
176
|
-
if tag_ids is not None:
|
|
177
|
-
tags = db.query(models.Tag).filter(models.Tag.id.in_(tag_ids)).all()
|
|
178
|
-
db_post.tags = tags
|
|
179
|
-
|
|
180
|
-
# Update other fields
|
|
181
|
-
for field, value in update_data.items():
|
|
182
|
-
if field == "is_published":
|
|
183
|
-
if value and not db_post.is_published:
|
|
184
|
-
db_post.publish()
|
|
185
|
-
elif not value and db_post.is_published:
|
|
186
|
-
db_post.unpublish()
|
|
187
|
-
else:
|
|
188
|
-
setattr(db_post, field, value)
|
|
189
|
-
|
|
190
|
-
# Regenerate slug if title changed
|
|
191
|
-
if "title" in update_data:
|
|
192
|
-
db_post.slug = generate_slug(db_post.title)
|
|
193
|
-
|
|
194
|
-
db.commit()
|
|
195
|
-
db.refresh(db_post)
|
|
196
|
-
|
|
197
|
-
return db_post
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
@router.delete("/{post_id}")
|
|
201
|
-
def delete_post(
|
|
202
|
-
post_id: int,
|
|
203
|
-
current_user: models.User = Depends(get_current_active_user),
|
|
204
|
-
db: Session = Depends(get_db),
|
|
205
|
-
):
|
|
206
|
-
"""Delete a post."""
|
|
207
|
-
db_post = db.query(models.Post).filter(models.Post.id == post_id).first()
|
|
208
|
-
|
|
209
|
-
if not db_post:
|
|
210
|
-
raise HTTPException(
|
|
211
|
-
status_code=status.HTTP_404_NOT_FOUND, detail="Post not found"
|
|
212
|
-
)
|
|
213
|
-
|
|
214
|
-
# Check ownership
|
|
215
|
-
if db_post.author_id != current_user.id and not current_user.is_superuser:
|
|
216
|
-
raise HTTPException(
|
|
217
|
-
status_code=status.HTTP_403_FORBIDDEN,
|
|
218
|
-
detail="Not authorized to delete this post",
|
|
219
|
-
)
|
|
220
|
-
|
|
221
|
-
db.delete(db_post)
|
|
222
|
-
db.commit()
|
|
223
|
-
|
|
224
|
-
return {"message": "Post deleted successfully"}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
@router.post("/{post_id}/publish", response_model=schemas.Post)
|
|
228
|
-
def publish_post(
|
|
229
|
-
post_id: int,
|
|
230
|
-
current_user: models.User = Depends(get_current_active_user),
|
|
231
|
-
db: Session = Depends(get_db),
|
|
232
|
-
):
|
|
233
|
-
"""Publish a post."""
|
|
234
|
-
db_post = db.query(models.Post).filter(models.Post.id == post_id).first()
|
|
235
|
-
|
|
236
|
-
if not db_post:
|
|
237
|
-
raise HTTPException(
|
|
238
|
-
status_code=status.HTTP_404_NOT_FOUND, detail="Post not found"
|
|
239
|
-
)
|
|
240
|
-
|
|
241
|
-
# Check ownership
|
|
242
|
-
if db_post.author_id != current_user.id and not current_user.is_superuser:
|
|
243
|
-
raise HTTPException(
|
|
244
|
-
status_code=status.HTTP_403_FORBIDDEN,
|
|
245
|
-
detail="Not authorized to publish this post",
|
|
246
|
-
)
|
|
247
|
-
|
|
248
|
-
db_post.publish()
|
|
249
|
-
db.commit()
|
|
250
|
-
db.refresh(db_post)
|
|
251
|
-
|
|
252
|
-
return db_post
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
@router.get("/my/posts", response_model=List[schemas.PostList])
|
|
256
|
-
def get_my_posts(
|
|
257
|
-
skip: int = 0,
|
|
258
|
-
limit: int = 10,
|
|
259
|
-
current_user: models.User = Depends(get_current_active_user),
|
|
260
|
-
db: Session = Depends(get_db),
|
|
261
|
-
):
|
|
262
|
-
"""Get current user's posts."""
|
|
263
|
-
posts = (
|
|
264
|
-
db.query(models.Post)
|
|
265
|
-
.filter(models.Post.author_id == current_user.id)
|
|
266
|
-
.order_by(models.Post.created_at.desc())
|
|
267
|
-
.offset(skip)
|
|
268
|
-
.limit(limit)
|
|
269
|
-
.all()
|
|
270
|
-
)
|
|
271
|
-
|
|
272
|
-
return posts
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
from datetime import datetime
|
|
2
|
-
from typing import List, Optional
|
|
3
|
-
from pydantic import BaseModel, EmailStr, Field, ConfigDict
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
# User schemas
|
|
7
|
-
class UserBase(BaseModel):
|
|
8
|
-
email: EmailStr
|
|
9
|
-
username: str = Field(..., min_length=3, max_length=50)
|
|
10
|
-
full_name: Optional[str] = None
|
|
11
|
-
bio: Optional[str] = None
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
class UserCreate(UserBase):
|
|
15
|
-
password: str = Field(..., min_length=8)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class UserUpdate(BaseModel):
|
|
19
|
-
full_name: Optional[str] = None
|
|
20
|
-
bio: Optional[str] = None
|
|
21
|
-
email: Optional[EmailStr] = None
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
class User(UserBase):
|
|
25
|
-
model_config = ConfigDict(from_attributes=True)
|
|
26
|
-
|
|
27
|
-
id: int
|
|
28
|
-
is_active: bool
|
|
29
|
-
is_superuser: bool
|
|
30
|
-
created_at: datetime
|
|
31
|
-
updated_at: Optional[datetime] = None
|
|
32
|
-
posts_count: Optional[int] = 0
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
class UserInDB(User):
|
|
36
|
-
hashed_password: str
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
# Category schemas
|
|
40
|
-
class CategoryBase(BaseModel):
|
|
41
|
-
name: str = Field(..., min_length=1, max_length=100)
|
|
42
|
-
description: Optional[str] = None
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
class CategoryCreate(CategoryBase):
|
|
46
|
-
pass
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
class CategoryUpdate(BaseModel):
|
|
50
|
-
name: Optional[str] = None
|
|
51
|
-
description: Optional[str] = None
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
class Category(CategoryBase):
|
|
55
|
-
model_config = ConfigDict(from_attributes=True)
|
|
56
|
-
|
|
57
|
-
id: int
|
|
58
|
-
slug: str
|
|
59
|
-
created_at: datetime
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
# Tag schemas
|
|
63
|
-
class TagBase(BaseModel):
|
|
64
|
-
name: str = Field(..., min_length=1, max_length=50)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
class TagCreate(TagBase):
|
|
68
|
-
pass
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
class Tag(TagBase):
|
|
72
|
-
model_config = ConfigDict(from_attributes=True)
|
|
73
|
-
|
|
74
|
-
id: int
|
|
75
|
-
slug: str
|
|
76
|
-
created_at: datetime
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
# Comment schemas
|
|
80
|
-
class CommentBase(BaseModel):
|
|
81
|
-
content: str = Field(..., min_length=1)
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
class CommentCreate(CommentBase):
|
|
85
|
-
parent_id: Optional[int] = None
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
class CommentUpdate(BaseModel):
|
|
89
|
-
content: Optional[str] = None
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
class Comment(CommentBase):
|
|
93
|
-
model_config = ConfigDict(from_attributes=True)
|
|
94
|
-
|
|
95
|
-
id: int
|
|
96
|
-
is_approved: bool
|
|
97
|
-
created_at: datetime
|
|
98
|
-
updated_at: Optional[datetime] = None
|
|
99
|
-
author_id: int
|
|
100
|
-
author_username: str
|
|
101
|
-
post_id: int
|
|
102
|
-
parent_id: Optional[int] = None
|
|
103
|
-
replies_count: Optional[int] = 0
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
# Post schemas
|
|
107
|
-
class PostBase(BaseModel):
|
|
108
|
-
title: str = Field(..., min_length=1, max_length=255)
|
|
109
|
-
content: str = Field(..., min_length=1)
|
|
110
|
-
summary: Optional[str] = Field(None, max_length=500)
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
class PostCreate(PostBase):
|
|
114
|
-
category_id: Optional[int] = None
|
|
115
|
-
tag_ids: Optional[List[int]] = []
|
|
116
|
-
is_published: bool = False
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
class PostUpdate(BaseModel):
|
|
120
|
-
title: Optional[str] = None
|
|
121
|
-
content: Optional[str] = None
|
|
122
|
-
summary: Optional[str] = None
|
|
123
|
-
category_id: Optional[int] = None
|
|
124
|
-
tag_ids: Optional[List[int]] = None
|
|
125
|
-
is_published: Optional[bool] = None
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
class Post(PostBase):
|
|
129
|
-
model_config = ConfigDict(from_attributes=True)
|
|
130
|
-
|
|
131
|
-
id: int
|
|
132
|
-
slug: str
|
|
133
|
-
is_published: bool
|
|
134
|
-
published_at: Optional[datetime] = None
|
|
135
|
-
view_count: int
|
|
136
|
-
created_at: datetime
|
|
137
|
-
updated_at: Optional[datetime] = None
|
|
138
|
-
author_id: int
|
|
139
|
-
author_username: str
|
|
140
|
-
category: Optional[Category] = None
|
|
141
|
-
tags: List[Tag] = []
|
|
142
|
-
comments_count: Optional[int] = 0
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
class PostList(BaseModel):
|
|
146
|
-
model_config = ConfigDict(from_attributes=True)
|
|
147
|
-
|
|
148
|
-
id: int
|
|
149
|
-
title: str
|
|
150
|
-
slug: str
|
|
151
|
-
summary: Optional[str]
|
|
152
|
-
is_published: bool
|
|
153
|
-
published_at: Optional[datetime]
|
|
154
|
-
view_count: int
|
|
155
|
-
created_at: datetime
|
|
156
|
-
author_id: int
|
|
157
|
-
author_username: str
|
|
158
|
-
category_name: Optional[str] = None
|
|
159
|
-
tags: List[str] = []
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
# Auth schemas
|
|
163
|
-
class Token(BaseModel):
|
|
164
|
-
access_token: str
|
|
165
|
-
token_type: str = "bearer"
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
class TokenData(BaseModel):
|
|
169
|
-
username: Optional[str] = None
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
class LoginRequest(BaseModel):
|
|
173
|
-
username: str
|
|
174
|
-
password: str
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
# Pagination schema
|
|
178
|
-
class PaginatedResponse(BaseModel):
|
|
179
|
-
items: List
|
|
180
|
-
total: int
|
|
181
|
-
page: int
|
|
182
|
-
page_size: int
|
|
183
|
-
pages: int
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
class PostFilter(BaseModel):
|
|
187
|
-
category_slug: Optional[str] = None
|
|
188
|
-
tag_slug: Optional[str] = None
|
|
189
|
-
author_username: Optional[str] = None
|
|
190
|
-
is_published: Optional[bool] = True
|
|
191
|
-
search: Optional[str] = None
|
|
@@ -1,94 +0,0 @@
|
|
|
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**: Markdown, JSON, Python
|
|
11
|
-
- **Frameworks**: None
|
|
12
|
-
- **Total Files**: 38
|
|
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**: Markdown, JSON, Python
|
|
30
|
-
|
|
31
|
-
---
|
|
32
|
-
|
|
33
|
-
## Architecture
|
|
34
|
-
|
|
35
|
-
## Architectural Pattern
|
|
36
|
-
**Primary**: Flat / Simple Structure
|
|
37
|
-
|
|
38
|
-
## Layers Identified
|
|
39
|
-
- Infrastructure
|
|
40
|
-
- Config
|
|
41
|
-
|
|
42
|
-
## Key Modules
|
|
43
|
-
| Module | Responsibility |
|
|
44
|
-
|--------|----------------|
|
|
45
|
-
| `README.md` | Contains 0 files |
|
|
46
|
-
| `ai` | Contains 24 files |
|
|
47
|
-
| `app` | Contains 12 files |
|
|
48
|
-
| `config.py` | Configuration management |
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
---
|
|
52
|
-
|
|
53
|
-
## Key Entrypoints
|
|
54
|
-
|
|
55
|
-
---
|
|
56
|
-
|
|
57
|
-
## Code Conventions
|
|
58
|
-
|
|
59
|
-
## Naming Conventions
|
|
60
|
-
- **Files**: PascalCase
|
|
61
|
-
|
|
62
|
-
## Project Structure
|
|
63
|
-
|
|
64
|
-
## Code Style
|
|
65
|
-
- **Semicolons**: Required
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
---
|
|
69
|
-
|
|
70
|
-
## AI Rules
|
|
71
|
-
|
|
72
|
-
- Language: Use Markdown, JSON, Python
|
|
73
|
-
- Architecture: Follow Flat / Simple Structure pattern
|
|
74
|
-
- File naming: PascalCase
|
|
75
|
-
|
|
76
|
-
---
|
|
77
|
-
|
|
78
|
-
## Repository Map
|
|
79
|
-
|
|
80
|
-
See repo_map.md for the full structure.
|
|
81
|
-
|
|
82
|
-
---
|
|
83
|
-
|
|
84
|
-
## Notes for AI Assistants
|
|
85
|
-
|
|
86
|
-
1. Follow the established naming conventions (see conventions.md)
|
|
87
|
-
2. Use the detected frameworks and libraries
|
|
88
|
-
3. Target the correct entrypoints for modifications
|
|
89
|
-
4. Maintain the detected architecture patterns
|
|
90
|
-
5. Follow AI rules in ai_rules.md
|
|
91
|
-
|
|
92
|
-
---
|
|
93
|
-
|
|
94
|
-
*Generated by ai-first*
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
# AI Rules
|
|
2
|
-
|
|
3
|
-
> Guidelines for AI assistants working on this project
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Guidelines
|
|
8
|
-
|
|
9
|
-
- Language: Use Markdown, JSON, Python
|
|
10
|
-
- Architecture: Follow Flat / Simple Structure pattern
|
|
11
|
-
- File naming: PascalCase
|
|
12
|
-
|
|
13
|
-
## Patterns
|
|
14
|
-
|
|
15
|
-
- Layer structure: infrastructure → config
|
|
16
|
-
|
|
17
|
-
## Constraints
|
|
18
|
-
|
|
19
|
-
- Always use semicolons
|
|
20
|
-
|
|
21
|
-
---
|
|
22
|
-
|
|
23
|
-
## Quick Reference
|
|
24
|
-
|
|
25
|
-
| Category | Value |
|
|
26
|
-
|----------|-------|
|
|
27
|
-
| Language | Markdown, JSON, Python |
|
|
28
|
-
| Framework | N/A |
|
|
29
|
-
| Architecture | Flat / Simple Structure |
|
|
30
|
-
| Naming | PascalCase |
|
|
31
|
-
| Indentation | unknown |
|
|
32
|
-
|
|
33
|
-
---
|
|
34
|
-
|
|
35
|
-
## Best Practices
|
|
36
|
-
|
|
37
|
-
1. Follow the established naming conventions
|
|
38
|
-
2. Keep functions small and focused
|
|
39
|
-
3. Write tests for new features
|
|
40
|
-
4. Use descriptive variable names
|
|
41
|
-
5. Keep the architecture consistent
|
|
42
|
-
6. Document complex logic
|
|
43
|
-
7. Review code before committing
|
|
44
|
-
|
|
45
|
-
---
|
|
46
|
-
|
|
47
|
-
*Generated by ai-first*
|
|
@@ -1,49 +0,0 @@
|
|
|
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
|
-
| `README.md` | Contains 0 files |
|
|
14
|
-
| `ai` | Contains 24 files |
|
|
15
|
-
| `app` | Contains 12 files |
|
|
16
|
-
| `config.py` | Configuration management |
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
## Module Details
|
|
20
|
-
|
|
21
|
-
### README.md
|
|
22
|
-
- **Path**: `README.md`
|
|
23
|
-
- **Responsibility**: Contains 0 files
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
### ai
|
|
27
|
-
- **Path**: `ai`
|
|
28
|
-
- **Responsibility**: Contains 24 files
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
### app
|
|
32
|
-
- **Path**: `app`
|
|
33
|
-
- **Responsibility**: Contains 12 files
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
### config.py
|
|
37
|
-
- **Path**: `config.py`
|
|
38
|
-
- **Responsibility**: Configuration management
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
## Recommendations
|
|
43
|
-
|
|
44
|
-
- Keep the architecture consistent as the project grows
|
|
45
|
-
- Follow the established layer structure
|
|
46
|
-
- Use dependency injection to manage module relationships
|
|
47
|
-
|
|
48
|
-
---
|
|
49
|
-
*Generated by ai-first*
|