ai-first-cli 1.2.2 → 1.3.0
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/CHANGELOG.md +292 -6
- package/README.md +24 -4
- package/dist/analyzers/symbols.d.ts.map +1 -1
- package/dist/analyzers/symbols.js +9 -7
- package/dist/analyzers/symbols.js.map +1 -1
- package/dist/analyzers/techStack.d.ts.map +1 -1
- package/dist/analyzers/techStack.js +198 -3
- package/dist/analyzers/techStack.js.map +1 -1
- package/dist/commands/ai-first.d.ts.map +1 -1
- package/dist/commands/ai-first.js +14 -13
- package/dist/commands/ai-first.js.map +1 -1
- package/dist/core/adapters/baseAdapter.d.ts +1 -1
- package/dist/core/adapters/baseAdapter.d.ts.map +1 -1
- package/dist/core/adapters/baseAdapter.js +50 -12
- package/dist/core/adapters/baseAdapter.js.map +1 -1
- package/dist/core/analysis/architectureDetector.d.ts +37 -0
- package/dist/core/analysis/architectureDetector.d.ts.map +1 -0
- package/dist/core/analysis/architectureDetector.js +316 -0
- package/dist/core/analysis/architectureDetector.js.map +1 -0
- package/dist/core/analysis/callGraphBuilder.d.ts +37 -0
- package/dist/core/analysis/callGraphBuilder.d.ts.map +1 -0
- package/dist/core/analysis/callGraphBuilder.js +101 -0
- package/dist/core/analysis/callGraphBuilder.js.map +1 -0
- package/dist/core/analysis/dependencyAnalyzer.d.ts +45 -0
- package/dist/core/analysis/dependencyAnalyzer.d.ts.map +1 -0
- package/dist/core/analysis/dependencyAnalyzer.js +98 -0
- package/dist/core/analysis/dependencyAnalyzer.js.map +1 -0
- package/dist/core/analysis/index.d.ts +5 -0
- package/dist/core/analysis/index.d.ts.map +1 -0
- package/dist/core/analysis/index.js +5 -0
- package/dist/core/analysis/index.js.map +1 -0
- package/dist/core/analysis/inheritanceAnalyzer.d.ts +35 -0
- package/dist/core/analysis/inheritanceAnalyzer.d.ts.map +1 -0
- package/dist/core/analysis/inheritanceAnalyzer.js +115 -0
- package/dist/core/analysis/inheritanceAnalyzer.js.map +1 -0
- package/dist/core/ccp.d.ts.map +1 -1
- package/dist/core/ccp.js +3 -2
- package/dist/core/ccp.js.map +1 -1
- package/dist/core/generation/aiContextGenerator.d.ts +71 -0
- package/dist/core/generation/aiContextGenerator.d.ts.map +1 -0
- package/dist/core/generation/aiContextGenerator.js +217 -0
- package/dist/core/generation/aiContextGenerator.js.map +1 -0
- package/dist/core/generation/architectureGenerator.d.ts +17 -0
- package/dist/core/generation/architectureGenerator.d.ts.map +1 -0
- package/dist/core/generation/architectureGenerator.js +160 -0
- package/dist/core/generation/architectureGenerator.js.map +1 -0
- package/dist/core/generation/flowGenerator.d.ts +52 -0
- package/dist/core/generation/flowGenerator.d.ts.map +1 -0
- package/dist/core/generation/flowGenerator.js +164 -0
- package/dist/core/generation/flowGenerator.js.map +1 -0
- package/dist/core/generation/index.d.ts +4 -0
- package/dist/core/generation/index.d.ts.map +1 -0
- package/dist/core/generation/index.js +4 -0
- package/dist/core/generation/index.js.map +1 -0
- package/dist/core/hierarchyGenerator.d.ts.map +1 -1
- package/dist/core/hierarchyGenerator.js +3 -2
- package/dist/core/hierarchyGenerator.js.map +1 -1
- package/dist/core/parsers/index.d.ts +20 -0
- package/dist/core/parsers/index.d.ts.map +1 -0
- package/dist/core/parsers/index.js +76 -0
- package/dist/core/parsers/index.js.map +1 -0
- package/dist/core/parsers/pythonParser.d.ts +37 -0
- package/dist/core/parsers/pythonParser.d.ts.map +1 -0
- package/dist/core/parsers/pythonParser.js +229 -0
- package/dist/core/parsers/pythonParser.js.map +1 -0
- package/dist/core/parsers/typescriptParser.d.ts +54 -0
- package/dist/core/parsers/typescriptParser.d.ts.map +1 -0
- package/dist/core/parsers/typescriptParser.js +291 -0
- package/dist/core/parsers/typescriptParser.js.map +1 -0
- package/dist/core/pipeline.d.ts +42 -0
- package/dist/core/pipeline.d.ts.map +1 -0
- package/dist/core/pipeline.js +172 -0
- package/dist/core/pipeline.js.map +1 -0
- package/dist/core/semanticContexts.d.ts.map +1 -1
- package/dist/core/semanticContexts.js +23 -61
- package/dist/core/semanticContexts.js.map +1 -1
- package/dist/utils/constants.d.ts +46 -0
- package/dist/utils/constants.d.ts.map +1 -0
- package/dist/utils/constants.js +67 -0
- package/dist/utils/constants.js.map +1 -0
- package/install.sh +143 -17
- package/package.json +1 -1
- package/run-all-tests.sh +184 -0
- package/src/analyzers/symbols.ts +12 -7
- package/src/analyzers/techStack.ts +203 -3
- package/src/commands/ai-first.ts +14 -13
- package/src/core/adapters/baseAdapter.ts +61 -12
- package/src/core/analysis/architectureDetector.ts +487 -0
- package/src/core/analysis/callGraphBuilder.ts +158 -0
- package/src/core/analysis/dependencyAnalyzer.ts +167 -0
- package/src/core/analysis/index.ts +28 -0
- package/src/core/analysis/inheritanceAnalyzer.ts +169 -0
- package/src/core/ccp.ts +3 -2
- package/src/core/generation/aiContextGenerator.ts +335 -0
- package/src/core/generation/architectureGenerator.ts +200 -0
- package/src/core/generation/flowGenerator.ts +238 -0
- package/src/core/generation/index.ts +16 -0
- package/src/core/hierarchyGenerator.ts +3 -2
- package/src/core/parsers/index.ts +99 -0
- package/src/core/parsers/pythonParser.ts +302 -0
- package/src/core/parsers/typescriptParser.ts +445 -0
- package/src/core/pipeline.ts +241 -0
- package/src/core/semanticContexts.ts +25 -67
- package/src/utils/constants.ts +78 -0
- package/tests/analysis.test.ts +283 -0
- package/tests/architectureDetector.test.ts +137 -0
- package/tests/generation.test.ts +216 -0
- package/tests/parserRegistry.test.ts +139 -0
- package/tests/pipeline.integration.test.ts +245 -0
- package/tests/pythonParser.test.ts +210 -0
- package/tests/typescriptParser.test.ts +197 -0
- package/.ai-dev/index.db +0 -0
- package/ANALISIS_COMPLETO.md +0 -424
- package/ANALISIS_MEJORAS.md +0 -327
- package/BUGS.md +0 -455
- package/PLAN_MEJORAS.md +0 -216
- package/STATUS_ADAPTADORES +0 -126
- package/TEST_RESULTS.md +0 -198
- package/TEST_RESULTS_COMPARATIVE.md +0 -159
- package/TEST_RESULTS_COMPLETE.md +0 -127
- package/TEST_RESULTS_COMPREHENSIVE.md +0 -208
- package/TEST_RESULTS_PHASE1.md +0 -420
- package/ai-context/ai_context.md +0 -130
- package/ai-context/ai_rules.md +0 -54
- package/ai-context/architecture.md +0 -136
- package/ai-context/cache.json +0 -2349
- package/ai-context/ccp/jira-123/context.json +0 -7
- package/ai-context/context/features/commands.json +0 -18
- package/ai-context/context/features/src.json +0 -61
- package/ai-context/context/features/test-projects.json +0 -69
- package/ai-context/context/flows/account.json +0 -9
- package/ai-context/context/flows/ai-first.json +0 -9
- package/ai-context/context/flows/api.json +0 -9
- package/ai-context/context/flows/auth.json +0 -13
- package/ai-context/context/flows/category.json +0 -12
- package/ai-context/context/flows/comment.json +0 -16
- package/ai-context/context/flows/dashboard.json +0 -9
- package/ai-context/context/flows/doctor.json +0 -9
- package/ai-context/context/flows/explore.json +0 -9
- package/ai-context/context/flows/login.json +0 -9
- package/ai-context/context/flows/opportunity.json +0 -9
- package/ai-context/context/flows/post.json +0 -18
- package/ai-context/context/flows/routes.json +0 -19
- package/ai-context/context/flows/user.json +0 -20
- package/ai-context/context/flows/users.json +0 -9
- package/ai-context/context/flows/views.json +0 -14
- package/ai-context/context/repo.json +0 -56
- package/ai-context/context/utils.json +0 -7
- package/ai-context/conventions.md +0 -53
- package/ai-context/dependencies.json +0 -2946
- package/ai-context/embeddings.json +0 -23828
- package/ai-context/entrypoints.md +0 -42
- package/ai-context/files.json +0 -2944
- package/ai-context/git/commit-activity.json +0 -8646
- package/ai-context/git/recent-features.json +0 -1
- package/ai-context/git/recent-files.json +0 -52
- package/ai-context/git/recent-flows.json +0 -1
- package/ai-context/graph/knowledge-graph.json +0 -44314
- package/ai-context/graph/module-graph.json +0 -866
- package/ai-context/graph/symbol-graph.json +0 -200622
- package/ai-context/graph/symbol-references.json +0 -6778
- package/ai-context/hierarchy.json +0 -20
- package/ai-context/index-state.json +0 -4340
- package/ai-context/index.db +0 -0
- package/ai-context/modules.json +0 -532
- package/ai-context/project.json +0 -30
- package/ai-context/repo_map.json +0 -5818
- package/ai-context/repo_map.md +0 -1327
- package/ai-context/schema.json +0 -5
- package/ai-context/summary.md +0 -42
- package/ai-context/symbols.json +0 -7
- package/ai-context/tech_stack.md +0 -46
- package/ai-context/tools.json +0 -10
- package/test-projects/django-app/.ai-dev/index.db +0 -0
- package/test-projects/django-app/ai-context/ai_context.md +0 -92
- package/test-projects/django-app/ai-context/ai_rules.md +0 -47
- package/test-projects/django-app/ai-context/architecture.md +0 -57
- package/test-projects/django-app/ai-context/cache.json +0 -169
- package/test-projects/django-app/ai-context/context/flows/views.json +0 -10
- package/test-projects/django-app/ai-context/conventions.md +0 -51
- package/test-projects/django-app/ai-context/dependencies.json +0 -312
- package/test-projects/django-app/ai-context/entrypoints.md +0 -4
- package/test-projects/django-app/ai-context/files.json +0 -209
- package/test-projects/django-app/ai-context/graph/knowledge-graph.json +0 -36
- package/test-projects/django-app/ai-context/graph/module-graph.json +0 -145
- package/test-projects/django-app/ai-context/graph/symbol-graph.json +0 -1488
- package/test-projects/django-app/ai-context/graph/symbol-references.json +0 -1
- package/test-projects/django-app/ai-context/index-state.json +0 -294
- package/test-projects/django-app/ai-context/index.db +0 -0
- package/test-projects/django-app/ai-context/modules.json +0 -35
- package/test-projects/django-app/ai-context/project.json +0 -11
- package/test-projects/django-app/ai-context/repo_map.json +0 -412
- package/test-projects/django-app/ai-context/repo_map.md +0 -105
- package/test-projects/django-app/ai-context/schema.json +0 -5
- package/test-projects/django-app/ai-context/summary.md +0 -15
- package/test-projects/django-app/ai-context/symbols.json +0 -1
- package/test-projects/django-app/ai-context/tech_stack.md +0 -32
- package/test-projects/django-app/ai-context/tools.json +0 -10
- package/test-projects/express-api/ai-context/ai_context.md +0 -112
- package/test-projects/express-api/ai-context/ai_rules.md +0 -50
- package/test-projects/express-api/ai-context/architecture.md +0 -62
- package/test-projects/express-api/ai-context/context/features/controllers.json +0 -13
- package/test-projects/express-api/ai-context/context/features/services.json +0 -13
- package/test-projects/express-api/ai-context/context/flows/auth.json +0 -12
- package/test-projects/express-api/ai-context/context/flows/user.json +0 -13
- package/test-projects/express-api/ai-context/conventions.md +0 -51
- package/test-projects/express-api/ai-context/dependencies.json +0 -54
- package/test-projects/express-api/ai-context/entrypoints.md +0 -17
- package/test-projects/express-api/ai-context/modules.json +0 -30
- package/test-projects/express-api/ai-context/project.json +0 -15
- package/test-projects/express-api/ai-context/repo_map.json +0 -100
- package/test-projects/express-api/ai-context/repo_map.md +0 -36
- package/test-projects/express-api/ai-context/schema.json +0 -5
- package/test-projects/express-api/ai-context/summary.md +0 -14
- package/test-projects/express-api/ai-context/symbols.json +0 -7
- package/test-projects/express-api/ai-context/tech_stack.md +0 -38
- package/test-projects/express-api/ai-context/tools.json +0 -10
- package/test-projects/fastapi-app/.ai-dev/index.db +0 -0
- package/test-projects/fastapi-app/ai-context/ai_context.md +0 -89
- package/test-projects/fastapi-app/ai-context/ai_rules.md +0 -47
- package/test-projects/fastapi-app/ai-context/architecture.md +0 -39
- package/test-projects/fastapi-app/ai-context/cache.json +0 -125
- package/test-projects/fastapi-app/ai-context/conventions.md +0 -51
- package/test-projects/fastapi-app/ai-context/dependencies.json +0 -244
- package/test-projects/fastapi-app/ai-context/entrypoints.md +0 -4
- package/test-projects/fastapi-app/ai-context/files.json +0 -154
- package/test-projects/fastapi-app/ai-context/graph/knowledge-graph.json +0 -15
- package/test-projects/fastapi-app/ai-context/graph/module-graph.json +0 -78
- package/test-projects/fastapi-app/ai-context/graph/symbol-graph.json +0 -1724
- package/test-projects/fastapi-app/ai-context/graph/symbol-references.json +0 -51
- package/test-projects/fastapi-app/ai-context/index-state.json +0 -217
- package/test-projects/fastapi-app/ai-context/index.db +0 -0
- package/test-projects/fastapi-app/ai-context/modules.json +0 -16
- package/test-projects/fastapi-app/ai-context/project.json +0 -9
- package/test-projects/fastapi-app/ai-context/repo_map.json +0 -298
- package/test-projects/fastapi-app/ai-context/repo_map.md +0 -74
- package/test-projects/fastapi-app/ai-context/schema.json +0 -5
- package/test-projects/fastapi-app/ai-context/summary.md +0 -12
- package/test-projects/fastapi-app/ai-context/symbols.json +0 -1
- package/test-projects/fastapi-app/ai-context/tech_stack.md +0 -32
- package/test-projects/fastapi-app/ai-context/tools.json +0 -10
- package/test-projects/flask-app/.ai-dev/index.db +0 -0
- package/test-projects/flask-app/ai-context/ai_context.md +0 -94
- package/test-projects/flask-app/ai-context/ai_rules.md +0 -47
- package/test-projects/flask-app/ai-context/architecture.md +0 -49
- package/test-projects/flask-app/ai-context/cache.json +0 -157
- package/test-projects/flask-app/ai-context/context/features/app.json +0 -25
- package/test-projects/flask-app/ai-context/context/flows/routes.json +0 -14
- package/test-projects/flask-app/ai-context/conventions.md +0 -51
- package/test-projects/flask-app/ai-context/dependencies.json +0 -298
- package/test-projects/flask-app/ai-context/entrypoints.md +0 -4
- package/test-projects/flask-app/ai-context/files.json +0 -194
- package/test-projects/flask-app/ai-context/graph/knowledge-graph.json +0 -60
- package/test-projects/flask-app/ai-context/graph/module-graph.json +0 -95
- package/test-projects/flask-app/ai-context/graph/symbol-graph.json +0 -1448
- package/test-projects/flask-app/ai-context/graph/symbol-references.json +0 -45
- package/test-projects/flask-app/ai-context/index-state.json +0 -273
- package/test-projects/flask-app/ai-context/index.db +0 -0
- package/test-projects/flask-app/ai-context/modules.json +0 -21
- package/test-projects/flask-app/ai-context/project.json +0 -13
- package/test-projects/flask-app/ai-context/repo_map.json +0 -400
- package/test-projects/flask-app/ai-context/repo_map.md +0 -98
- package/test-projects/flask-app/ai-context/schema.json +0 -5
- package/test-projects/flask-app/ai-context/summary.md +0 -13
- package/test-projects/flask-app/ai-context/symbols.json +0 -1
- package/test-projects/flask-app/ai-context/tech_stack.md +0 -32
- package/test-projects/flask-app/ai-context/tools.json +0 -10
- package/test-projects/laravel-app/.ai-dev/index.db +0 -0
- package/test-projects/laravel-app/ai-context/ai_context.md +0 -97
- package/test-projects/laravel-app/ai-context/ai_rules.md +0 -47
- package/test-projects/laravel-app/ai-context/architecture.md +0 -60
- package/test-projects/laravel-app/ai-context/cache.json +0 -161
- package/test-projects/laravel-app/ai-context/context/features/app.json +0 -21
- package/test-projects/laravel-app/ai-context/context/flows/.json +0 -9
- package/test-projects/laravel-app/ai-context/context/flows/category.json +0 -12
- package/test-projects/laravel-app/ai-context/context/flows/comment.json +0 -12
- package/test-projects/laravel-app/ai-context/context/flows/post.json +0 -12
- package/test-projects/laravel-app/ai-context/context/flows/unnamed.json +0 -9
- package/test-projects/laravel-app/ai-context/conventions.md +0 -51
- package/test-projects/laravel-app/ai-context/dependencies.json +0 -6
- package/test-projects/laravel-app/ai-context/entrypoints.md +0 -4
- package/test-projects/laravel-app/ai-context/files.json +0 -199
- package/test-projects/laravel-app/ai-context/graph/knowledge-graph.json +0 -98
- package/test-projects/laravel-app/ai-context/graph/module-graph.json +0 -30
- package/test-projects/laravel-app/ai-context/graph/symbol-graph.json +0 -5
- package/test-projects/laravel-app/ai-context/graph/symbol-references.json +0 -1
- package/test-projects/laravel-app/ai-context/index-state.json +0 -280
- package/test-projects/laravel-app/ai-context/index.db +0 -0
- package/test-projects/laravel-app/ai-context/modules.json +0 -29
- package/test-projects/laravel-app/ai-context/project.json +0 -17
- package/test-projects/laravel-app/ai-context/repo_map.json +0 -419
- package/test-projects/laravel-app/ai-context/repo_map.md +0 -106
- package/test-projects/laravel-app/ai-context/schema.json +0 -5
- package/test-projects/laravel-app/ai-context/summary.md +0 -15
- package/test-projects/laravel-app/ai-context/symbols.json +0 -1
- package/test-projects/laravel-app/ai-context/tech_stack.md +0 -34
- package/test-projects/laravel-app/ai-context/tools.json +0 -10
- package/test-projects/nestjs-backend/.ai-dev/index.db +0 -0
- package/test-projects/nestjs-backend/ai-context/ai_context.md +0 -111
- package/test-projects/nestjs-backend/ai-context/ai_rules.md +0 -52
- package/test-projects/nestjs-backend/ai-context/architecture.md +0 -49
- package/test-projects/nestjs-backend/ai-context/cache.json +0 -169
- package/test-projects/nestjs-backend/ai-context/context/features/src.json +0 -23
- package/test-projects/nestjs-backend/ai-context/context/flows/auth.controller.json +0 -14
- package/test-projects/nestjs-backend/ai-context/context/flows/auth.json +0 -10
- package/test-projects/nestjs-backend/ai-context/context/flows/users..json +0 -10
- package/test-projects/nestjs-backend/ai-context/context/flows/users.controller.json +0 -14
- package/test-projects/nestjs-backend/ai-context/context/flows/users.json +0 -10
- package/test-projects/nestjs-backend/ai-context/conventions.md +0 -52
- package/test-projects/nestjs-backend/ai-context/dependencies.json +0 -152
- package/test-projects/nestjs-backend/ai-context/entrypoints.md +0 -18
- package/test-projects/nestjs-backend/ai-context/files.json +0 -209
- package/test-projects/nestjs-backend/ai-context/graph/knowledge-graph.json +0 -132
- package/test-projects/nestjs-backend/ai-context/graph/module-graph.json +0 -29
- package/test-projects/nestjs-backend/ai-context/graph/symbol-graph.json +0 -304
- package/test-projects/nestjs-backend/ai-context/graph/symbol-references.json +0 -5
- package/test-projects/nestjs-backend/ai-context/index-state.json +0 -294
- package/test-projects/nestjs-backend/ai-context/index.db +0 -0
- package/test-projects/nestjs-backend/ai-context/modules.json +0 -19
- package/test-projects/nestjs-backend/ai-context/project.json +0 -18
- package/test-projects/nestjs-backend/ai-context/repo_map.json +0 -427
- package/test-projects/nestjs-backend/ai-context/repo_map.md +0 -104
- package/test-projects/nestjs-backend/ai-context/schema.json +0 -5
- package/test-projects/nestjs-backend/ai-context/summary.md +0 -13
- package/test-projects/nestjs-backend/ai-context/symbols.json +0 -1
- package/test-projects/nestjs-backend/ai-context/tech_stack.md +0 -38
- package/test-projects/nestjs-backend/ai-context/tools.json +0 -10
- package/test-projects/python-cli/.ai-dev/index.db +0 -0
- package/test-projects/python-cli/ai-context/ai_context.md +0 -95
- package/test-projects/python-cli/ai-context/ai_rules.md +0 -47
- package/test-projects/python-cli/ai-context/architecture.md +0 -55
- package/test-projects/python-cli/ai-context/cache.json +0 -149
- package/test-projects/python-cli/ai-context/context/features/cli.json +0 -16
- package/test-projects/python-cli/ai-context/context/flows/list_.json +0 -9
- package/test-projects/python-cli/ai-context/context/flows/remove_.json +0 -9
- package/test-projects/python-cli/ai-context/conventions.md +0 -51
- package/test-projects/python-cli/ai-context/dependencies.json +0 -66
- package/test-projects/python-cli/ai-context/entrypoints.md +0 -4
- package/test-projects/python-cli/ai-context/files.json +0 -184
- package/test-projects/python-cli/ai-context/graph/knowledge-graph.json +0 -83
- package/test-projects/python-cli/ai-context/graph/module-graph.json +0 -31
- package/test-projects/python-cli/ai-context/graph/symbol-graph.json +0 -358
- package/test-projects/python-cli/ai-context/graph/symbol-references.json +0 -11
- package/test-projects/python-cli/ai-context/index-state.json +0 -259
- package/test-projects/python-cli/ai-context/index.db +0 -0
- package/test-projects/python-cli/ai-context/modules.json +0 -21
- package/test-projects/python-cli/ai-context/project.json +0 -15
- package/test-projects/python-cli/ai-context/repo_map.json +0 -367
- package/test-projects/python-cli/ai-context/repo_map.md +0 -93
- package/test-projects/python-cli/ai-context/schema.json +0 -5
- package/test-projects/python-cli/ai-context/summary.md +0 -14
- package/test-projects/python-cli/ai-context/symbols.json +0 -1
- package/test-projects/python-cli/ai-context/tech_stack.md +0 -32
- package/test-projects/python-cli/ai-context/tools.json +0 -10
- package/test-projects/rails-app/.ai-dev/index.db +0 -0
- package/test-projects/rails-app/ai-context/ai_context.md +0 -94
- package/test-projects/rails-app/ai-context/ai_rules.md +0 -47
- package/test-projects/rails-app/ai-context/architecture.md +0 -49
- package/test-projects/rails-app/ai-context/cache.json +0 -193
- package/test-projects/rails-app/ai-context/context/features/app.json +0 -24
- package/test-projects/rails-app/ai-context/context/features/config.json +0 -13
- package/test-projects/rails-app/ai-context/context/flows/application.json +0 -9
- package/test-projects/rails-app/ai-context/context/flows/application_.json +0 -9
- package/test-projects/rails-app/ai-context/context/flows/comments.json +0 -11
- package/test-projects/rails-app/ai-context/context/flows/comments_.json +0 -11
- package/test-projects/rails-app/ai-context/context/flows/posts.json +0 -11
- package/test-projects/rails-app/ai-context/context/flows/posts_.json +0 -11
- package/test-projects/rails-app/ai-context/context/flows/routes.json +0 -9
- package/test-projects/rails-app/ai-context/context/flows/users.json +0 -11
- package/test-projects/rails-app/ai-context/context/flows/users_.json +0 -11
- package/test-projects/rails-app/ai-context/conventions.md +0 -51
- package/test-projects/rails-app/ai-context/dependencies.json +0 -6
- package/test-projects/rails-app/ai-context/entrypoints.md +0 -4
- package/test-projects/rails-app/ai-context/files.json +0 -239
- package/test-projects/rails-app/ai-context/graph/knowledge-graph.json +0 -130
- package/test-projects/rails-app/ai-context/graph/module-graph.json +0 -27
- package/test-projects/rails-app/ai-context/graph/symbol-graph.json +0 -5
- package/test-projects/rails-app/ai-context/graph/symbol-references.json +0 -1
- package/test-projects/rails-app/ai-context/index-state.json +0 -336
- package/test-projects/rails-app/ai-context/index.db +0 -0
- package/test-projects/rails-app/ai-context/modules.json +0 -26
- package/test-projects/rails-app/ai-context/project.json +0 -22
- package/test-projects/rails-app/ai-context/repo_map.json +0 -486
- package/test-projects/rails-app/ai-context/repo_map.md +0 -117
- package/test-projects/rails-app/ai-context/schema.json +0 -5
- package/test-projects/rails-app/ai-context/summary.md +0 -13
- package/test-projects/rails-app/ai-context/symbols.json +0 -1
- package/test-projects/rails-app/ai-context/tech_stack.md +0 -32
- package/test-projects/rails-app/ai-context/tools.json +0 -10
- package/test-projects/react-app/.ai-dev/index.db +0 -0
- package/test-projects/react-app/ai-context/ai_context.md +0 -96
- package/test-projects/react-app/ai-context/ai_rules.md +0 -49
- package/test-projects/react-app/ai-context/architecture.md +0 -39
- package/test-projects/react-app/ai-context/cache.json +0 -153
- package/test-projects/react-app/ai-context/context/features/src.json +0 -18
- package/test-projects/react-app/ai-context/context/flows/UsersPage.json +0 -14
- package/test-projects/react-app/ai-context/context/flows/dashboard.json +0 -9
- package/test-projects/react-app/ai-context/context/flows/login.json +0 -9
- package/test-projects/react-app/ai-context/context/flows/users.json +0 -9
- package/test-projects/react-app/ai-context/conventions.md +0 -52
- package/test-projects/react-app/ai-context/dependencies.json +0 -128
- package/test-projects/react-app/ai-context/entrypoints.md +0 -4
- package/test-projects/react-app/ai-context/files.json +0 -189
- package/test-projects/react-app/ai-context/graph/knowledge-graph.json +0 -112
- package/test-projects/react-app/ai-context/graph/module-graph.json +0 -31
- package/test-projects/react-app/ai-context/graph/symbol-graph.json +0 -868
- package/test-projects/react-app/ai-context/graph/symbol-references.json +0 -31
- package/test-projects/react-app/ai-context/index-state.json +0 -266
- package/test-projects/react-app/ai-context/index.db +0 -0
- package/test-projects/react-app/ai-context/modules.json +0 -17
- package/test-projects/react-app/ai-context/project.json +0 -16
- package/test-projects/react-app/ai-context/repo_map.json +0 -391
- package/test-projects/react-app/ai-context/repo_map.md +0 -94
- package/test-projects/react-app/ai-context/schema.json +0 -5
- package/test-projects/react-app/ai-context/summary.md +0 -13
- package/test-projects/react-app/ai-context/symbols.json +0 -1
- package/test-projects/react-app/ai-context/tech_stack.md +0 -39
- package/test-projects/react-app/ai-context/tools.json +0 -10
- package/test-projects/salesforce-cli/.ai-dev/index.db +0 -0
- package/test-projects/salesforce-cli/ai-context/ai_context.md +0 -89
- package/test-projects/salesforce-cli/ai-context/ai_rules.md +0 -47
- package/test-projects/salesforce-cli/ai-context/architecture.md +0 -39
- package/test-projects/salesforce-cli/ai-context/cache.json +0 -125
- package/test-projects/salesforce-cli/ai-context/context/features/force-app.json +0 -14
- package/test-projects/salesforce-cli/ai-context/context/flows/account.json +0 -9
- package/test-projects/salesforce-cli/ai-context/context/flows/opportunity.json +0 -9
- package/test-projects/salesforce-cli/ai-context/conventions.md +0 -51
- package/test-projects/salesforce-cli/ai-context/dependencies.json +0 -6
- package/test-projects/salesforce-cli/ai-context/entrypoints.md +0 -4
- package/test-projects/salesforce-cli/ai-context/files.json +0 -154
- package/test-projects/salesforce-cli/ai-context/graph/knowledge-graph.json +0 -64
- package/test-projects/salesforce-cli/ai-context/graph/module-graph.json +0 -13
- package/test-projects/salesforce-cli/ai-context/graph/symbol-graph.json +0 -148
- package/test-projects/salesforce-cli/ai-context/graph/symbol-references.json +0 -1
- package/test-projects/salesforce-cli/ai-context/index-state.json +0 -217
- package/test-projects/salesforce-cli/ai-context/index.db +0 -0
- package/test-projects/salesforce-cli/ai-context/modules.json +0 -12
- package/test-projects/salesforce-cli/ai-context/project.json +0 -14
- package/test-projects/salesforce-cli/ai-context/repo_map.json +0 -328
- package/test-projects/salesforce-cli/ai-context/repo_map.md +0 -80
- package/test-projects/salesforce-cli/ai-context/schema.json +0 -5
- package/test-projects/salesforce-cli/ai-context/summary.md +0 -13
- package/test-projects/salesforce-cli/ai-context/symbols.json +0 -1
- package/test-projects/salesforce-cli/ai-context/tech_stack.md +0 -31
- package/test-projects/salesforce-cli/ai-context/tools.json +0 -10
- package/test-projects/spring-boot-app/.ai-dev/index.db +0 -0
- package/test-projects/spring-boot-app/ai-context/ai_context.md +0 -91
- package/test-projects/spring-boot-app/ai-context/ai_rules.md +0 -48
- package/test-projects/spring-boot-app/ai-context/architecture.md +0 -39
- package/test-projects/spring-boot-app/ai-context/cache.json +0 -173
- package/test-projects/spring-boot-app/ai-context/context/features/src.json +0 -26
- package/test-projects/spring-boot-app/ai-context/context/flows/PostController.json +0 -19
- package/test-projects/spring-boot-app/ai-context/context/flows/UserController.json +0 -19
- package/test-projects/spring-boot-app/ai-context/context/flows/comment.json +0 -11
- package/test-projects/spring-boot-app/ai-context/context/flows/post.json +0 -14
- package/test-projects/spring-boot-app/ai-context/context/flows/user.json +0 -14
- package/test-projects/spring-boot-app/ai-context/conventions.md +0 -52
- package/test-projects/spring-boot-app/ai-context/dependencies.json +0 -326
- package/test-projects/spring-boot-app/ai-context/entrypoints.md +0 -4
- package/test-projects/spring-boot-app/ai-context/files.json +0 -214
- package/test-projects/spring-boot-app/ai-context/graph/knowledge-graph.json +0 -231
- package/test-projects/spring-boot-app/ai-context/graph/module-graph.json +0 -22
- package/test-projects/spring-boot-app/ai-context/graph/symbol-graph.json +0 -794
- package/test-projects/spring-boot-app/ai-context/graph/symbol-references.json +0 -70
- package/test-projects/spring-boot-app/ai-context/index-state.json +0 -301
- package/test-projects/spring-boot-app/ai-context/index.db +0 -0
- package/test-projects/spring-boot-app/ai-context/modules.json +0 -21
- package/test-projects/spring-boot-app/ai-context/project.json +0 -17
- package/test-projects/spring-boot-app/ai-context/repo_map.json +0 -461
- package/test-projects/spring-boot-app/ai-context/repo_map.md +0 -109
- package/test-projects/spring-boot-app/ai-context/schema.json +0 -5
- package/test-projects/spring-boot-app/ai-context/summary.md +0 -12
- package/test-projects/spring-boot-app/ai-context/symbols.json +0 -1
- package/test-projects/spring-boot-app/ai-context/tech_stack.md +0 -32
- package/test-projects/spring-boot-app/ai-context/tools.json +0 -10
package/install.sh
CHANGED
|
@@ -1,21 +1,91 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
# af (AI-First) Installer
|
|
2
|
+
# af (AI-First) Installer
|
|
3
|
+
# Usage: curl -fsSL https://raw.githubusercontent.com/julianperezpesce/ai-first/master/install.sh | bash
|
|
3
4
|
set -e
|
|
4
5
|
|
|
5
|
-
AF_VERSION="${AF_VERSION:-1.2.
|
|
6
|
+
AF_VERSION="${AF_VERSION:-1.2.2}"
|
|
6
7
|
|
|
7
8
|
RED='\033[0;31m'
|
|
8
9
|
GREEN='\033[0;32m'
|
|
9
10
|
YELLOW='\033[1;33m'
|
|
11
|
+
BLUE='\033[0;34m'
|
|
10
12
|
NC='\033[0m'
|
|
11
13
|
|
|
12
14
|
log_info() { echo -e "${GREEN}✓${NC} $1"; }
|
|
13
15
|
log_warn() { echo -e "${YELLOW}⚠${NC} $1"; }
|
|
14
16
|
log_error() { echo -e "${RED}✗${NC} $1"; }
|
|
17
|
+
log_step() { echo -e "${BLUE}→${NC} $1"; }
|
|
18
|
+
|
|
19
|
+
# Detect npm's global bin directory
|
|
20
|
+
get_npm_global_bin() {
|
|
21
|
+
npm config get prefix --global 2>/dev/null
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
# Try to create symlink in a PATH directory
|
|
25
|
+
setup_symlink() {
|
|
26
|
+
local src="$1"
|
|
27
|
+
local name="af"
|
|
28
|
+
|
|
29
|
+
# Try /usr/local/bin first (standard)
|
|
30
|
+
if [ -w /usr/local/bin ] 2>/dev/null; then
|
|
31
|
+
ln -sf "$src" /usr/local/bin/$name
|
|
32
|
+
echo "/usr/local/bin/$name"
|
|
33
|
+
return 0
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
# Try ~/.local/bin (Freedesktop standard)
|
|
37
|
+
if [ -w "$HOME/.local/bin" ] 2>/dev/null || mkdir -p "$HOME/.local/bin" 2>/dev/null; then
|
|
38
|
+
ln -sf "$src" "$HOME/.local/bin/$name"
|
|
39
|
+
echo "$HOME/.local/bin/$name"
|
|
40
|
+
return 0
|
|
41
|
+
fi
|
|
42
|
+
|
|
43
|
+
# Try ~/bin (legacy)
|
|
44
|
+
if [ -w "$HOME/bin" ] 2>/dev/null || mkdir -p "$HOME/bin" 2>/dev/null; then
|
|
45
|
+
ln -sf "$src" "$HOME/bin/$name"
|
|
46
|
+
echo "$HOME/bin/$name"
|
|
47
|
+
return 0
|
|
48
|
+
fi
|
|
49
|
+
|
|
50
|
+
return 1
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
# Add directory to PATH in shell RC if not already present
|
|
54
|
+
ensure_path() {
|
|
55
|
+
local dir="$1"
|
|
56
|
+
local rcfile=""
|
|
57
|
+
|
|
58
|
+
# Find the active shell RC file
|
|
59
|
+
if [ -n "$ZSH_VERSION" ]; then
|
|
60
|
+
rcfile="$HOME/.zshrc"
|
|
61
|
+
elif [ -n "$BASH_VERSION" ]; then
|
|
62
|
+
rcfile="$HOME/.bashrc"
|
|
63
|
+
else
|
|
64
|
+
rcfile="$HOME/.profile"
|
|
65
|
+
fi
|
|
66
|
+
|
|
67
|
+
# Check if dir is already in PATH
|
|
68
|
+
if echo "$PATH" | tr ':' '\n' | grep -qx "$dir"; then
|
|
69
|
+
return 0
|
|
70
|
+
fi
|
|
71
|
+
|
|
72
|
+
# Check if already added in RC
|
|
73
|
+
if [ -f "$rcfile" ] && grep -q "$dir" "$rcfile" 2>/dev/null; then
|
|
74
|
+
return 0
|
|
75
|
+
fi
|
|
76
|
+
|
|
77
|
+
# Add to RC
|
|
78
|
+
echo "" >> "$rcfile"
|
|
79
|
+
echo "# Added by ai-first-cli installer" >> "$rcfile"
|
|
80
|
+
echo "export PATH=\"$dir:\$PATH\"" >> "$rcfile"
|
|
81
|
+
|
|
82
|
+
log_warn "Added $dir to PATH in $rcfile"
|
|
83
|
+
log_warn "Run: source $rcfile"
|
|
84
|
+
}
|
|
15
85
|
|
|
16
86
|
check_node() {
|
|
17
87
|
if ! command -v node &> /dev/null; then
|
|
18
|
-
log_error "Node.js not installed. Install Node.js 18+ first."
|
|
88
|
+
log_error "Node.js not installed. Install Node.js 18+ first: https://nodejs.org"
|
|
19
89
|
exit 1
|
|
20
90
|
fi
|
|
21
91
|
NODE_VERSION=$(node -v | cut -d'v' -f2 | cut -d'.' -f1)
|
|
@@ -27,24 +97,80 @@ check_node() {
|
|
|
27
97
|
}
|
|
28
98
|
|
|
29
99
|
install_af() {
|
|
30
|
-
|
|
31
|
-
npm install -g "
|
|
32
|
-
log_info "
|
|
100
|
+
log_step "Installing af@${AF_VERSION}..."
|
|
101
|
+
npm install -g "ai-first-cli@${AF_VERSION}" 2>&1
|
|
102
|
+
log_info "npm install completed"
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
find_af_binary() {
|
|
106
|
+
# Find the af binary in npm's global bin directory
|
|
107
|
+
local prefix
|
|
108
|
+
prefix=$(npm config get prefix --global 2>/dev/null || npm config get prefix 2>/dev/null)
|
|
109
|
+
|
|
110
|
+
if [ -n "$prefix" ] && [ -f "$prefix/bin/af" ]; then
|
|
111
|
+
echo "$prefix/bin/af"
|
|
112
|
+
return 0
|
|
113
|
+
fi
|
|
114
|
+
|
|
115
|
+
if [ -n "$prefix" ] && [ -f "$prefix/bin/ai-first" ]; then
|
|
116
|
+
echo "$prefix/bin/ai-first"
|
|
117
|
+
return 0
|
|
118
|
+
fi
|
|
119
|
+
|
|
120
|
+
# Try common locations
|
|
121
|
+
for dir in "$prefix/bin" "$HOME/.npm-global/bin" "/usr/local/bin" "$HOME/.local/bin" "$HOME/bin"; do
|
|
122
|
+
if [ -f "$dir/af" ]; then
|
|
123
|
+
echo "$dir/af"
|
|
124
|
+
return 0
|
|
125
|
+
fi
|
|
126
|
+
if [ -f "$dir/ai-first" ]; then
|
|
127
|
+
echo "$dir/ai-first"
|
|
128
|
+
return 0
|
|
129
|
+
fi
|
|
130
|
+
done
|
|
131
|
+
|
|
132
|
+
return 1
|
|
33
133
|
}
|
|
34
134
|
|
|
35
135
|
verify_install() {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
echo ""
|
|
43
|
-
log_info "Installation complete!"
|
|
44
|
-
else
|
|
45
|
-
log_error "Installation failed - af not in PATH"
|
|
136
|
+
log_step "Verifying installation..."
|
|
137
|
+
|
|
138
|
+
local af_path
|
|
139
|
+
af_path=$(find_af_binary) || {
|
|
140
|
+
log_error "Could not find af binary after installation"
|
|
141
|
+
log_error "npm prefix: $(npm config get prefix 2>/dev/null)"
|
|
46
142
|
exit 1
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
log_info "Found af at: $af_path"
|
|
146
|
+
|
|
147
|
+
# Try to create symlink in PATH
|
|
148
|
+
local symlink
|
|
149
|
+
if symlink=$(setup_symlink "$af_path"); then
|
|
150
|
+
log_info "Created symlink: $symlink"
|
|
151
|
+
else
|
|
152
|
+
log_warn "Could not create symlink in standard PATH location"
|
|
153
|
+
# Try adding the binary's directory to PATH
|
|
154
|
+
local bindir
|
|
155
|
+
bindir=$(dirname "$af_path")
|
|
156
|
+
ensure_path "$bindir"
|
|
47
157
|
fi
|
|
158
|
+
|
|
159
|
+
echo ""
|
|
160
|
+
echo " ╔══════════════════════════════════════╗"
|
|
161
|
+
echo " ║ af installation complete! ║"
|
|
162
|
+
echo " ╚══════════════════════════════════════╝"
|
|
163
|
+
echo ""
|
|
164
|
+
echo " Commands:"
|
|
165
|
+
echo " af init Initialize AI context"
|
|
166
|
+
echo " af index Generate SQLite index"
|
|
167
|
+
echo " af doctor Check repository health"
|
|
168
|
+
echo " af --help Show all commands"
|
|
169
|
+
echo ""
|
|
170
|
+
echo " Quick start:"
|
|
171
|
+
echo " af init # Generate context files"
|
|
172
|
+
echo " af doctor # Check repository health"
|
|
173
|
+
echo ""
|
|
48
174
|
}
|
|
49
175
|
|
|
50
176
|
echo ""
|
|
@@ -54,7 +180,7 @@ echo " ███████║██║ ██║ ██║ ████
|
|
|
54
180
|
echo " ██╔══██║██║ ██║ ██║ ██╔══╝ "
|
|
55
181
|
echo " ██║ ██║╚██████╔╝ ██║ ███████╗"
|
|
56
182
|
echo " ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚══════╝"
|
|
57
|
-
echo " AI-First CLI Installer"
|
|
183
|
+
echo " AI-First CLI Installer v${AF_VERSION}"
|
|
58
184
|
echo ""
|
|
59
185
|
|
|
60
186
|
check_node
|
package/package.json
CHANGED
package/run-all-tests.sh
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
#
|
|
3
|
+
# MASTER TEST SCRIPT - ai-first-cli
|
|
4
|
+
# Ejecuta TODOS los tests: unitarios + funcionales + integracion
|
|
5
|
+
#
|
|
6
|
+
|
|
7
|
+
set -e
|
|
8
|
+
|
|
9
|
+
PROJECT_ROOT="$(cd "$(dirname "$0")" && pwd)"
|
|
10
|
+
DIST_DIR="$PROJECT_ROOT/dist"
|
|
11
|
+
CLI="$DIST_DIR/commands/ai-first.js"
|
|
12
|
+
|
|
13
|
+
# Colors
|
|
14
|
+
RED='\033[0;31m'
|
|
15
|
+
GREEN='\033[0;32m'
|
|
16
|
+
YELLOW='\033[1;33m'
|
|
17
|
+
BLUE='\033[0;34m'
|
|
18
|
+
NC='\033[0m'
|
|
19
|
+
|
|
20
|
+
TESTS_PASSED=0
|
|
21
|
+
TESTS_FAILED=0
|
|
22
|
+
|
|
23
|
+
log_info() {
|
|
24
|
+
echo -e "${BLUE}[INFO]${NC} $1"
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
log_success() {
|
|
28
|
+
echo -e "${GREEN}[PASS]${NC} $1"
|
|
29
|
+
((TESTS_PASSED++))
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
log_error() {
|
|
33
|
+
echo -e "${RED}[FAIL]${NC} $1"
|
|
34
|
+
((TESTS_FAILED++))
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
# ============================================
|
|
38
|
+
# PHASE 1: BUILD
|
|
39
|
+
# ============================================
|
|
40
|
+
echo ""
|
|
41
|
+
echo "==================================================="
|
|
42
|
+
echo "PHASE 1: BUILD"
|
|
43
|
+
echo "==================================================="
|
|
44
|
+
echo ""
|
|
45
|
+
|
|
46
|
+
log_info "Building TypeScript..."
|
|
47
|
+
if npm run build > /dev/null 2>&1; then
|
|
48
|
+
log_success "TypeScript build"
|
|
49
|
+
else
|
|
50
|
+
log_error "TypeScript build FAILED"
|
|
51
|
+
exit 1
|
|
52
|
+
fi
|
|
53
|
+
|
|
54
|
+
# ============================================
|
|
55
|
+
# PHASE 2: UNIT TESTS (Vitest)
|
|
56
|
+
# ============================================
|
|
57
|
+
echo ""
|
|
58
|
+
echo "==================================================="
|
|
59
|
+
echo "PHASE 2: UNIT TESTS (Vitest)"
|
|
60
|
+
echo "==================================================="
|
|
61
|
+
echo ""
|
|
62
|
+
|
|
63
|
+
log_info "Running vitest..."
|
|
64
|
+
if npx vitest run 2>&1 | grep -q "passed"; then
|
|
65
|
+
# Extract test count
|
|
66
|
+
VITEST_OUTPUT=$(npx vitest run 2>&1)
|
|
67
|
+
TEST_COUNT=$(echo "$VITEST_OUTPUT" | grep -oE '[0-9]+ passed' | head -1 | grep -oE '[0-9]+')
|
|
68
|
+
log_success "Unit tests: $TEST_COUNT passed"
|
|
69
|
+
else
|
|
70
|
+
log_error "Unit tests FAILED"
|
|
71
|
+
fi
|
|
72
|
+
|
|
73
|
+
# ============================================
|
|
74
|
+
# PHASE 3: FUNCTIONAL TESTS
|
|
75
|
+
# ============================================
|
|
76
|
+
echo ""
|
|
77
|
+
echo "==================================================="
|
|
78
|
+
echo "PHASE 3: FUNCTIONAL TESTS (11 Adapters)"
|
|
79
|
+
echo "==================================================="
|
|
80
|
+
echo ""
|
|
81
|
+
|
|
82
|
+
ADAPTERS="django-app laravel-app fastapi-app flask-app rails-app spring-boot-app nestjs-backend express-api react-app salesforce-cli python-cli"
|
|
83
|
+
SYMBOLS_OK=0
|
|
84
|
+
|
|
85
|
+
log_info "Testing symbol extraction..."
|
|
86
|
+
for adapter in $ADAPTERS; do
|
|
87
|
+
PROJECT_DIR="$PROJECT_ROOT/test-projects/$adapter"
|
|
88
|
+
if [ -f "$PROJECT_DIR/ai-context/symbols.json" ]; then
|
|
89
|
+
SYMBOL_COUNT=$(cat "$PROJECT_DIR/ai-context/symbols.json" | grep -o '"id"' | wc -l)
|
|
90
|
+
if [ "$SYMBOL_COUNT" -gt 0 ]; then
|
|
91
|
+
((SYMBOLS_OK++))
|
|
92
|
+
log_success "$adapter: $SYMBOL_COUNT symbols"
|
|
93
|
+
else
|
|
94
|
+
log_error "$adapter: 0 symbols"
|
|
95
|
+
fi
|
|
96
|
+
else
|
|
97
|
+
log_error "$adapter: symbols.json not found"
|
|
98
|
+
fi
|
|
99
|
+
done
|
|
100
|
+
|
|
101
|
+
if [ "$SYMBOLS_OK" -eq 11 ]; then
|
|
102
|
+
log_success "All 11 adapters have symbols > 0"
|
|
103
|
+
else
|
|
104
|
+
log_error "Only $SYMBOLS_OK/11 adapters have symbols"
|
|
105
|
+
fi
|
|
106
|
+
|
|
107
|
+
# ============================================
|
|
108
|
+
# PHASE 4: INTEGRATION TESTS
|
|
109
|
+
# ============================================
|
|
110
|
+
echo ""
|
|
111
|
+
echo "==================================================="
|
|
112
|
+
echo "PHASE 4: INTEGRATION TESTS"
|
|
113
|
+
echo "==================================================="
|
|
114
|
+
echo ""
|
|
115
|
+
|
|
116
|
+
COMMANDS="init map index doctor"
|
|
117
|
+
TOTAL_TESTS=0
|
|
118
|
+
PASSED_TESTS=0
|
|
119
|
+
|
|
120
|
+
for adapter in $ADAPTERS; do
|
|
121
|
+
PROJECT_DIR="$PROJECT_ROOT/test-projects/$adapter"
|
|
122
|
+
|
|
123
|
+
for cmd in $COMMANDS; do
|
|
124
|
+
((TOTAL_TESTS++))
|
|
125
|
+
|
|
126
|
+
case $cmd in
|
|
127
|
+
"init")
|
|
128
|
+
if [ -d "$PROJECT_DIR/ai-context" ] && [ -f "$PROJECT_DIR/ai-context/symbols.json" ]; then
|
|
129
|
+
((PASSED_TESTS++))
|
|
130
|
+
else
|
|
131
|
+
log_error "$adapter: init failed"
|
|
132
|
+
fi
|
|
133
|
+
;;
|
|
134
|
+
"map")
|
|
135
|
+
if [ -f "$PROJECT_DIR/ai-context/graph/module-graph.json" ]; then
|
|
136
|
+
((PASSED_TESTS++))
|
|
137
|
+
else
|
|
138
|
+
log_error "$adapter: map failed"
|
|
139
|
+
fi
|
|
140
|
+
;;
|
|
141
|
+
"index")
|
|
142
|
+
if [ -f "$PROJECT_DIR/ai-context/index.db" ]; then
|
|
143
|
+
((PASSED_TESTS++))
|
|
144
|
+
else
|
|
145
|
+
log_error "$adapter: index failed"
|
|
146
|
+
fi
|
|
147
|
+
;;
|
|
148
|
+
"doctor")
|
|
149
|
+
if [ -f "$PROJECT_DIR/ai-context/repo_map.json" ]; then
|
|
150
|
+
((PASSED_TESTS++))
|
|
151
|
+
else
|
|
152
|
+
log_error "$adapter: doctor failed"
|
|
153
|
+
fi
|
|
154
|
+
;;
|
|
155
|
+
esac
|
|
156
|
+
done
|
|
157
|
+
done
|
|
158
|
+
|
|
159
|
+
log_info "Integration tests: $PASSED_TESTS/$TOTAL_TESTS passed"
|
|
160
|
+
if [ "$PASSED_TESTS" -eq "$TOTAL_TESTS" ]; then
|
|
161
|
+
log_success "All integration tests passed"
|
|
162
|
+
else
|
|
163
|
+
log_error "Some integration tests failed"
|
|
164
|
+
fi
|
|
165
|
+
|
|
166
|
+
# ============================================
|
|
167
|
+
# FINAL SUMMARY
|
|
168
|
+
# ============================================
|
|
169
|
+
echo ""
|
|
170
|
+
echo "==================================================="
|
|
171
|
+
echo "FINAL SUMMARY"
|
|
172
|
+
echo "==================================================="
|
|
173
|
+
echo ""
|
|
174
|
+
echo "Tests Passed: $TESTS_PASSED"
|
|
175
|
+
echo "Tests Failed: $TESTS_FAILED"
|
|
176
|
+
echo ""
|
|
177
|
+
|
|
178
|
+
if [ "$TESTS_FAILED" -eq 0 ]; then
|
|
179
|
+
echo -e "${GREEN}ALL TESTS PASSED!${NC}"
|
|
180
|
+
exit 0
|
|
181
|
+
else
|
|
182
|
+
echo -e "${RED}SOME TESTS FAILED!${NC}"
|
|
183
|
+
exit 1
|
|
184
|
+
fi
|
package/src/analyzers/symbols.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FileInfo } from "../core/repoScanner.js";
|
|
2
2
|
import { readFile } from "../utils/fileUtils.js";
|
|
3
|
+
import { parserRegistry, createSymbolFromParsed } from "../core/parsers/index.js";
|
|
3
4
|
|
|
4
5
|
export interface Symbol {
|
|
5
6
|
id: string; // Unique ID: filePath#symbolName (e.g., src/auth/login.ts#loginUser)
|
|
@@ -61,16 +62,20 @@ export function extractSymbols(files: FileInfo[]): SymbolsAnalysis {
|
|
|
61
62
|
*/
|
|
62
63
|
function parseFileForSymbols(file: FileInfo): Symbol[] {
|
|
63
64
|
const symbols: Symbol[] = [];
|
|
64
|
-
|
|
65
|
+
|
|
65
66
|
try {
|
|
66
67
|
const content = readFile(file.path);
|
|
68
|
+
|
|
69
|
+
const ext = "." + file.extension;
|
|
70
|
+
if (parserRegistry.hasParser(ext)) {
|
|
71
|
+
const parsed = parserRegistry.parse(file.relativePath, content, ext);
|
|
72
|
+
if (parsed) {
|
|
73
|
+
return createSymbolFromParsed(parsed, file.relativePath);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
67
77
|
const lines = content.split("\n");
|
|
68
|
-
|
|
69
|
-
if (file.extension === "ts" || file.extension === "tsx" || file.extension === "js" || file.extension === "jsx") {
|
|
70
|
-
parseJavaScriptTypeScript(file, content, lines, symbols);
|
|
71
|
-
} else if (file.extension === "py") {
|
|
72
|
-
parsePython(file, content, lines, symbols);
|
|
73
|
-
} else if (file.extension === "go") {
|
|
78
|
+
if (file.extension === "go") {
|
|
74
79
|
parseGo(file, content, lines, symbols);
|
|
75
80
|
} else if (file.extension === "rs") {
|
|
76
81
|
parseRust(file, content, lines, symbols);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FileInfo } from "../core/repoScanner.js";
|
|
2
2
|
import { readFile, readJsonFile } from "../utils/fileUtils.js";
|
|
3
3
|
import path from "path";
|
|
4
|
+
import fs from "fs";
|
|
4
5
|
|
|
5
6
|
export interface TechStack {
|
|
6
7
|
languages: string[];
|
|
@@ -155,9 +156,9 @@ function detectFrameworks(files: FileInfo[], fileNames: Set<string>, rootDir: st
|
|
|
155
156
|
}
|
|
156
157
|
|
|
157
158
|
/**
|
|
158
|
-
* Detect libraries
|
|
159
|
+
* Detect Node.js libraries from package.json
|
|
159
160
|
*/
|
|
160
|
-
function
|
|
161
|
+
function detectNodeLibraries(rootDir: string): string[] {
|
|
161
162
|
const libraries: string[] = [];
|
|
162
163
|
|
|
163
164
|
try {
|
|
@@ -185,7 +186,69 @@ function detectLibraries(files: FileInfo[], rootDir: string): string[] {
|
|
|
185
186
|
}
|
|
186
187
|
} catch {}
|
|
187
188
|
|
|
188
|
-
return
|
|
189
|
+
return libraries;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function detectSwiftLibraries(rootDir: string): string[] {
|
|
193
|
+
const libraries: string[] = [];
|
|
194
|
+
const packagePath = path.join(rootDir, "Package.swift");
|
|
195
|
+
|
|
196
|
+
try {
|
|
197
|
+
const content = readFile(packagePath);
|
|
198
|
+
const libMap: Record<string, string> = {
|
|
199
|
+
"Vapor": "Vapor",
|
|
200
|
+
"Fluent": "Fluent ORM",
|
|
201
|
+
"FluentPostgresDriver": "Fluent PostgreSQL",
|
|
202
|
+
"FluentMySQLDriver": "Fluent MySQL",
|
|
203
|
+
"FluentSQLiteDriver": "Fluent SQLite",
|
|
204
|
+
"FluentMongoDriver": "Fluent MongoDB",
|
|
205
|
+
"Leaf": "Leaf",
|
|
206
|
+
"APNS": "APNS",
|
|
207
|
+
"Queues": "Queues",
|
|
208
|
+
"QueuesRedisDriver": "Queues Redis",
|
|
209
|
+
"QueuesFluentDriver": "Queues Fluent",
|
|
210
|
+
"Mailgun": "Mailgun",
|
|
211
|
+
"SendGrid": "SendGrid",
|
|
212
|
+
"JWTKit": "JWTKit",
|
|
213
|
+
"Crypto": "Apple CryptoKit",
|
|
214
|
+
"NIO": "SwiftNIO",
|
|
215
|
+
"NIOSSL": "SwiftNIO SSL",
|
|
216
|
+
"NIOHTTP1": "SwiftNIO HTTP",
|
|
217
|
+
"NIOWebSocket": "SwiftNIO WebSocket",
|
|
218
|
+
"NIOTransportServices": "SwiftNIO Transport Services",
|
|
219
|
+
"AsyncHTTPClient": "AsyncHTTPClient",
|
|
220
|
+
"Alamofire": "Alamofire",
|
|
221
|
+
"Moya": "Moya",
|
|
222
|
+
"RxSwift": "RxSwift",
|
|
223
|
+
"PromiseKit": "PromiseKit",
|
|
224
|
+
"SwiftyJSON": "SwiftyJSON",
|
|
225
|
+
"ObjectMapper": "ObjectMapper",
|
|
226
|
+
"SnapKit": "SnapKit",
|
|
227
|
+
"Kingfisher": "Kingfisher",
|
|
228
|
+
"SDWebImage": "SDWebImage Swift",
|
|
229
|
+
"Lottie": "Lottie",
|
|
230
|
+
"SwiftLint": "SwiftLint",
|
|
231
|
+
"SwiftFormat": "SwiftFormat",
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
const depPattern = /\.package\s*\(\s*url:\s*"[^"]+"\s*,\s*(?:from|\.upToNextMajor|\.upToNextMinor|\.exact):\s*"[^"]+"\s*\)/g;
|
|
235
|
+
let match;
|
|
236
|
+
|
|
237
|
+
while ((match = depPattern.exec(content)) !== null) {
|
|
238
|
+
const depString = match[0];
|
|
239
|
+
const urlMatch = depString.match(/url:\s*"([^"]+)"/);
|
|
240
|
+
if (urlMatch) {
|
|
241
|
+
const url = urlMatch[1];
|
|
242
|
+
const depName = url.split("/").pop()?.replace(".git", "") || "";
|
|
243
|
+
const libName = libMap[depName] || depName;
|
|
244
|
+
if (!libraries.includes(libName)) {
|
|
245
|
+
libraries.push(libName);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
} catch {}
|
|
250
|
+
|
|
251
|
+
return libraries;
|
|
189
252
|
}
|
|
190
253
|
|
|
191
254
|
/**
|
|
@@ -386,6 +449,143 @@ function generateTechStackDescription(
|
|
|
386
449
|
return lines.join("\n\n");
|
|
387
450
|
}
|
|
388
451
|
|
|
452
|
+
function detectGradleLibraries(_files: FileInfo[], rootDir: string): string[] {
|
|
453
|
+
const libraries: string[] = [];
|
|
454
|
+
const gradleFiles: string[] = [];
|
|
455
|
+
|
|
456
|
+
function findGradleFiles(dir: string, depth: number = 0) {
|
|
457
|
+
if (depth > 3) return;
|
|
458
|
+
try {
|
|
459
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
460
|
+
for (const entry of entries) {
|
|
461
|
+
const fullPath = path.join(dir, entry.name);
|
|
462
|
+
if (entry.isDirectory() && !entry.name.startsWith('.') && entry.name !== 'node_modules') {
|
|
463
|
+
findGradleFiles(fullPath, depth + 1);
|
|
464
|
+
} else if (entry.isFile() && (entry.name === 'build.gradle' || entry.name === 'build.gradle.kts')) {
|
|
465
|
+
gradleFiles.push(fullPath);
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
} catch {}
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
findGradleFiles(rootDir);
|
|
472
|
+
|
|
473
|
+
const libMap: Record<string, string> = {
|
|
474
|
+
"androidx.core": "AndroidX Core", "androidx.appcompat": "AppCompat",
|
|
475
|
+
"com.google.android.material": "Material Design",
|
|
476
|
+
"androidx.constraintlayout": "ConstraintLayout",
|
|
477
|
+
"androidx.navigation": "Navigation", "androidx.room": "Room",
|
|
478
|
+
"org.jetbrains.kotlin": "Kotlin", "kotlinx.coroutines": "Kotlin Coroutines",
|
|
479
|
+
"com.squareup.retrofit2": "Retrofit", "com.squareup.okhttp3": "OkHttp",
|
|
480
|
+
"com.google.dagger": "Dagger", "junit": "JUnit",
|
|
481
|
+
"org.mockito": "Mockito", "com.jakewharton.timber": "Timber",
|
|
482
|
+
"com.github.bumptech.glide": "Glide", "io.coil-kt": "Coil",
|
|
483
|
+
"com.google.code.gson": "Gson",
|
|
484
|
+
};
|
|
485
|
+
|
|
486
|
+
for (const gf of gradleFiles) {
|
|
487
|
+
try {
|
|
488
|
+
const content = readFile(gf);
|
|
489
|
+
const depPattern = /(?:implementation|api|compileOnly|runtimeOnly|testImplementation|androidTestImplementation|kapt|annotationProcessor)\s*(?:\(|\s)?['"]([^'"]+)['"](?:\))?/g;
|
|
490
|
+
let match;
|
|
491
|
+
while ((match = depPattern.exec(content)) !== null) {
|
|
492
|
+
const parts = match[1].split(':');
|
|
493
|
+
if (parts.length >= 2) {
|
|
494
|
+
const libName = libMap[parts[0]] || `${parts[0]}:${parts[1]}`;
|
|
495
|
+
if (!libraries.includes(libName)) libraries.push(libName);
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
if (content.includes("com.android.application") && !libraries.includes("Android Gradle Plugin")) {
|
|
499
|
+
libraries.push("Android Gradle Plugin");
|
|
500
|
+
}
|
|
501
|
+
} catch {}
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
return libraries;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
function detectCargoLibraries(rootDir: string): string[] {
|
|
508
|
+
const libraries: string[] = [];
|
|
509
|
+
try {
|
|
510
|
+
const content = readFile(path.join(rootDir, "Cargo.toml"));
|
|
511
|
+
const libMap: Record<string, string> = {
|
|
512
|
+
tokio: "Tokio", serde: "Serde", "serde_json": "Serde JSON",
|
|
513
|
+
reqwest: "Reqwest", actix_web: "Actix Web", axum: "Axum",
|
|
514
|
+
sqlx: "SQLx", diesel: "Diesel", mongodb: "MongoDB",
|
|
515
|
+
redis: "Redis", chrono: "Chrono", regex: "Regex",
|
|
516
|
+
clap: "Clap", log: "Log", tracing: "Tracing",
|
|
517
|
+
anyhow: "Anyhow", thiserror: "ThisError", rayon: "Rayon",
|
|
518
|
+
uuid: "UUID", rand: "Rand", hyper: "Hyper",
|
|
519
|
+
};
|
|
520
|
+
const depSection = content.match(/\[dependencies\]([^\[]*)/);
|
|
521
|
+
if (depSection) {
|
|
522
|
+
const depPattern = /^(\w+)\s*=/gm;
|
|
523
|
+
let match;
|
|
524
|
+
while ((match = depPattern.exec(depSection[1])) !== null) {
|
|
525
|
+
const libName = libMap[match[1]] || match[1];
|
|
526
|
+
if (!libraries.includes(libName)) libraries.push(libName);
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
} catch {}
|
|
530
|
+
return libraries;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
function detectGoLibraries(rootDir: string): string[] {
|
|
534
|
+
const libraries: string[] = [];
|
|
535
|
+
try {
|
|
536
|
+
const content = readFile(path.join(rootDir, "go.mod"));
|
|
537
|
+
const libMap: Record<string, string> = {
|
|
538
|
+
"gin-gonic/gin": "Gin", "labstack/echo": "Echo",
|
|
539
|
+
"gorilla/mux": "Gorilla Mux", "go-chi/chi": "Chi",
|
|
540
|
+
"gofiber/fiber": "Fiber", "gorm.io/gorm": "GORM",
|
|
541
|
+
"github.com/jmoiron/sqlx": "SQLx",
|
|
542
|
+
"github.com/lib/pq": "PostgreSQL Driver",
|
|
543
|
+
"github.com/spf13/cobra": "Cobra", "github.com/spf13/viper": "Viper",
|
|
544
|
+
};
|
|
545
|
+
const requirePattern = /^\s*(\S+)\s+v?[\d\.]+/gm;
|
|
546
|
+
let match;
|
|
547
|
+
while ((match = requirePattern.exec(content)) !== null) {
|
|
548
|
+
const libName = libMap[match[1]] || match[1];
|
|
549
|
+
if (!libraries.includes(libName)) libraries.push(libName);
|
|
550
|
+
}
|
|
551
|
+
} catch {}
|
|
552
|
+
return libraries;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
function detectMavenLibraries(rootDir: string): string[] {
|
|
556
|
+
const libraries: string[] = [];
|
|
557
|
+
try {
|
|
558
|
+
const content = readFile(path.join(rootDir, "pom.xml"));
|
|
559
|
+
const libMap: Record<string, string> = {
|
|
560
|
+
"org.springframework.boot": "Spring Boot",
|
|
561
|
+
"org.springframework": "Spring Framework",
|
|
562
|
+
"org.springframework.data": "Spring Data",
|
|
563
|
+
"org.springframework.security": "Spring Security",
|
|
564
|
+
"org.springframework.cloud": "Spring Cloud",
|
|
565
|
+
};
|
|
566
|
+
const depPattern = /<dependency>\s*<groupId>([^<]+)<\/groupId>\s*<artifactId>([^<]+)<\/artifactId>/g;
|
|
567
|
+
let match;
|
|
568
|
+
while ((match = depPattern.exec(content)) !== null) {
|
|
569
|
+
const libName = libMap[match[1]] || `${match[1]}:${match[2]}`;
|
|
570
|
+
if (!libraries.includes(libName)) libraries.push(libName);
|
|
571
|
+
}
|
|
572
|
+
} catch {}
|
|
573
|
+
return libraries;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
function detectLibraries(files: FileInfo[], rootDir: string): string[] {
|
|
577
|
+
const libraries: string[] = [];
|
|
578
|
+
|
|
579
|
+
libraries.push(...detectNodeLibraries(rootDir));
|
|
580
|
+
libraries.push(...detectGradleLibraries(files, rootDir));
|
|
581
|
+
libraries.push(...detectCargoLibraries(rootDir));
|
|
582
|
+
libraries.push(...detectGoLibraries(rootDir));
|
|
583
|
+
libraries.push(...detectMavenLibraries(rootDir));
|
|
584
|
+
libraries.push(...detectSwiftLibraries(rootDir));
|
|
585
|
+
|
|
586
|
+
return [...new Set(libraries)];
|
|
587
|
+
}
|
|
588
|
+
|
|
389
589
|
/**
|
|
390
590
|
* Generate tech_stack.md content
|
|
391
591
|
*/
|