ai-first-cli 1.2.3 → 1.3.1
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/.github/workflows/publish.yml +4 -1
- 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/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.js +1 -1
- 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/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/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 +1 -1
- package/src/utils/constants.ts +78 -0
- package/test-ai-context-understanding.sh +21 -0
- package/test_adapters.mjs +11 -11
- 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/BUGS.md +0 -455
- package/PLAN_MEJORAS.md +0 -216
- package/STATUS_ADAPTADORES +0 -126
- package/TEST_RESULTS_PHASE1.md +0 -420
- package/ai/dependencies.json +0 -15
- package/ai/graph/knowledge-graph.json +0 -12
- 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 -2978
- 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 -44129
- 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 -4487
- package/ai-context/index.db +0 -0
- package/ai-context/modules.json +0 -933
- package/ai-context/project.json +0 -30
- package/ai-context/repo_map.json +0 -9116
- package/ai-context/repo_map.md +0 -2061
- package/ai-context/schema.json +0 -5
- package/ai-context/summary.md +0 -47
- package/ai-context/symbols.json +0 -65351
- package/ai-context/tech_stack.md +0 -47
- 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
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
export class AIContextGenerator {
|
|
2
|
+
generate(analysis) {
|
|
3
|
+
const enriched = this.enrichAnalysis(analysis);
|
|
4
|
+
return this.renderMarkdown(enriched);
|
|
5
|
+
}
|
|
6
|
+
enrichAnalysis(analysis) {
|
|
7
|
+
const uniqueFiles = [...new Set(analysis.symbols.map((s) => s.file))];
|
|
8
|
+
const uniqueTypes = [...new Set(analysis.symbols.map((s) => s.type))];
|
|
9
|
+
return {
|
|
10
|
+
project: {
|
|
11
|
+
name: analysis.projectName,
|
|
12
|
+
type: this.detectProjectType(analysis),
|
|
13
|
+
description: this.generateDescription(analysis),
|
|
14
|
+
},
|
|
15
|
+
architecture: {
|
|
16
|
+
pattern: analysis.architecture.primary?.name || "Unknown",
|
|
17
|
+
confidence: analysis.architecture.primary?.confidence || 0,
|
|
18
|
+
layers: analysis.architecture.layers.map((layer) => ({
|
|
19
|
+
name: layer.name,
|
|
20
|
+
components: layer.symbols.slice(0, 10),
|
|
21
|
+
responsibility: layer.responsibility,
|
|
22
|
+
})),
|
|
23
|
+
},
|
|
24
|
+
techStack: {
|
|
25
|
+
languages: this.extractLanguages(uniqueFiles),
|
|
26
|
+
frameworks: this.detectFrameworks(analysis),
|
|
27
|
+
libraries: this.detectLibraries(analysis),
|
|
28
|
+
},
|
|
29
|
+
entryPoints: analysis.architecture.entryPoints.slice(0, 5).map((ep) => ({
|
|
30
|
+
name: ep.split("#")[1] || ep,
|
|
31
|
+
file: ep.split("#")[0] || ep,
|
|
32
|
+
description: this.describeEntryPoint(ep),
|
|
33
|
+
})),
|
|
34
|
+
flows: this.extractFlows(analysis),
|
|
35
|
+
metrics: {
|
|
36
|
+
totalFiles: uniqueFiles.length,
|
|
37
|
+
totalSymbols: analysis.symbols.length,
|
|
38
|
+
totalDependencies: analysis.dependencies.totalDependencies,
|
|
39
|
+
averageComplexity: this.calculateComplexity(analysis),
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
renderMarkdown(context) {
|
|
44
|
+
return `# AI Context: ${context.project.name}
|
|
45
|
+
|
|
46
|
+
## Project Overview
|
|
47
|
+
|
|
48
|
+
**Type**: ${context.project.type}
|
|
49
|
+
**Description**: ${context.project.description}
|
|
50
|
+
|
|
51
|
+
## Architecture
|
|
52
|
+
|
|
53
|
+
### Pattern: ${context.architecture.pattern}
|
|
54
|
+
**Confidence**: ${(context.architecture.confidence * 100).toFixed(0)}%
|
|
55
|
+
|
|
56
|
+
### Layers
|
|
57
|
+
|
|
58
|
+
${context.architecture.layers
|
|
59
|
+
.map((layer) => `#### ${layer.name}
|
|
60
|
+
**Responsibility**: ${layer.responsibility}
|
|
61
|
+
|
|
62
|
+
**Key Components**:
|
|
63
|
+
${layer.components.map((c) => `- \`${c}\``).join("\n")}
|
|
64
|
+
`)
|
|
65
|
+
.join("\n")}
|
|
66
|
+
|
|
67
|
+
## Tech Stack
|
|
68
|
+
|
|
69
|
+
### Languages
|
|
70
|
+
${context.techStack.languages.map((l) => `- ${l}`).join("\n")}
|
|
71
|
+
|
|
72
|
+
### Frameworks
|
|
73
|
+
${context.techStack.frameworks.map((f) => `- ${f}`).join("\n")}
|
|
74
|
+
|
|
75
|
+
### Key Libraries
|
|
76
|
+
${context.techStack.libraries.slice(0, 10).map((l) => `- ${l}`).join("\n")}
|
|
77
|
+
|
|
78
|
+
## Entry Points
|
|
79
|
+
|
|
80
|
+
${context.entryPoints
|
|
81
|
+
.map((ep) => `### ${ep.name}
|
|
82
|
+
- **File**: \`${ep.file}\`
|
|
83
|
+
- **Description**: ${ep.description}
|
|
84
|
+
`)
|
|
85
|
+
.join("\n")}
|
|
86
|
+
|
|
87
|
+
## Business Flows
|
|
88
|
+
|
|
89
|
+
${context.flows
|
|
90
|
+
.map((flow) => `### ${flow.name}
|
|
91
|
+
${flow.description}
|
|
92
|
+
|
|
93
|
+
**Files involved**:
|
|
94
|
+
${flow.files.map((f) => `- \`${f}\``).join("\n")}
|
|
95
|
+
|
|
96
|
+
**Dependencies**:
|
|
97
|
+
${flow.dependencies.slice(0, 5).map((d) => `- ${d}`).join("\n")}
|
|
98
|
+
`)
|
|
99
|
+
.join("\n")}
|
|
100
|
+
|
|
101
|
+
## Metrics
|
|
102
|
+
|
|
103
|
+
| Metric | Value |
|
|
104
|
+
|--------|-------|
|
|
105
|
+
| Total Files | ${context.metrics.totalFiles} |
|
|
106
|
+
| Total Symbols | ${context.metrics.totalSymbols} |
|
|
107
|
+
| Total Dependencies | ${context.metrics.totalDependencies} |
|
|
108
|
+
| Average Complexity | ${context.metrics.averageComplexity.toFixed(2)} |
|
|
109
|
+
|
|
110
|
+
## Getting Started for AI
|
|
111
|
+
|
|
112
|
+
1. **Read architecture.md** for detailed structure
|
|
113
|
+
2. **Check context/flows/** for business logic understanding
|
|
114
|
+
3. **See symbols.json** for complete API reference
|
|
115
|
+
4. **Review dependencies.json** for module relationships
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
*Generated by ai-first-cli v2.0 with semantic analysis*
|
|
119
|
+
`;
|
|
120
|
+
}
|
|
121
|
+
detectProjectType(analysis) {
|
|
122
|
+
const hasControllers = analysis.symbols.some((s) => s.type === "class" && s.file.includes("controller"));
|
|
123
|
+
const hasComponents = analysis.symbols.some((s) => s.type === "class" && s.file.includes("component"));
|
|
124
|
+
const hasRoutes = analysis.symbols.some((s) => s.file.includes("route"));
|
|
125
|
+
if (hasComponents)
|
|
126
|
+
return "Frontend Application (React/Vue/Angular)";
|
|
127
|
+
if (hasControllers && hasRoutes)
|
|
128
|
+
return "REST API / Web Service";
|
|
129
|
+
if (hasControllers)
|
|
130
|
+
return "MVC Web Application";
|
|
131
|
+
return "Generic Application";
|
|
132
|
+
}
|
|
133
|
+
generateDescription(analysis) {
|
|
134
|
+
const patterns = analysis.architecture.primary
|
|
135
|
+
? [analysis.architecture.primary.name]
|
|
136
|
+
: [];
|
|
137
|
+
patterns.push(...analysis.architecture.secondary.map((s) => s.name));
|
|
138
|
+
const classes = analysis.symbols.filter((s) => s.type === "class").length;
|
|
139
|
+
const functions = analysis.symbols.filter((s) => s.type === "function").length;
|
|
140
|
+
return `A ${patterns.join(" / ")} application with ${classes} classes and ${functions} functions organized in ${analysis.architecture.layers.length} architectural layers.`;
|
|
141
|
+
}
|
|
142
|
+
extractLanguages(files) {
|
|
143
|
+
const extensions = files.map((f) => f.split(".").pop() || "");
|
|
144
|
+
const langMap = {
|
|
145
|
+
ts: "TypeScript",
|
|
146
|
+
tsx: "TypeScript (React)",
|
|
147
|
+
js: "JavaScript",
|
|
148
|
+
jsx: "JavaScript (React)",
|
|
149
|
+
py: "Python",
|
|
150
|
+
java: "Java",
|
|
151
|
+
go: "Go",
|
|
152
|
+
rs: "Rust",
|
|
153
|
+
php: "PHP",
|
|
154
|
+
rb: "Ruby",
|
|
155
|
+
};
|
|
156
|
+
return [...new Set(extensions.map((e) => langMap[e] || e).filter(Boolean))];
|
|
157
|
+
}
|
|
158
|
+
detectFrameworks(analysis) {
|
|
159
|
+
const frameworks = [];
|
|
160
|
+
const check = (pattern, name) => {
|
|
161
|
+
if (analysis.symbols.some((s) => s.name.includes(pattern) || s.file.includes(pattern.toLowerCase()))) {
|
|
162
|
+
frameworks.push(name);
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
check("Controller", "NestJS / Express");
|
|
166
|
+
check("Component", "React / Vue / Angular");
|
|
167
|
+
check("Service", "Angular / NestJS");
|
|
168
|
+
check("Model", "Django / Rails / Laravel");
|
|
169
|
+
check("View", "Django / Rails");
|
|
170
|
+
check("Route", "Express / Fastify");
|
|
171
|
+
return [...new Set(frameworks)];
|
|
172
|
+
}
|
|
173
|
+
detectLibraries(analysis) {
|
|
174
|
+
const imports = analysis.dependencies.dependencies.map((d) => d.target);
|
|
175
|
+
return [...new Set(imports)].slice(0, 20);
|
|
176
|
+
}
|
|
177
|
+
describeEntryPoint(entryPoint) {
|
|
178
|
+
const name = entryPoint.split("#")[1] || entryPoint;
|
|
179
|
+
const file = entryPoint.split("#")[0] || entryPoint;
|
|
180
|
+
if (name.toLowerCase().includes("main"))
|
|
181
|
+
return "Application entry point";
|
|
182
|
+
if (name.toLowerCase().includes("server"))
|
|
183
|
+
return "Server bootstrap";
|
|
184
|
+
if (name.toLowerCase().includes("app"))
|
|
185
|
+
return "Main application setup";
|
|
186
|
+
if (file.includes("controller"))
|
|
187
|
+
return "API endpoint handler";
|
|
188
|
+
if (file.includes("route"))
|
|
189
|
+
return "Route definition";
|
|
190
|
+
return "Entry point";
|
|
191
|
+
}
|
|
192
|
+
extractFlows(analysis) {
|
|
193
|
+
const flows = [];
|
|
194
|
+
const entryPoints = analysis.architecture.entryPoints;
|
|
195
|
+
for (const ep of entryPoints.slice(0, 5)) {
|
|
196
|
+
const epName = ep.split("#")[1] || ep;
|
|
197
|
+
const epFile = ep.split("#")[0] || ep;
|
|
198
|
+
const relatedFiles = analysis.symbols
|
|
199
|
+
.filter((s) => s.file.includes(epName.toLowerCase().replace(/controller|handler/g, "")))
|
|
200
|
+
.map((s) => s.file);
|
|
201
|
+
flows.push({
|
|
202
|
+
name: epName,
|
|
203
|
+
description: `Business flow starting at ${epName}`,
|
|
204
|
+
files: [...new Set([epFile, ...relatedFiles])].slice(0, 5),
|
|
205
|
+
dependencies: [],
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
return flows;
|
|
209
|
+
}
|
|
210
|
+
calculateComplexity(analysis) {
|
|
211
|
+
const symbolCount = analysis.symbols.length;
|
|
212
|
+
const depCount = analysis.dependencies.dependencies.length;
|
|
213
|
+
return symbolCount > 0 ? depCount / symbolCount : 0;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
export const aiContextGenerator = new AIContextGenerator();
|
|
217
|
+
//# sourceMapping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C,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,qBAAqB,EAAE,EAAE,CAAC,CAAC,CAAC;iBACvF,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YAEtB,KAAK,CAAC,IAAI,CAAC;gBACT,IAAI,EAAE,MAAM;gBACZ,WAAW,EAAE,6BAA6B,MAAM,EAAE;gBAClD,KAAK,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;gBAC1D,YAAY,EAAE,EAAE;aACjB,CAAC,CAAC;QACL,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAEO,mBAAmB,CAAC,QAG3B;QACC,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC;QAC5C,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,YAAY,CAAC,MAAM,CAAC;QAC3D,OAAO,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IACtD,CAAC;CACF;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ArchitectureAnalysis } from "../analysis/architectureDetector.js";
|
|
2
|
+
export declare class ArchitectureGenerator {
|
|
3
|
+
generate(analysis: ArchitectureAnalysis, dependencyGraph: {
|
|
4
|
+
nodes: string[];
|
|
5
|
+
edges: Array<{
|
|
6
|
+
from: string;
|
|
7
|
+
to: string;
|
|
8
|
+
type: string;
|
|
9
|
+
}>;
|
|
10
|
+
}): string;
|
|
11
|
+
private generateAsciiDiagram;
|
|
12
|
+
private generateMermaidDiagram;
|
|
13
|
+
private generateDependencyGraph;
|
|
14
|
+
private generateRecommendations;
|
|
15
|
+
}
|
|
16
|
+
export declare const architectureGenerator: ArchitectureGenerator;
|
|
17
|
+
//# sourceMappingURL=architectureGenerator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"architectureGenerator.d.ts","sourceRoot":"","sources":["../../../src/core/generation/architectureGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAE3E,qBAAa,qBAAqB;IAChC,QAAQ,CACN,QAAQ,EAAE,oBAAoB,EAC9B,eAAe,EAAE;QACf,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,KAAK,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,EAAE,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KAC1D,GACA,MAAM;IAqDT,OAAO,CAAC,oBAAoB;IAqC5B,OAAO,CAAC,sBAAsB;IA+C9B,OAAO,CAAC,uBAAuB;IAsB/B,OAAO,CAAC,uBAAuB;CA6BhC;AAED,eAAO,MAAM,qBAAqB,uBAA8B,CAAC"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
export class ArchitectureGenerator {
|
|
2
|
+
generate(analysis, dependencyGraph) {
|
|
3
|
+
return `# Architecture
|
|
4
|
+
|
|
5
|
+
## Pattern: ${analysis.primary?.name || "Unknown"}
|
|
6
|
+
|
|
7
|
+
**Confidence**: ${((analysis.primary?.confidence || 0) * 100).toFixed(0)}%
|
|
8
|
+
|
|
9
|
+
### Evidence
|
|
10
|
+
${analysis.primary?.evidence.map((e) => `- ${e}`).join("\n") || "- No strong pattern detected"}
|
|
11
|
+
|
|
12
|
+
${analysis.secondary.length > 0 ? `
|
|
13
|
+
### Secondary Patterns
|
|
14
|
+
${analysis.secondary.map((p) => `- **${p.name}** (${(p.confidence * 100).toFixed(0)}%)`).join("\n")}
|
|
15
|
+
` : ""}
|
|
16
|
+
|
|
17
|
+
## Architecture Diagram
|
|
18
|
+
|
|
19
|
+
\`\`\`
|
|
20
|
+
${this.generateAsciiDiagram(analysis)}
|
|
21
|
+
\`\`\`
|
|
22
|
+
|
|
23
|
+
## Layer Overview
|
|
24
|
+
|
|
25
|
+
| Layer | Components | Responsibility |
|
|
26
|
+
|-------|------------|----------------|
|
|
27
|
+
${analysis.layers.map((layer) => `| ${layer.name} | ${layer.symbols.length} | ${layer.responsibility} |`).join("\n")}
|
|
28
|
+
|
|
29
|
+
## Mermaid Diagram
|
|
30
|
+
|
|
31
|
+
\`\`\`mermaid
|
|
32
|
+
${this.generateMermaidDiagram(analysis, dependencyGraph)}
|
|
33
|
+
\`\`\`
|
|
34
|
+
|
|
35
|
+
## Entry Points
|
|
36
|
+
|
|
37
|
+
${analysis.entryPoints.slice(0, 10).map((ep) => `- \`${ep}\``).join("\n")}
|
|
38
|
+
|
|
39
|
+
## Module Dependencies
|
|
40
|
+
|
|
41
|
+
\`\`\`mermaid
|
|
42
|
+
graph TD
|
|
43
|
+
${this.generateDependencyGraph(dependencyGraph)}
|
|
44
|
+
\`\`\`
|
|
45
|
+
|
|
46
|
+
## Recommendations
|
|
47
|
+
|
|
48
|
+
${this.generateRecommendations(analysis)}
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
*Generated by ai-first-cli v2.0*
|
|
52
|
+
`;
|
|
53
|
+
}
|
|
54
|
+
generateAsciiDiagram(analysis) {
|
|
55
|
+
const layers = analysis.layers;
|
|
56
|
+
if (layers.length === 0)
|
|
57
|
+
return "No layers detected";
|
|
58
|
+
let diagram = "";
|
|
59
|
+
const maxWidth = 50;
|
|
60
|
+
for (let i = 0; i < layers.length; i++) {
|
|
61
|
+
const layer = layers[i];
|
|
62
|
+
const title = ` ${layer.name} `;
|
|
63
|
+
const padding = Math.max(0, (maxWidth - title.length) / 2);
|
|
64
|
+
const leftPad = "─".repeat(Math.floor(padding));
|
|
65
|
+
const rightPad = "─".repeat(Math.ceil(padding));
|
|
66
|
+
diagram += `┌${leftPad}${title}${rightPad}┐\n`;
|
|
67
|
+
const components = layer.symbols.slice(0, 3);
|
|
68
|
+
for (const component of components) {
|
|
69
|
+
const name = component.split("#")[1] || component;
|
|
70
|
+
const line = `│ • ${name.padEnd(maxWidth - 4)}│`;
|
|
71
|
+
diagram += `${line}\n`;
|
|
72
|
+
}
|
|
73
|
+
if (layer.symbols.length > 3) {
|
|
74
|
+
diagram += `│ ... and ${layer.symbols.length - 3} more${"".padEnd(maxWidth - 15)}│\n`;
|
|
75
|
+
}
|
|
76
|
+
diagram += `└${"─".repeat(maxWidth)}┘\n`;
|
|
77
|
+
if (i < layers.length - 1) {
|
|
78
|
+
diagram += `${" ".repeat(maxWidth / 2)}↓\n`;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return diagram;
|
|
82
|
+
}
|
|
83
|
+
generateMermaidDiagram(analysis, dependencyGraph) {
|
|
84
|
+
const lines = [];
|
|
85
|
+
lines.push("graph TD");
|
|
86
|
+
const subgraphs = new Map();
|
|
87
|
+
for (const layer of analysis.layers) {
|
|
88
|
+
const nodeIds = [];
|
|
89
|
+
for (const symbol of layer.symbols.slice(0, 5)) {
|
|
90
|
+
const id = symbol.replace(/[^a-zA-Z0-9]/g, "_");
|
|
91
|
+
const name = symbol.split("#")[1] || symbol;
|
|
92
|
+
nodeIds.push(id);
|
|
93
|
+
lines.push(` ${id}[${name}]`);
|
|
94
|
+
}
|
|
95
|
+
subgraphs.set(layer.name, nodeIds);
|
|
96
|
+
}
|
|
97
|
+
for (const [layerName, nodeIds] of subgraphs) {
|
|
98
|
+
if (nodeIds.length > 0) {
|
|
99
|
+
lines.push(` subgraph ${layerName}`);
|
|
100
|
+
for (const id of nodeIds) {
|
|
101
|
+
lines.push(` ${id}`);
|
|
102
|
+
}
|
|
103
|
+
lines.push(` end`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
const addedEdges = new Set();
|
|
107
|
+
for (const edge of dependencyGraph.edges.slice(0, 10)) {
|
|
108
|
+
const from = edge.from.replace(/[^a-zA-Z0-9]/g, "_");
|
|
109
|
+
const to = edge.to.replace(/[^a-zA-Z0-9]/g, "_");
|
|
110
|
+
const edgeKey = `${from}-->${to}`;
|
|
111
|
+
if (!addedEdges.has(edgeKey)) {
|
|
112
|
+
lines.push(` ${from}-->${to}`);
|
|
113
|
+
addedEdges.add(edgeKey);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return lines.join("\n");
|
|
117
|
+
}
|
|
118
|
+
generateDependencyGraph(dependencyGraph) {
|
|
119
|
+
const lines = [];
|
|
120
|
+
const added = new Set();
|
|
121
|
+
for (const edge of dependencyGraph.edges.slice(0, 15)) {
|
|
122
|
+
const from = edge.from.replace(/[^a-zA-Z0-9]/g, "_");
|
|
123
|
+
const to = edge.to.replace(/[^a-zA-Z0-9]/g, "_");
|
|
124
|
+
const key = `${from}-->${to}`;
|
|
125
|
+
if (!added.has(key)) {
|
|
126
|
+
const label = edge.type === "import" ? "" : `|${edge.type}|`;
|
|
127
|
+
lines.push(` ${from}[${edge.from}] -->${label} ${to}[${edge.to}]`);
|
|
128
|
+
added.add(key);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
return lines.join("\n");
|
|
132
|
+
}
|
|
133
|
+
generateRecommendations(analysis) {
|
|
134
|
+
const recommendations = [];
|
|
135
|
+
if (!analysis.primary) {
|
|
136
|
+
recommendations.push("- Consider adopting a well-defined architectural pattern");
|
|
137
|
+
}
|
|
138
|
+
if (analysis.layers.length === 0) {
|
|
139
|
+
recommendations.push("- No clear layer separation detected. Consider organizing code into layers");
|
|
140
|
+
}
|
|
141
|
+
else if (analysis.layers.length < 3) {
|
|
142
|
+
recommendations.push("- Consider adding more separation of concerns (currently only " + analysis.layers.length + " layers)");
|
|
143
|
+
}
|
|
144
|
+
if (analysis.entryPoints.length === 0) {
|
|
145
|
+
recommendations.push("- No clear entry points found. Define main functions or controllers");
|
|
146
|
+
}
|
|
147
|
+
else if (analysis.entryPoints.length > 10) {
|
|
148
|
+
recommendations.push("- Many entry points detected. Consider consolidating");
|
|
149
|
+
}
|
|
150
|
+
if (analysis.secondary.length > 2) {
|
|
151
|
+
recommendations.push("- Multiple patterns detected. Consider simplifying architecture");
|
|
152
|
+
}
|
|
153
|
+
if (recommendations.length === 0) {
|
|
154
|
+
return "- Architecture looks well-structured. Keep the consistency as the project grows.";
|
|
155
|
+
}
|
|
156
|
+
return recommendations.join("\n");
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
export const architectureGenerator = new ArchitectureGenerator();
|
|
160
|
+
//# sourceMappingURL=architectureGenerator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"architectureGenerator.js","sourceRoot":"","sources":["../../../src/core/generation/architectureGenerator.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,qBAAqB;IAChC,QAAQ,CACN,QAA8B,EAC9B,eAGC;QAED,OAAO;;cAEG,QAAQ,CAAC,OAAO,EAAE,IAAI,IAAI,SAAS;;kBAE/B,CAAC,CAAC,QAAQ,CAAC,OAAO,EAAE,UAAU,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;;;EAGtE,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,8BAA8B;;EAE5F,QAAQ,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;;EAEhC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,UAAU,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,I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AAI,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;CACF;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,qBAAqB,EAAE,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export interface EnrichedFlow {
|
|
2
|
+
name: string;
|
|
3
|
+
entrypoint: string;
|
|
4
|
+
type: string;
|
|
5
|
+
responsibility: string;
|
|
6
|
+
files: Array<{
|
|
7
|
+
path: string;
|
|
8
|
+
responsibility: string;
|
|
9
|
+
symbols: string[];
|
|
10
|
+
}>;
|
|
11
|
+
layers: string[];
|
|
12
|
+
dependencies: {
|
|
13
|
+
imports: string[];
|
|
14
|
+
calls: string[];
|
|
15
|
+
implementsInterfaces: string[];
|
|
16
|
+
};
|
|
17
|
+
complexity: "low" | "medium" | "high";
|
|
18
|
+
depth: number;
|
|
19
|
+
}
|
|
20
|
+
export declare class FlowGenerator {
|
|
21
|
+
generateFlows(entryPoints: string[], symbols: Array<{
|
|
22
|
+
id: string;
|
|
23
|
+
name: string;
|
|
24
|
+
type: string;
|
|
25
|
+
file: string;
|
|
26
|
+
}>, dependencyGraph: {
|
|
27
|
+
edges: Array<{
|
|
28
|
+
from: string;
|
|
29
|
+
to: string;
|
|
30
|
+
type: string;
|
|
31
|
+
}>;
|
|
32
|
+
}, callGraph: {
|
|
33
|
+
edges: Array<{
|
|
34
|
+
caller: string;
|
|
35
|
+
callee: string;
|
|
36
|
+
}>;
|
|
37
|
+
}, inheritanceGraph: {
|
|
38
|
+
edges: Array<{
|
|
39
|
+
child: string;
|
|
40
|
+
parent: string;
|
|
41
|
+
type: string;
|
|
42
|
+
}>;
|
|
43
|
+
}): EnrichedFlow[];
|
|
44
|
+
private analyzeFlow;
|
|
45
|
+
private detectLayer;
|
|
46
|
+
private classifyFlowType;
|
|
47
|
+
private inferResponsibility;
|
|
48
|
+
private describeFile;
|
|
49
|
+
private calculateComplexity;
|
|
50
|
+
}
|
|
51
|
+
export declare const flowGenerator: FlowGenerator;
|
|
52
|
+
//# sourceMappingURL=flowGenerator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flowGenerator.d.ts","sourceRoot":"","sources":["../../../src/core/generation/flowGenerator.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,KAAK,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,cAAc,EAAE,MAAM,CAAC;QACvB,OAAO,EAAE,MAAM,EAAE,CAAC;KACnB,CAAC,CAAC;IACH,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,YAAY,EAAE;QACZ,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,oBAAoB,EAAE,MAAM,EAAE,CAAC;KAChC,CAAC;IACF,UAAU,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IACtC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,qBAAa,aAAa;IACxB,aAAa,CACX,WAAW,EAAE,MAAM,EAAE,EACrB,OAAO,EAAE,KAAK,CAAC;QACb,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACd,CAAC,EACF,eAAe,EAAE;QACf,KAAK,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,EAAE,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KAC1D,EACD,SAAS,EAAE;QACT,KAAK,EAAE,KAAK,CAAC;YAAE,MAAM,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KAClD,EACD,gBAAgB,EAAE;QAChB,KAAK,EAAE,KAAK,CAAC;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KAC/D,GACA,YAAY,EAAE;IAiBjB,OAAO,CAAC,WAAW;IAuFnB,OAAO,CAAC,WAAW;IAsCnB,OAAO,CAAC,gBAAgB;IAoBxB,OAAO,CAAC,mBAAmB;IAgB3B,OAAO,CAAC,YAAY;IAWpB,OAAO,CAAC,mBAAmB;CAQ5B;AAED,eAAO,MAAM,aAAa,eAAsB,CAAC"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
export class FlowGenerator {
|
|
2
|
+
generateFlows(entryPoints, symbols, dependencyGraph, callGraph, inheritanceGraph) {
|
|
3
|
+
const flows = [];
|
|
4
|
+
for (const entryPoint of entryPoints) {
|
|
5
|
+
const flow = this.analyzeFlow(entryPoint, symbols, dependencyGraph, callGraph, inheritanceGraph);
|
|
6
|
+
flows.push(flow);
|
|
7
|
+
}
|
|
8
|
+
return flows;
|
|
9
|
+
}
|
|
10
|
+
analyzeFlow(entryPoint, symbols, dependencyGraph, callGraph, inheritanceGraph) {
|
|
11
|
+
const entrySymbol = symbols.find((s) => s.id === entryPoint);
|
|
12
|
+
const visited = new Set();
|
|
13
|
+
const files = new Map();
|
|
14
|
+
const layers = new Set();
|
|
15
|
+
const traverse = (symbolId, depth = 0) => {
|
|
16
|
+
if (visited.has(symbolId) || depth > 10)
|
|
17
|
+
return;
|
|
18
|
+
visited.add(symbolId);
|
|
19
|
+
const symbol = symbols.find((s) => s.id === symbolId);
|
|
20
|
+
if (symbol) {
|
|
21
|
+
const fileSymbols = files.get(symbol.file) || [];
|
|
22
|
+
fileSymbols.push(symbol.name);
|
|
23
|
+
files.set(symbol.file, fileSymbols);
|
|
24
|
+
const layer = this.detectLayer(symbol);
|
|
25
|
+
if (layer)
|
|
26
|
+
layers.add(layer);
|
|
27
|
+
}
|
|
28
|
+
const outgoingCalls = callGraph.edges.filter((e) => e.caller === symbolId);
|
|
29
|
+
for (const call of outgoingCalls) {
|
|
30
|
+
traverse(call.callee, depth + 1);
|
|
31
|
+
}
|
|
32
|
+
const outgoingDeps = dependencyGraph.edges.filter((e) => e.from === symbolId && e.type === "import");
|
|
33
|
+
for (const dep of outgoingDeps) {
|
|
34
|
+
if (symbols.some((s) => s.id === dep.to)) {
|
|
35
|
+
traverse(dep.to, depth + 1);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
traverse(entryPoint);
|
|
40
|
+
const imports = dependencyGraph.edges
|
|
41
|
+
.filter((e) => e.from === entryPoint && e.type === "import")
|
|
42
|
+
.map((e) => e.to);
|
|
43
|
+
const calls = callGraph.edges
|
|
44
|
+
.filter((e) => e.caller === entryPoint)
|
|
45
|
+
.map((e) => e.callee);
|
|
46
|
+
const implementsInterfaces = inheritanceGraph.edges
|
|
47
|
+
.filter((e) => e.child === entryPoint && e.type === "implements")
|
|
48
|
+
.map((e) => e.parent);
|
|
49
|
+
return {
|
|
50
|
+
name: entrySymbol?.name || entryPoint.split("#")[1] || "unknown",
|
|
51
|
+
entrypoint: entryPoint,
|
|
52
|
+
type: this.classifyFlowType(entrySymbol),
|
|
53
|
+
responsibility: this.inferResponsibility(entrySymbol),
|
|
54
|
+
files: Array.from(files.entries()).map(([path, syms]) => ({
|
|
55
|
+
path,
|
|
56
|
+
responsibility: this.describeFile(path, syms),
|
|
57
|
+
symbols: syms,
|
|
58
|
+
})),
|
|
59
|
+
layers: Array.from(layers),
|
|
60
|
+
dependencies: {
|
|
61
|
+
imports: [...new Set(imports)],
|
|
62
|
+
calls: [...new Set(calls)],
|
|
63
|
+
implementsInterfaces: [...new Set(implementsInterfaces)],
|
|
64
|
+
},
|
|
65
|
+
complexity: this.calculateComplexity(visited.size, files.size),
|
|
66
|
+
depth: visited.size,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
detectLayer(symbol) {
|
|
70
|
+
const name = symbol.name.toLowerCase();
|
|
71
|
+
const file = symbol.file.toLowerCase();
|
|
72
|
+
if (name.includes("controller") ||
|
|
73
|
+
name.includes("route") ||
|
|
74
|
+
name.includes("handler") ||
|
|
75
|
+
file.includes("controller") ||
|
|
76
|
+
file.includes("routes")) {
|
|
77
|
+
return "api";
|
|
78
|
+
}
|
|
79
|
+
if (name.includes("service") ||
|
|
80
|
+
name.includes("usecase") ||
|
|
81
|
+
file.includes("service") ||
|
|
82
|
+
file.includes("usecase")) {
|
|
83
|
+
return "service";
|
|
84
|
+
}
|
|
85
|
+
if (name.includes("repository") ||
|
|
86
|
+
name.includes("model") ||
|
|
87
|
+
file.includes("repository") ||
|
|
88
|
+
file.includes("model")) {
|
|
89
|
+
return "data";
|
|
90
|
+
}
|
|
91
|
+
if (name.includes("component") || file.includes("component")) {
|
|
92
|
+
return "ui";
|
|
93
|
+
}
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
classifyFlowType(symbol) {
|
|
97
|
+
if (!symbol)
|
|
98
|
+
return "unknown";
|
|
99
|
+
const name = symbol.name.toLowerCase();
|
|
100
|
+
if (name.includes("auth"))
|
|
101
|
+
return "Authentication Flow";
|
|
102
|
+
if (name.includes("user"))
|
|
103
|
+
return "User Management Flow";
|
|
104
|
+
if (name.includes("payment"))
|
|
105
|
+
return "Payment Processing Flow";
|
|
106
|
+
if (name.includes("order"))
|
|
107
|
+
return "Order Processing Flow";
|
|
108
|
+
if (name.includes("notification"))
|
|
109
|
+
return "Notification Flow";
|
|
110
|
+
if (name.includes("report"))
|
|
111
|
+
return "Reporting Flow";
|
|
112
|
+
if (symbol.type === "function")
|
|
113
|
+
return "API Endpoint";
|
|
114
|
+
if (symbol.type === "class")
|
|
115
|
+
return "Service Handler";
|
|
116
|
+
return "Business Flow";
|
|
117
|
+
}
|
|
118
|
+
inferResponsibility(symbol) {
|
|
119
|
+
if (!symbol)
|
|
120
|
+
return "Unknown responsibility";
|
|
121
|
+
const name = symbol.name.toLowerCase();
|
|
122
|
+
if (name.includes("create"))
|
|
123
|
+
return "Creation and initialization";
|
|
124
|
+
if (name.includes("get") || name.includes("find"))
|
|
125
|
+
return "Data retrieval";
|
|
126
|
+
if (name.includes("update"))
|
|
127
|
+
return "Data modification";
|
|
128
|
+
if (name.includes("delete") || name.includes("remove"))
|
|
129
|
+
return "Data deletion";
|
|
130
|
+
if (name.includes("validate"))
|
|
131
|
+
return "Data validation";
|
|
132
|
+
if (name.includes("process"))
|
|
133
|
+
return "Business logic processing";
|
|
134
|
+
if (name.includes("handle"))
|
|
135
|
+
return "Event/request handling";
|
|
136
|
+
return `Manages ${symbol.name} operations`;
|
|
137
|
+
}
|
|
138
|
+
describeFile(path, symbols) {
|
|
139
|
+
if (path.includes("controller"))
|
|
140
|
+
return "API endpoint definitions";
|
|
141
|
+
if (path.includes("service"))
|
|
142
|
+
return "Business logic implementation";
|
|
143
|
+
if (path.includes("repository"))
|
|
144
|
+
return "Data access layer";
|
|
145
|
+
if (path.includes("model"))
|
|
146
|
+
return "Data models and entities";
|
|
147
|
+
if (path.includes("route"))
|
|
148
|
+
return "URL routing configuration";
|
|
149
|
+
if (path.includes("middleware"))
|
|
150
|
+
return "Request/response middleware";
|
|
151
|
+
if (path.includes("component"))
|
|
152
|
+
return "UI component";
|
|
153
|
+
return `Contains ${symbols.length} symbols`;
|
|
154
|
+
}
|
|
155
|
+
calculateComplexity(symbolCount, fileCount) {
|
|
156
|
+
if (symbolCount < 5 && fileCount <= 2)
|
|
157
|
+
return "low";
|
|
158
|
+
if (symbolCount > 15 || fileCount > 5)
|
|
159
|
+
return "high";
|
|
160
|
+
return "medium";
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
export const flowGenerator = new FlowGenerator();
|
|
164
|
+
//# sourceMappingURL=flowGenerator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flowGenerator.js","sourceRoot":"","sources":["../../../src/core/generation/flowGenerator.ts"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