universal-agent-protocol 0.5.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/LICENSE +21 -0
- package/README.md +462 -0
- package/dist/analyzers/index.d.ts +3 -0
- package/dist/analyzers/index.d.ts.map +1 -0
- package/dist/analyzers/index.js +656 -0
- package/dist/analyzers/index.js.map +1 -0
- package/dist/bin/cli.d.ts +3 -0
- package/dist/bin/cli.d.ts.map +1 -0
- package/dist/bin/cli.js +506 -0
- package/dist/bin/cli.js.map +1 -0
- package/dist/bin/tool-calls.d.ts +3 -0
- package/dist/bin/tool-calls.d.ts.map +1 -0
- package/dist/bin/tool-calls.js +4 -0
- package/dist/bin/tool-calls.js.map +1 -0
- package/dist/cli/agent.d.ts +20 -0
- package/dist/cli/agent.d.ts.map +1 -0
- package/dist/cli/agent.js +434 -0
- package/dist/cli/agent.js.map +1 -0
- package/dist/cli/analyze.d.ts +7 -0
- package/dist/cli/analyze.d.ts.map +1 -0
- package/dist/cli/analyze.js +103 -0
- package/dist/cli/analyze.js.map +1 -0
- package/dist/cli/coord.d.ts +7 -0
- package/dist/cli/coord.d.ts.map +1 -0
- package/dist/cli/coord.js +138 -0
- package/dist/cli/coord.js.map +1 -0
- package/dist/cli/dashboard.d.ts +8 -0
- package/dist/cli/dashboard.d.ts.map +1 -0
- package/dist/cli/dashboard.js +704 -0
- package/dist/cli/dashboard.js.map +1 -0
- package/dist/cli/deploy.d.ts +19 -0
- package/dist/cli/deploy.d.ts.map +1 -0
- package/dist/cli/deploy.js +267 -0
- package/dist/cli/deploy.js.map +1 -0
- package/dist/cli/droids.d.ts +9 -0
- package/dist/cli/droids.d.ts.map +1 -0
- package/dist/cli/droids.js +227 -0
- package/dist/cli/droids.js.map +1 -0
- package/dist/cli/generate.d.ts +17 -0
- package/dist/cli/generate.d.ts.map +1 -0
- package/dist/cli/generate.js +432 -0
- package/dist/cli/generate.js.map +1 -0
- package/dist/cli/hooks.d.ts +9 -0
- package/dist/cli/hooks.d.ts.map +1 -0
- package/dist/cli/hooks.js +374 -0
- package/dist/cli/hooks.js.map +1 -0
- package/dist/cli/init.d.ts +11 -0
- package/dist/cli/init.d.ts.map +1 -0
- package/dist/cli/init.js +316 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/mcp-router.d.ts +16 -0
- package/dist/cli/mcp-router.d.ts.map +1 -0
- package/dist/cli/mcp-router.js +143 -0
- package/dist/cli/mcp-router.js.map +1 -0
- package/dist/cli/memory.d.ts +24 -0
- package/dist/cli/memory.d.ts.map +1 -0
- package/dist/cli/memory.js +877 -0
- package/dist/cli/memory.js.map +1 -0
- package/dist/cli/model.d.ts +15 -0
- package/dist/cli/model.d.ts.map +1 -0
- package/dist/cli/model.js +270 -0
- package/dist/cli/model.js.map +1 -0
- package/dist/cli/patterns.d.ts +26 -0
- package/dist/cli/patterns.d.ts.map +1 -0
- package/dist/cli/patterns.js +587 -0
- package/dist/cli/patterns.js.map +1 -0
- package/dist/cli/setup-mcp-router.d.ts +8 -0
- package/dist/cli/setup-mcp-router.d.ts.map +1 -0
- package/dist/cli/setup-mcp-router.js +163 -0
- package/dist/cli/setup-mcp-router.js.map +1 -0
- package/dist/cli/setup.d.ts +13 -0
- package/dist/cli/setup.d.ts.map +1 -0
- package/dist/cli/setup.js +146 -0
- package/dist/cli/setup.js.map +1 -0
- package/dist/cli/sync.d.ts +7 -0
- package/dist/cli/sync.d.ts.map +1 -0
- package/dist/cli/sync.js +26 -0
- package/dist/cli/sync.js.map +1 -0
- package/dist/cli/task.d.ts +33 -0
- package/dist/cli/task.d.ts.map +1 -0
- package/dist/cli/task.js +616 -0
- package/dist/cli/task.js.map +1 -0
- package/dist/cli/tool-calls.d.ts +8 -0
- package/dist/cli/tool-calls.d.ts.map +1 -0
- package/dist/cli/tool-calls.js +239 -0
- package/dist/cli/tool-calls.js.map +1 -0
- package/dist/cli/update.d.ts +10 -0
- package/dist/cli/update.d.ts.map +1 -0
- package/dist/cli/update.js +300 -0
- package/dist/cli/update.js.map +1 -0
- package/dist/cli/visualize.d.ts +77 -0
- package/dist/cli/visualize.d.ts.map +1 -0
- package/dist/cli/visualize.js +287 -0
- package/dist/cli/visualize.js.map +1 -0
- package/dist/cli/worktree.d.ts +9 -0
- package/dist/cli/worktree.d.ts.map +1 -0
- package/dist/cli/worktree.js +175 -0
- package/dist/cli/worktree.js.map +1 -0
- package/dist/coordination/capability-router.d.ts +79 -0
- package/dist/coordination/capability-router.d.ts.map +1 -0
- package/dist/coordination/capability-router.js +324 -0
- package/dist/coordination/capability-router.js.map +1 -0
- package/dist/coordination/database.d.ts +13 -0
- package/dist/coordination/database.d.ts.map +1 -0
- package/dist/coordination/database.js +131 -0
- package/dist/coordination/database.js.map +1 -0
- package/dist/coordination/deploy-batcher.d.ts +101 -0
- package/dist/coordination/deploy-batcher.d.ts.map +1 -0
- package/dist/coordination/deploy-batcher.js +565 -0
- package/dist/coordination/deploy-batcher.js.map +1 -0
- package/dist/coordination/index.d.ts +5 -0
- package/dist/coordination/index.d.ts.map +1 -0
- package/dist/coordination/index.js +5 -0
- package/dist/coordination/index.js.map +1 -0
- package/dist/coordination/service.d.ts +81 -0
- package/dist/coordination/service.d.ts.map +1 -0
- package/dist/coordination/service.js +603 -0
- package/dist/coordination/service.js.map +1 -0
- package/dist/generators/claude-md.d.ts +3 -0
- package/dist/generators/claude-md.d.ts.map +1 -0
- package/dist/generators/claude-md.js +977 -0
- package/dist/generators/claude-md.js.map +1 -0
- package/dist/generators/template-loader.d.ts +105 -0
- package/dist/generators/template-loader.d.ts.map +1 -0
- package/dist/generators/template-loader.js +291 -0
- package/dist/generators/template-loader.js.map +1 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +59 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-router/config/parser.d.ts +9 -0
- package/dist/mcp-router/config/parser.d.ts.map +1 -0
- package/dist/mcp-router/config/parser.js +174 -0
- package/dist/mcp-router/config/parser.js.map +1 -0
- package/dist/mcp-router/executor/client.d.ts +31 -0
- package/dist/mcp-router/executor/client.d.ts.map +1 -0
- package/dist/mcp-router/executor/client.js +187 -0
- package/dist/mcp-router/executor/client.js.map +1 -0
- package/dist/mcp-router/index.d.ts +22 -0
- package/dist/mcp-router/index.d.ts.map +1 -0
- package/dist/mcp-router/index.js +18 -0
- package/dist/mcp-router/index.js.map +1 -0
- package/dist/mcp-router/output-compressor.d.ts +26 -0
- package/dist/mcp-router/output-compressor.d.ts.map +1 -0
- package/dist/mcp-router/output-compressor.js +236 -0
- package/dist/mcp-router/output-compressor.js.map +1 -0
- package/dist/mcp-router/search/fuzzy.d.ts +26 -0
- package/dist/mcp-router/search/fuzzy.d.ts.map +1 -0
- package/dist/mcp-router/search/fuzzy.js +94 -0
- package/dist/mcp-router/search/fuzzy.js.map +1 -0
- package/dist/mcp-router/server.d.ts +50 -0
- package/dist/mcp-router/server.d.ts.map +1 -0
- package/dist/mcp-router/server.js +229 -0
- package/dist/mcp-router/server.js.map +1 -0
- package/dist/mcp-router/session-stats.d.ts +37 -0
- package/dist/mcp-router/session-stats.d.ts.map +1 -0
- package/dist/mcp-router/session-stats.js +56 -0
- package/dist/mcp-router/session-stats.js.map +1 -0
- package/dist/mcp-router/tools/discover.d.ts +37 -0
- package/dist/mcp-router/tools/discover.d.ts.map +1 -0
- package/dist/mcp-router/tools/discover.js +65 -0
- package/dist/mcp-router/tools/discover.js.map +1 -0
- package/dist/mcp-router/tools/execute.d.ts +43 -0
- package/dist/mcp-router/tools/execute.d.ts.map +1 -0
- package/dist/mcp-router/tools/execute.js +103 -0
- package/dist/mcp-router/tools/execute.js.map +1 -0
- package/dist/mcp-router/types.d.ts +62 -0
- package/dist/mcp-router/types.d.ts.map +1 -0
- package/dist/mcp-router/types.js +6 -0
- package/dist/mcp-router/types.js.map +1 -0
- package/dist/memory/adaptive-context.d.ts +146 -0
- package/dist/memory/adaptive-context.d.ts.map +1 -0
- package/dist/memory/adaptive-context.js +1022 -0
- package/dist/memory/adaptive-context.js.map +1 -0
- package/dist/memory/agent-scoped-memory.d.ts +67 -0
- package/dist/memory/agent-scoped-memory.d.ts.map +1 -0
- package/dist/memory/agent-scoped-memory.js +126 -0
- package/dist/memory/agent-scoped-memory.js.map +1 -0
- package/dist/memory/backends/base.d.ts +18 -0
- package/dist/memory/backends/base.d.ts.map +1 -0
- package/dist/memory/backends/base.js +2 -0
- package/dist/memory/backends/base.js.map +1 -0
- package/dist/memory/backends/factory.d.ts +4 -0
- package/dist/memory/backends/factory.d.ts.map +1 -0
- package/dist/memory/backends/factory.js +53 -0
- package/dist/memory/backends/factory.js.map +1 -0
- package/dist/memory/backends/github.d.ts +22 -0
- package/dist/memory/backends/github.d.ts.map +1 -0
- package/dist/memory/backends/github.js +118 -0
- package/dist/memory/backends/github.js.map +1 -0
- package/dist/memory/backends/qdrant-cloud.d.ts +32 -0
- package/dist/memory/backends/qdrant-cloud.d.ts.map +1 -0
- package/dist/memory/backends/qdrant-cloud.js +168 -0
- package/dist/memory/backends/qdrant-cloud.js.map +1 -0
- package/dist/memory/context-compressor.d.ts +74 -0
- package/dist/memory/context-compressor.d.ts.map +1 -0
- package/dist/memory/context-compressor.js +289 -0
- package/dist/memory/context-compressor.js.map +1 -0
- package/dist/memory/correction-propagator.d.ts +44 -0
- package/dist/memory/correction-propagator.d.ts.map +1 -0
- package/dist/memory/correction-propagator.js +156 -0
- package/dist/memory/correction-propagator.js.map +1 -0
- package/dist/memory/daily-log.d.ts +67 -0
- package/dist/memory/daily-log.d.ts.map +1 -0
- package/dist/memory/daily-log.js +143 -0
- package/dist/memory/daily-log.js.map +1 -0
- package/dist/memory/dynamic-retrieval.d.ts +110 -0
- package/dist/memory/dynamic-retrieval.d.ts.map +1 -0
- package/dist/memory/dynamic-retrieval.js +688 -0
- package/dist/memory/dynamic-retrieval.js.map +1 -0
- package/dist/memory/embeddings.d.ts +116 -0
- package/dist/memory/embeddings.d.ts.map +1 -0
- package/dist/memory/embeddings.js +461 -0
- package/dist/memory/embeddings.js.map +1 -0
- package/dist/memory/hierarchical-memory.d.ts +141 -0
- package/dist/memory/hierarchical-memory.d.ts.map +1 -0
- package/dist/memory/hierarchical-memory.js +477 -0
- package/dist/memory/hierarchical-memory.js.map +1 -0
- package/dist/memory/memory-consolidator.d.ts +124 -0
- package/dist/memory/memory-consolidator.d.ts.map +1 -0
- package/dist/memory/memory-consolidator.js +514 -0
- package/dist/memory/memory-consolidator.js.map +1 -0
- package/dist/memory/memory-maintenance.d.ts +39 -0
- package/dist/memory/memory-maintenance.d.ts.map +1 -0
- package/dist/memory/memory-maintenance.js +305 -0
- package/dist/memory/memory-maintenance.js.map +1 -0
- package/dist/memory/model-router.d.ts +102 -0
- package/dist/memory/model-router.d.ts.map +1 -0
- package/dist/memory/model-router.js +448 -0
- package/dist/memory/model-router.js.map +1 -0
- package/dist/memory/multi-view-memory.d.ts +134 -0
- package/dist/memory/multi-view-memory.d.ts.map +1 -0
- package/dist/memory/multi-view-memory.js +420 -0
- package/dist/memory/multi-view-memory.js.map +1 -0
- package/dist/memory/prepopulate.d.ts +76 -0
- package/dist/memory/prepopulate.d.ts.map +1 -0
- package/dist/memory/prepopulate.js +815 -0
- package/dist/memory/prepopulate.js.map +1 -0
- package/dist/memory/semantic-compression.d.ts +77 -0
- package/dist/memory/semantic-compression.d.ts.map +1 -0
- package/dist/memory/semantic-compression.js +348 -0
- package/dist/memory/semantic-compression.js.map +1 -0
- package/dist/memory/serverless-qdrant.d.ts +102 -0
- package/dist/memory/serverless-qdrant.d.ts.map +1 -0
- package/dist/memory/serverless-qdrant.js +369 -0
- package/dist/memory/serverless-qdrant.js.map +1 -0
- package/dist/memory/short-term/factory.d.ts +26 -0
- package/dist/memory/short-term/factory.d.ts.map +1 -0
- package/dist/memory/short-term/factory.js +28 -0
- package/dist/memory/short-term/factory.js.map +1 -0
- package/dist/memory/short-term/indexeddb.d.ts +25 -0
- package/dist/memory/short-term/indexeddb.d.ts.map +1 -0
- package/dist/memory/short-term/indexeddb.js +64 -0
- package/dist/memory/short-term/indexeddb.js.map +1 -0
- package/dist/memory/short-term/schema.d.ts +6 -0
- package/dist/memory/short-term/schema.d.ts.map +1 -0
- package/dist/memory/short-term/schema.js +119 -0
- package/dist/memory/short-term/schema.js.map +1 -0
- package/dist/memory/short-term/sqlite.d.ts +50 -0
- package/dist/memory/short-term/sqlite.d.ts.map +1 -0
- package/dist/memory/short-term/sqlite.js +221 -0
- package/dist/memory/short-term/sqlite.js.map +1 -0
- package/dist/memory/speculative-cache.d.ts +111 -0
- package/dist/memory/speculative-cache.d.ts.map +1 -0
- package/dist/memory/speculative-cache.js +409 -0
- package/dist/memory/speculative-cache.js.map +1 -0
- package/dist/memory/task-classifier.d.ts +34 -0
- package/dist/memory/task-classifier.d.ts.map +1 -0
- package/dist/memory/task-classifier.js +300 -0
- package/dist/memory/task-classifier.js.map +1 -0
- package/dist/memory/terminal-bench-knowledge.d.ts +48 -0
- package/dist/memory/terminal-bench-knowledge.d.ts.map +1 -0
- package/dist/memory/terminal-bench-knowledge.js +399 -0
- package/dist/memory/terminal-bench-knowledge.js.map +1 -0
- package/dist/memory/write-gate.d.ts +39 -0
- package/dist/memory/write-gate.d.ts.map +1 -0
- package/dist/memory/write-gate.js +190 -0
- package/dist/memory/write-gate.js.map +1 -0
- package/dist/models/executor.d.ts +130 -0
- package/dist/models/executor.d.ts.map +1 -0
- package/dist/models/executor.js +383 -0
- package/dist/models/executor.js.map +1 -0
- package/dist/models/index.d.ts +15 -0
- package/dist/models/index.d.ts.map +1 -0
- package/dist/models/index.js +17 -0
- package/dist/models/index.js.map +1 -0
- package/dist/models/planner.d.ts +71 -0
- package/dist/models/planner.d.ts.map +1 -0
- package/dist/models/planner.js +344 -0
- package/dist/models/planner.js.map +1 -0
- package/dist/models/router.d.ts +75 -0
- package/dist/models/router.d.ts.map +1 -0
- package/dist/models/router.js +344 -0
- package/dist/models/router.js.map +1 -0
- package/dist/models/types.d.ts +370 -0
- package/dist/models/types.d.ts.map +1 -0
- package/dist/models/types.js +181 -0
- package/dist/models/types.js.map +1 -0
- package/dist/tasks/coordination.d.ts +74 -0
- package/dist/tasks/coordination.d.ts.map +1 -0
- package/dist/tasks/coordination.js +237 -0
- package/dist/tasks/coordination.js.map +1 -0
- package/dist/tasks/database.d.ts +14 -0
- package/dist/tasks/database.d.ts.map +1 -0
- package/dist/tasks/database.js +128 -0
- package/dist/tasks/database.js.map +1 -0
- package/dist/tasks/index.d.ts +5 -0
- package/dist/tasks/index.d.ts.map +1 -0
- package/dist/tasks/index.js +5 -0
- package/dist/tasks/index.js.map +1 -0
- package/dist/tasks/service.d.ts +39 -0
- package/dist/tasks/service.d.ts.map +1 -0
- package/dist/tasks/service.js +582 -0
- package/dist/tasks/service.js.map +1 -0
- package/dist/tasks/types.d.ts +224 -0
- package/dist/tasks/types.d.ts.map +1 -0
- package/dist/tasks/types.js +64 -0
- package/dist/tasks/types.js.map +1 -0
- package/dist/types/analysis.d.ts +82 -0
- package/dist/types/analysis.d.ts.map +1 -0
- package/dist/types/analysis.js +2 -0
- package/dist/types/analysis.js.map +1 -0
- package/dist/types/config.d.ts +3023 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +292 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/coordination.d.ts +240 -0
- package/dist/types/coordination.d.ts.map +1 -0
- package/dist/types/coordination.js +43 -0
- package/dist/types/coordination.js.map +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +4 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/calculate-average.d.ts +15 -0
- package/dist/utils/calculate-average.d.ts.map +1 -0
- package/dist/utils/calculate-average.js +21 -0
- package/dist/utils/calculate-average.js.map +1 -0
- package/dist/utils/config-manager.d.ts +30 -0
- package/dist/utils/config-manager.d.ts.map +1 -0
- package/dist/utils/config-manager.js +41 -0
- package/dist/utils/config-manager.js.map +1 -0
- package/dist/utils/dijkstra.d.ts +17 -0
- package/dist/utils/dijkstra.d.ts.map +1 -0
- package/dist/utils/dijkstra.js +91 -0
- package/dist/utils/dijkstra.js.map +1 -0
- package/dist/utils/fetch-with-retry.d.ts +5 -0
- package/dist/utils/fetch-with-retry.d.ts.map +1 -0
- package/dist/utils/fetch-with-retry.js +61 -0
- package/dist/utils/fetch-with-retry.js.map +1 -0
- package/dist/utils/merge-claude-md.d.ts +28 -0
- package/dist/utils/merge-claude-md.d.ts.map +1 -0
- package/dist/utils/merge-claude-md.js +342 -0
- package/dist/utils/merge-claude-md.js.map +1 -0
- package/dist/utils/order-processor-refactored.d.ts +126 -0
- package/dist/utils/order-processor-refactored.d.ts.map +1 -0
- package/dist/utils/order-processor-refactored.js +165 -0
- package/dist/utils/order-processor-refactored.js.map +1 -0
- package/dist/utils/order-processor-strategy.d.ts +72 -0
- package/dist/utils/order-processor-strategy.d.ts.map +1 -0
- package/dist/utils/order-processor-strategy.js +158 -0
- package/dist/utils/order-processor-strategy.js.map +1 -0
- package/dist/utils/order-processor.d.ts +242 -0
- package/dist/utils/order-processor.d.ts.map +1 -0
- package/dist/utils/order-processor.js +370 -0
- package/dist/utils/order-processor.js.map +1 -0
- package/dist/utils/rate-limiter-simple.d.ts +58 -0
- package/dist/utils/rate-limiter-simple.d.ts.map +1 -0
- package/dist/utils/rate-limiter-simple.js +100 -0
- package/dist/utils/rate-limiter-simple.js.map +1 -0
- package/dist/utils/rate-limiter.d.ts +62 -0
- package/dist/utils/rate-limiter.d.ts.map +1 -0
- package/dist/utils/rate-limiter.js +150 -0
- package/dist/utils/rate-limiter.js.map +1 -0
- package/dist/utils/string-similarity.d.ts +37 -0
- package/dist/utils/string-similarity.d.ts.map +1 -0
- package/dist/utils/string-similarity.js +114 -0
- package/dist/utils/string-similarity.js.map +1 -0
- package/dist/utils/validate-json.d.ts +51 -0
- package/dist/utils/validate-json.d.ts.map +1 -0
- package/dist/utils/validate-json.js +99 -0
- package/dist/utils/validate-json.js.map +1 -0
- package/package.json +96 -0
- package/templates/CLAUDE.template.md +11 -0
- package/templates/CLAUDE_ARCHITECTURE.template.md +103 -0
- package/templates/CLAUDE_CODING.template.md +125 -0
- package/templates/CLAUDE_DROIDS.template.md +109 -0
- package/templates/CLAUDE_MEMORY.template.md +130 -0
- package/templates/CLAUDE_WORKFLOWS.template.md +136 -0
- package/templates/PROJECT.template.md +209 -0
- package/templates/SCHEMA.md +57 -0
- package/templates/archive/CLAUDE.template.root-v6.md +762 -0
- package/templates/archive/CLAUDE.template.v6.md +762 -0
- package/templates/hooks/pre-compact.sh +68 -0
- package/templates/hooks/session-start.sh +106 -0
- package/tools/agents/README.md +224 -0
- package/tools/agents/UAP/README.md +351 -0
- package/tools/agents/UAP/__init__.py +9 -0
- package/tools/agents/UAP/cli.py +675 -0
- package/tools/agents/UAP/version.py +2 -0
- package/tools/agents/benchmarks/benchmark_memory_systems.py +637 -0
- package/tools/agents/benchmarks/results/benchmark_20260106_064817.json +170 -0
- package/tools/agents/benchmarks/results/benchmark_20260106_064817.md +51 -0
- package/tools/agents/config/chat_template.jinja +172 -0
- package/tools/agents/docker-compose.qdrant.yml +24 -0
- package/tools/agents/migrations/apply.py +256 -0
- package/tools/agents/scripts/fix_qwen_chat_template.py +314 -0
- package/tools/agents/scripts/init_qdrant.py +151 -0
- package/tools/agents/scripts/memory_migration.py +518 -0
- package/tools/agents/scripts/migrate_memory_to_qdrant.py +113 -0
- package/tools/agents/scripts/query_memory.py +189 -0
- package/tools/agents/scripts/qwen_tool_call_test.py +419 -0
- package/tools/agents/scripts/qwen_tool_call_wrapper.py +517 -0
- package/tools/agents/scripts/start-services.sh +96 -0
- package/tools/agents/tests/test_uap_compliance.py +257 -0
|
@@ -0,0 +1,656 @@
|
|
|
1
|
+
import { existsSync, readFileSync, readdirSync, statSync } from 'fs';
|
|
2
|
+
import { join, basename } from 'path';
|
|
3
|
+
import { execSync } from 'child_process';
|
|
4
|
+
export async function analyzeProject(cwd) {
|
|
5
|
+
const analysis = {
|
|
6
|
+
projectName: basename(cwd),
|
|
7
|
+
description: '',
|
|
8
|
+
defaultBranch: 'main',
|
|
9
|
+
languages: [],
|
|
10
|
+
frameworks: [],
|
|
11
|
+
packageManagers: [],
|
|
12
|
+
directories: {
|
|
13
|
+
source: [],
|
|
14
|
+
tests: [],
|
|
15
|
+
infrastructure: [],
|
|
16
|
+
docs: [],
|
|
17
|
+
workflows: [],
|
|
18
|
+
},
|
|
19
|
+
urls: [],
|
|
20
|
+
components: [],
|
|
21
|
+
commands: {},
|
|
22
|
+
databases: [],
|
|
23
|
+
infrastructure: {
|
|
24
|
+
cloud: [],
|
|
25
|
+
},
|
|
26
|
+
existingDroids: [],
|
|
27
|
+
existingSkills: [],
|
|
28
|
+
existingCommands: [],
|
|
29
|
+
troubleshootingHints: [],
|
|
30
|
+
keyFiles: [],
|
|
31
|
+
securityNotes: [],
|
|
32
|
+
};
|
|
33
|
+
// Detect git info
|
|
34
|
+
try {
|
|
35
|
+
analysis.defaultBranch = execSync('git rev-parse --abbrev-ref HEAD', {
|
|
36
|
+
cwd,
|
|
37
|
+
encoding: 'utf-8',
|
|
38
|
+
}).trim();
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
// Not a git repo or git not available
|
|
42
|
+
}
|
|
43
|
+
// Analyze package files
|
|
44
|
+
await analyzePackageFiles(cwd, analysis);
|
|
45
|
+
// Analyze directory structure
|
|
46
|
+
analyzeDirectoryStructure(cwd, analysis);
|
|
47
|
+
// Analyze CI/CD
|
|
48
|
+
analyzeCiCd(cwd, analysis);
|
|
49
|
+
// Analyze existing droids/agents
|
|
50
|
+
analyzeExistingAgents(cwd, analysis);
|
|
51
|
+
// Analyze README for description and URLs
|
|
52
|
+
analyzeReadme(cwd, analysis);
|
|
53
|
+
// Detect databases
|
|
54
|
+
detectDatabases(cwd, analysis);
|
|
55
|
+
// Detect infrastructure
|
|
56
|
+
detectInfrastructure(cwd, analysis);
|
|
57
|
+
// Detect MCP plugins
|
|
58
|
+
detectMcpPlugins(cwd, analysis);
|
|
59
|
+
// Detect key configuration files
|
|
60
|
+
detectKeyConfigFiles(cwd, analysis);
|
|
61
|
+
// Detect authentication
|
|
62
|
+
detectAuthentication(cwd, analysis);
|
|
63
|
+
// Detect clusters (Kubernetes)
|
|
64
|
+
detectClusters(cwd, analysis);
|
|
65
|
+
// Detect components from apps/services directories
|
|
66
|
+
detectComponents(cwd, analysis);
|
|
67
|
+
// Detect file type routing from languages
|
|
68
|
+
detectFileTypeRouting(analysis);
|
|
69
|
+
return analysis;
|
|
70
|
+
}
|
|
71
|
+
async function analyzePackageFiles(cwd, analysis) {
|
|
72
|
+
// package.json (Node.js)
|
|
73
|
+
const packageJsonPath = join(cwd, 'package.json');
|
|
74
|
+
if (existsSync(packageJsonPath)) {
|
|
75
|
+
try {
|
|
76
|
+
const pkg = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
|
|
77
|
+
analysis.projectName = pkg.name || analysis.projectName;
|
|
78
|
+
analysis.description = pkg.description || '';
|
|
79
|
+
analysis.packageManagers.push('npm');
|
|
80
|
+
analysis.languages.push('JavaScript');
|
|
81
|
+
// Detect TypeScript
|
|
82
|
+
if (pkg.devDependencies?.typescript || existsSync(join(cwd, 'tsconfig.json'))) {
|
|
83
|
+
analysis.languages.push('TypeScript');
|
|
84
|
+
}
|
|
85
|
+
// Detect frameworks
|
|
86
|
+
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
87
|
+
if (deps.react)
|
|
88
|
+
analysis.frameworks.push('React');
|
|
89
|
+
if (deps.next)
|
|
90
|
+
analysis.frameworks.push('Next.js');
|
|
91
|
+
if (deps.vue)
|
|
92
|
+
analysis.frameworks.push('Vue');
|
|
93
|
+
if (deps.express)
|
|
94
|
+
analysis.frameworks.push('Express');
|
|
95
|
+
if (deps.fastify)
|
|
96
|
+
analysis.frameworks.push('Fastify');
|
|
97
|
+
if (deps.nest)
|
|
98
|
+
analysis.frameworks.push('NestJS');
|
|
99
|
+
// Extract commands
|
|
100
|
+
if (pkg.scripts) {
|
|
101
|
+
if (pkg.scripts.test)
|
|
102
|
+
analysis.commands.test = `npm test`;
|
|
103
|
+
if (pkg.scripts.lint)
|
|
104
|
+
analysis.commands.lint = `npm run lint`;
|
|
105
|
+
if (pkg.scripts.build)
|
|
106
|
+
analysis.commands.build = `npm run build`;
|
|
107
|
+
if (pkg.scripts.dev)
|
|
108
|
+
analysis.commands.dev = `npm run dev`;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
// Invalid package.json
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
// pyproject.toml (Python)
|
|
116
|
+
const pyprojectPath = join(cwd, 'pyproject.toml');
|
|
117
|
+
if (existsSync(pyprojectPath)) {
|
|
118
|
+
analysis.languages.push('Python');
|
|
119
|
+
analysis.packageManagers.push('pip');
|
|
120
|
+
const content = readFileSync(pyprojectPath, 'utf-8');
|
|
121
|
+
if (content.includes('fastapi'))
|
|
122
|
+
analysis.frameworks.push('FastAPI');
|
|
123
|
+
if (content.includes('django'))
|
|
124
|
+
analysis.frameworks.push('Django');
|
|
125
|
+
if (content.includes('flask'))
|
|
126
|
+
analysis.frameworks.push('Flask');
|
|
127
|
+
analysis.commands.test = analysis.commands.test || 'pytest';
|
|
128
|
+
}
|
|
129
|
+
// requirements.txt
|
|
130
|
+
if (existsSync(join(cwd, 'requirements.txt'))) {
|
|
131
|
+
if (!analysis.languages.includes('Python')) {
|
|
132
|
+
analysis.languages.push('Python');
|
|
133
|
+
}
|
|
134
|
+
if (!analysis.packageManagers.includes('pip')) {
|
|
135
|
+
analysis.packageManagers.push('pip');
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
// Cargo.toml (Rust)
|
|
139
|
+
if (existsSync(join(cwd, 'Cargo.toml'))) {
|
|
140
|
+
analysis.languages.push('Rust');
|
|
141
|
+
analysis.packageManagers.push('cargo');
|
|
142
|
+
}
|
|
143
|
+
// go.mod (Go)
|
|
144
|
+
if (existsSync(join(cwd, 'go.mod'))) {
|
|
145
|
+
analysis.languages.push('Go');
|
|
146
|
+
analysis.packageManagers.push('go mod');
|
|
147
|
+
}
|
|
148
|
+
// CMakeLists.txt (C/C++)
|
|
149
|
+
if (existsSync(join(cwd, 'CMakeLists.txt'))) {
|
|
150
|
+
analysis.languages.push('C++');
|
|
151
|
+
analysis.packageManagers.push('cmake');
|
|
152
|
+
}
|
|
153
|
+
// pom.xml (Java/Maven)
|
|
154
|
+
if (existsSync(join(cwd, 'pom.xml'))) {
|
|
155
|
+
analysis.languages.push('Java');
|
|
156
|
+
analysis.packageManagers.push('maven');
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
function analyzeDirectoryStructure(cwd, analysis) {
|
|
160
|
+
const sourceDirs = ['src', 'lib', 'app', 'packages', 'platform', 'services'];
|
|
161
|
+
const testDirs = ['tests', 'test', '__tests__', 'spec'];
|
|
162
|
+
const infraDirs = ['infra', 'terraform', 'infrastructure', 'deploy', 'k8s', 'kubernetes'];
|
|
163
|
+
const docDirs = ['docs', 'documentation', 'doc'];
|
|
164
|
+
for (const dir of sourceDirs) {
|
|
165
|
+
if (existsSync(join(cwd, dir))) {
|
|
166
|
+
analysis.directories.source.push(dir);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
for (const dir of testDirs) {
|
|
170
|
+
if (existsSync(join(cwd, dir))) {
|
|
171
|
+
analysis.directories.tests.push(dir);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
for (const dir of infraDirs) {
|
|
175
|
+
if (existsSync(join(cwd, dir))) {
|
|
176
|
+
analysis.directories.infrastructure.push(dir);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
for (const dir of docDirs) {
|
|
180
|
+
if (existsSync(join(cwd, dir))) {
|
|
181
|
+
analysis.directories.docs.push(dir);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
// Check for UI directories
|
|
185
|
+
if (existsSync(join(cwd, 'ui'))) {
|
|
186
|
+
const uiPath = join(cwd, 'ui');
|
|
187
|
+
try {
|
|
188
|
+
const subdirs = readdirSync(uiPath).filter((f) => statSync(join(uiPath, f)).isDirectory());
|
|
189
|
+
for (const subdir of subdirs) {
|
|
190
|
+
analysis.components.push({
|
|
191
|
+
name: `UI - ${subdir}`,
|
|
192
|
+
path: `ui/${subdir}`,
|
|
193
|
+
language: 'JavaScript',
|
|
194
|
+
description: `Frontend component: ${subdir}`,
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
catch {
|
|
199
|
+
// Can't read ui directory
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
function analyzeCiCd(cwd, analysis) {
|
|
204
|
+
// GitHub Actions
|
|
205
|
+
const ghWorkflowsPath = join(cwd, '.github/workflows');
|
|
206
|
+
if (existsSync(ghWorkflowsPath)) {
|
|
207
|
+
analysis.directories.workflows.push('.github/workflows');
|
|
208
|
+
try {
|
|
209
|
+
const workflows = readdirSync(ghWorkflowsPath).filter((f) => f.endsWith('.yml') || f.endsWith('.yaml'));
|
|
210
|
+
analysis.ciCd = {
|
|
211
|
+
platform: 'GitHub Actions',
|
|
212
|
+
workflows: workflows.map((f) => ({
|
|
213
|
+
file: f,
|
|
214
|
+
purpose: inferWorkflowPurpose(f),
|
|
215
|
+
})),
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
catch {
|
|
219
|
+
// Can't read workflows
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
// GitLab CI
|
|
223
|
+
if (existsSync(join(cwd, '.gitlab-ci.yml'))) {
|
|
224
|
+
analysis.ciCd = {
|
|
225
|
+
platform: 'GitLab CI',
|
|
226
|
+
workflows: [{ file: '.gitlab-ci.yml', purpose: 'CI/CD pipeline' }],
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
function inferWorkflowPurpose(filename) {
|
|
231
|
+
const name = filename.toLowerCase();
|
|
232
|
+
if (name.includes('test'))
|
|
233
|
+
return 'Testing';
|
|
234
|
+
if (name.includes('lint'))
|
|
235
|
+
return 'Linting';
|
|
236
|
+
if (name.includes('build'))
|
|
237
|
+
return 'Build';
|
|
238
|
+
if (name.includes('deploy') || name.includes('cd'))
|
|
239
|
+
return 'Deployment';
|
|
240
|
+
if (name.includes('security'))
|
|
241
|
+
return 'Security scanning';
|
|
242
|
+
if (name.includes('release'))
|
|
243
|
+
return 'Release automation';
|
|
244
|
+
if (name.includes('ci'))
|
|
245
|
+
return 'Continuous Integration';
|
|
246
|
+
return 'Workflow';
|
|
247
|
+
}
|
|
248
|
+
function analyzeExistingAgents(cwd, analysis) {
|
|
249
|
+
// Factory droids
|
|
250
|
+
const factoryDroidsPath = join(cwd, '.factory/droids');
|
|
251
|
+
if (existsSync(factoryDroidsPath)) {
|
|
252
|
+
try {
|
|
253
|
+
const droids = readdirSync(factoryDroidsPath)
|
|
254
|
+
.filter((f) => f.endsWith('.md'))
|
|
255
|
+
.map((f) => basename(f, '.md'));
|
|
256
|
+
analysis.existingDroids.push(...droids);
|
|
257
|
+
}
|
|
258
|
+
catch {
|
|
259
|
+
// Can't read droids
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
// Factory skills
|
|
263
|
+
const factorySkillsPath = join(cwd, '.factory/skills');
|
|
264
|
+
if (existsSync(factorySkillsPath)) {
|
|
265
|
+
try {
|
|
266
|
+
const skills = readdirSync(factorySkillsPath)
|
|
267
|
+
.filter((f) => statSync(join(factorySkillsPath, f)).isDirectory())
|
|
268
|
+
.map((f) => f);
|
|
269
|
+
analysis.existingSkills.push(...skills);
|
|
270
|
+
}
|
|
271
|
+
catch {
|
|
272
|
+
// Can't read skills
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
// Factory commands
|
|
276
|
+
const factoryCommandsPath = join(cwd, '.factory/commands');
|
|
277
|
+
if (existsSync(factoryCommandsPath)) {
|
|
278
|
+
try {
|
|
279
|
+
const commands = readdirSync(factoryCommandsPath)
|
|
280
|
+
.filter((f) => f.endsWith('.md'))
|
|
281
|
+
.map((f) => basename(f, '.md'));
|
|
282
|
+
analysis.existingCommands.push(...commands);
|
|
283
|
+
}
|
|
284
|
+
catch {
|
|
285
|
+
// Can't read commands
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
// Claude Code agents
|
|
289
|
+
const claudeAgentsPath = join(cwd, '.claude/agents');
|
|
290
|
+
if (existsSync(claudeAgentsPath)) {
|
|
291
|
+
try {
|
|
292
|
+
const agents = readdirSync(claudeAgentsPath)
|
|
293
|
+
.filter((f) => f.endsWith('.md'))
|
|
294
|
+
.map((f) => basename(f, '.md'));
|
|
295
|
+
analysis.existingDroids.push(...agents);
|
|
296
|
+
}
|
|
297
|
+
catch {
|
|
298
|
+
// Can't read agents
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
function analyzeReadme(cwd, analysis) {
|
|
303
|
+
const readmePaths = ['README.md', 'readme.md', 'Readme.md'];
|
|
304
|
+
for (const readmePath of readmePaths) {
|
|
305
|
+
const fullPath = join(cwd, readmePath);
|
|
306
|
+
if (existsSync(fullPath)) {
|
|
307
|
+
try {
|
|
308
|
+
const content = readFileSync(fullPath, 'utf-8');
|
|
309
|
+
// Extract first paragraph as description
|
|
310
|
+
const firstParagraph = content.split('\n\n')[1]?.trim();
|
|
311
|
+
if (firstParagraph && !analysis.description) {
|
|
312
|
+
analysis.description = firstParagraph.substring(0, 200);
|
|
313
|
+
}
|
|
314
|
+
// Extract URLs
|
|
315
|
+
const urlRegex = /https?:\/\/[^\s\)]+/g;
|
|
316
|
+
const urls = content.match(urlRegex) || [];
|
|
317
|
+
for (const url of urls.slice(0, 5)) {
|
|
318
|
+
// Limit to first 5 URLs
|
|
319
|
+
if (url.includes('github.com'))
|
|
320
|
+
continue; // Skip GitHub links
|
|
321
|
+
analysis.urls.push({
|
|
322
|
+
name: 'URL',
|
|
323
|
+
value: url,
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
analysis.keyFiles.push({
|
|
327
|
+
file: readmePath,
|
|
328
|
+
purpose: 'Project documentation',
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
catch {
|
|
332
|
+
// Can't read README
|
|
333
|
+
}
|
|
334
|
+
break;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
function detectDatabases(cwd, analysis) {
|
|
339
|
+
// Check for database-related files
|
|
340
|
+
if (existsSync(join(cwd, 'docker-compose.yml'))) {
|
|
341
|
+
try {
|
|
342
|
+
const content = readFileSync(join(cwd, 'docker-compose.yml'), 'utf-8');
|
|
343
|
+
if (content.includes('postgres')) {
|
|
344
|
+
analysis.databases.push({ type: 'PostgreSQL', purpose: 'Database' });
|
|
345
|
+
}
|
|
346
|
+
if (content.includes('mysql')) {
|
|
347
|
+
analysis.databases.push({ type: 'MySQL', purpose: 'Database' });
|
|
348
|
+
}
|
|
349
|
+
if (content.includes('mongo')) {
|
|
350
|
+
analysis.databases.push({ type: 'MongoDB', purpose: 'Database' });
|
|
351
|
+
}
|
|
352
|
+
if (content.includes('redis')) {
|
|
353
|
+
analysis.databases.push({ type: 'Redis', purpose: 'Cache' });
|
|
354
|
+
}
|
|
355
|
+
if (content.includes('qdrant')) {
|
|
356
|
+
analysis.databases.push({ type: 'Qdrant', purpose: 'Vector database' });
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
catch {
|
|
360
|
+
// Can't read docker-compose
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
// Check for SQLite
|
|
364
|
+
if (existsSync(join(cwd, 'agents/data/memory/short_term.db'))) {
|
|
365
|
+
analysis.databases.push({ type: 'SQLite', purpose: 'Agent memory' });
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
function detectInfrastructure(cwd, analysis) {
|
|
369
|
+
// Terraform
|
|
370
|
+
const terraformPath = join(cwd, 'infra/terraform');
|
|
371
|
+
if (existsSync(terraformPath) || existsSync(join(cwd, 'terraform'))) {
|
|
372
|
+
analysis.infrastructure.iac = 'Terraform';
|
|
373
|
+
}
|
|
374
|
+
// Kubernetes
|
|
375
|
+
if (existsSync(join(cwd, 'k8s')) || existsSync(join(cwd, 'kubernetes'))) {
|
|
376
|
+
analysis.infrastructure.containerOrchestration = 'Kubernetes';
|
|
377
|
+
}
|
|
378
|
+
// Docker
|
|
379
|
+
if (existsSync(join(cwd, 'Dockerfile')) || existsSync(join(cwd, 'docker-compose.yml'))) {
|
|
380
|
+
if (!analysis.infrastructure.containerOrchestration) {
|
|
381
|
+
analysis.infrastructure.containerOrchestration = 'Docker';
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
function detectMcpPlugins(cwd, analysis) {
|
|
386
|
+
const mcpPath = join(cwd, '.mcp.json');
|
|
387
|
+
if (!existsSync(mcpPath))
|
|
388
|
+
return;
|
|
389
|
+
try {
|
|
390
|
+
const mcp = JSON.parse(readFileSync(mcpPath, 'utf-8'));
|
|
391
|
+
const plugins = mcp.mcpServers || mcp.plugins || {};
|
|
392
|
+
analysis.mcpPlugins = [];
|
|
393
|
+
for (const [name, config] of Object.entries(plugins)) {
|
|
394
|
+
const cfg = config;
|
|
395
|
+
analysis.mcpPlugins.push({
|
|
396
|
+
name,
|
|
397
|
+
purpose: cfg.description || cfg.purpose || 'MCP plugin',
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
catch {
|
|
402
|
+
// Can't read or parse .mcp.json
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
function detectKeyConfigFiles(cwd, analysis) {
|
|
406
|
+
// Common configuration files to detect
|
|
407
|
+
const configFiles = [
|
|
408
|
+
{ file: '.uap.json', purpose: 'UAP agent memory configuration' },
|
|
409
|
+
{ file: 'package.json', purpose: 'Node.js project configuration' },
|
|
410
|
+
{ file: 'tsconfig.json', purpose: 'TypeScript configuration' },
|
|
411
|
+
{ file: '.mcp.json', purpose: 'MCP plugins configuration' },
|
|
412
|
+
{ file: 'docker-compose.yml', purpose: 'Docker Compose services' },
|
|
413
|
+
{ file: 'Dockerfile', purpose: 'Container build definition' },
|
|
414
|
+
{ file: '.env.example', purpose: 'Environment variable template' },
|
|
415
|
+
{ file: '.gitignore', purpose: 'Git ignore patterns' },
|
|
416
|
+
{ file: 'pyproject.toml', purpose: 'Python project configuration' },
|
|
417
|
+
{ file: 'Cargo.toml', purpose: 'Rust project configuration' },
|
|
418
|
+
{ file: 'go.mod', purpose: 'Go module definition' },
|
|
419
|
+
{ file: 'pom.xml', purpose: 'Maven project configuration' },
|
|
420
|
+
{ file: '.eslintrc.json', purpose: 'ESLint configuration' },
|
|
421
|
+
{ file: '.eslintrc.js', purpose: 'ESLint configuration' },
|
|
422
|
+
{ file: '.prettierrc', purpose: 'Prettier configuration' },
|
|
423
|
+
{ file: 'vitest.config.ts', purpose: 'Vitest test configuration' },
|
|
424
|
+
{ file: 'jest.config.js', purpose: 'Jest test configuration' },
|
|
425
|
+
{ file: 'vite.config.ts', purpose: 'Vite build configuration' },
|
|
426
|
+
{ file: 'webpack.config.js', purpose: 'Webpack build configuration' },
|
|
427
|
+
];
|
|
428
|
+
for (const cfg of configFiles) {
|
|
429
|
+
if (existsSync(join(cwd, cfg.file))) {
|
|
430
|
+
// Check if not already added
|
|
431
|
+
if (!analysis.keyFiles.some((kf) => kf.file === cfg.file)) {
|
|
432
|
+
analysis.keyFiles.push(cfg);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
// Detect infrastructure-specific config files
|
|
437
|
+
if (analysis.infrastructure.iac === 'Terraform') {
|
|
438
|
+
const terraformConfigs = [
|
|
439
|
+
{ file: 'main.tf', purpose: 'Terraform main configuration' },
|
|
440
|
+
{ file: 'variables.tf', purpose: 'Terraform variables' },
|
|
441
|
+
{ file: 'outputs.tf', purpose: 'Terraform outputs' },
|
|
442
|
+
{ file: 'production.tfvars', purpose: 'Production environment variables' },
|
|
443
|
+
];
|
|
444
|
+
const infraPath = analysis.directories.infrastructure[0] || 'infra/terraform';
|
|
445
|
+
for (const cfg of terraformConfigs) {
|
|
446
|
+
const fullPath = join(cwd, infraPath, cfg.file);
|
|
447
|
+
if (existsSync(fullPath)) {
|
|
448
|
+
analysis.keyFiles.push({
|
|
449
|
+
file: `${infraPath}/${cfg.file}`,
|
|
450
|
+
purpose: cfg.purpose,
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
function detectAuthentication(cwd, analysis) {
|
|
457
|
+
// Check for common auth providers
|
|
458
|
+
const authPatterns = [
|
|
459
|
+
{ pattern: 'zitadel', provider: 'Zitadel', description: 'OIDC/OAuth2 authentication' },
|
|
460
|
+
{ pattern: 'keycloak', provider: 'Keycloak', description: 'Identity and access management' },
|
|
461
|
+
{ pattern: 'auth0', provider: 'Auth0', description: 'Authentication platform' },
|
|
462
|
+
{
|
|
463
|
+
pattern: 'oauth2-proxy',
|
|
464
|
+
provider: 'OAuth2 Proxy',
|
|
465
|
+
description: 'OAuth2 authentication proxy',
|
|
466
|
+
},
|
|
467
|
+
{ pattern: 'firebase-auth', provider: 'Firebase Auth', description: 'Firebase authentication' },
|
|
468
|
+
{ pattern: 'supabase', provider: 'Supabase', description: 'Supabase authentication' },
|
|
469
|
+
{ pattern: 'clerk', provider: 'Clerk', description: 'Clerk authentication' },
|
|
470
|
+
{
|
|
471
|
+
pattern: 'passport',
|
|
472
|
+
provider: 'Passport.js',
|
|
473
|
+
description: 'Node.js authentication middleware',
|
|
474
|
+
},
|
|
475
|
+
];
|
|
476
|
+
// Check in various config files
|
|
477
|
+
const filesToCheck = ['docker-compose.yml', 'package.json', 'requirements.txt', '.env.example'];
|
|
478
|
+
for (const file of filesToCheck) {
|
|
479
|
+
const filePath = join(cwd, file);
|
|
480
|
+
if (existsSync(filePath)) {
|
|
481
|
+
try {
|
|
482
|
+
const content = readFileSync(filePath, 'utf-8').toLowerCase();
|
|
483
|
+
for (const auth of authPatterns) {
|
|
484
|
+
if (content.includes(auth.pattern)) {
|
|
485
|
+
analysis.authentication = {
|
|
486
|
+
provider: auth.provider,
|
|
487
|
+
description: auth.description,
|
|
488
|
+
};
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
catch {
|
|
494
|
+
// Ignore
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
// Check for Istio with OAuth2
|
|
499
|
+
const k8sPath = join(cwd, 'infra/k8s');
|
|
500
|
+
if (existsSync(k8sPath)) {
|
|
501
|
+
try {
|
|
502
|
+
const files = readdirSync(k8sPath, { recursive: true });
|
|
503
|
+
for (const file of files) {
|
|
504
|
+
if (typeof file === 'string' && (file.includes('oauth') || file.includes('auth'))) {
|
|
505
|
+
analysis.authentication = {
|
|
506
|
+
provider: 'OAuth2',
|
|
507
|
+
description: 'OAuth2 authentication via Kubernetes/Istio',
|
|
508
|
+
};
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
catch {
|
|
514
|
+
// Ignore
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
function detectClusters(cwd, analysis) {
|
|
519
|
+
// Check for kubeconfig references or cluster configs
|
|
520
|
+
const k8sPath = join(cwd, 'infra/k8s');
|
|
521
|
+
const terraformPath = join(cwd, 'infra/terraform');
|
|
522
|
+
if (!existsSync(k8sPath) && !existsSync(terraformPath)) {
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
525
|
+
// Look for cluster context patterns in terraform files
|
|
526
|
+
if (existsSync(terraformPath)) {
|
|
527
|
+
try {
|
|
528
|
+
const files = readdirSync(terraformPath).filter((f) => f.endsWith('.tf'));
|
|
529
|
+
const contexts = [];
|
|
530
|
+
for (const file of files) {
|
|
531
|
+
const content = readFileSync(join(terraformPath, file), 'utf-8');
|
|
532
|
+
// Look for digitalocean_kubernetes_cluster or similar
|
|
533
|
+
const doClusterMatch = content.match(/do-[\w-]+/g);
|
|
534
|
+
if (doClusterMatch) {
|
|
535
|
+
for (const match of [...new Set(doClusterMatch)]) {
|
|
536
|
+
if (!contexts.find((c) => c.context === match)) {
|
|
537
|
+
const purpose = match.includes('openobserve')
|
|
538
|
+
? 'Observability'
|
|
539
|
+
: match.includes('zitadel')
|
|
540
|
+
? 'Authentication'
|
|
541
|
+
: 'Applications';
|
|
542
|
+
contexts.push({
|
|
543
|
+
name: match.replace(/^do-\w+-/, '').replace(/-/g, ' '),
|
|
544
|
+
context: match,
|
|
545
|
+
purpose,
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
if (contexts.length > 0) {
|
|
552
|
+
analysis.clusters = {
|
|
553
|
+
enabled: true,
|
|
554
|
+
contexts,
|
|
555
|
+
};
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
catch {
|
|
559
|
+
// Ignore
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
function detectComponents(cwd, analysis) {
|
|
564
|
+
// Scan apps/ and services/ directories for components
|
|
565
|
+
const componentDirs = ['apps', 'services', 'packages', 'libs'];
|
|
566
|
+
for (const dir of componentDirs) {
|
|
567
|
+
const dirPath = join(cwd, dir);
|
|
568
|
+
if (!existsSync(dirPath))
|
|
569
|
+
continue;
|
|
570
|
+
try {
|
|
571
|
+
const subdirs = readdirSync(dirPath, { withFileTypes: true }).filter((d) => d.isDirectory() && !d.name.startsWith('.'));
|
|
572
|
+
for (const subdir of subdirs) {
|
|
573
|
+
const compPath = join(dirPath, subdir.name);
|
|
574
|
+
// Detect language and framework
|
|
575
|
+
let language = 'Unknown';
|
|
576
|
+
let framework = '';
|
|
577
|
+
let description = '';
|
|
578
|
+
// Check for package.json
|
|
579
|
+
const pkgPath = join(compPath, 'package.json');
|
|
580
|
+
if (existsSync(pkgPath)) {
|
|
581
|
+
try {
|
|
582
|
+
const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
|
|
583
|
+
description = pkg.description || '';
|
|
584
|
+
language = 'TypeScript';
|
|
585
|
+
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
586
|
+
if (deps.react)
|
|
587
|
+
framework = 'React';
|
|
588
|
+
else if (deps.vue)
|
|
589
|
+
framework = 'Vue';
|
|
590
|
+
else if (deps.express)
|
|
591
|
+
framework = 'Express';
|
|
592
|
+
else if (deps.fastify)
|
|
593
|
+
framework = 'Fastify';
|
|
594
|
+
else if (deps.next)
|
|
595
|
+
framework = 'Next.js';
|
|
596
|
+
}
|
|
597
|
+
catch {
|
|
598
|
+
// Ignore
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
// Check for pyproject.toml or requirements.txt
|
|
602
|
+
if (existsSync(join(compPath, 'pyproject.toml')) ||
|
|
603
|
+
existsSync(join(compPath, 'requirements.txt'))) {
|
|
604
|
+
language = 'Python';
|
|
605
|
+
if (existsSync(join(compPath, 'pyproject.toml'))) {
|
|
606
|
+
const content = readFileSync(join(compPath, 'pyproject.toml'), 'utf-8');
|
|
607
|
+
if (content.includes('fastapi'))
|
|
608
|
+
framework = 'FastAPI';
|
|
609
|
+
else if (content.includes('flask'))
|
|
610
|
+
framework = 'Flask';
|
|
611
|
+
else if (content.includes('django'))
|
|
612
|
+
framework = 'Django';
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
// Check for CMakeLists.txt (C++)
|
|
616
|
+
if (existsSync(join(compPath, 'CMakeLists.txt'))) {
|
|
617
|
+
language = 'C++';
|
|
618
|
+
const content = readFileSync(join(compPath, 'CMakeLists.txt'), 'utf-8');
|
|
619
|
+
if (content.includes('crow') || content.includes('Crow'))
|
|
620
|
+
framework = 'Crow';
|
|
621
|
+
}
|
|
622
|
+
// Check for Cargo.toml (Rust)
|
|
623
|
+
if (existsSync(join(compPath, 'Cargo.toml'))) {
|
|
624
|
+
language = 'Rust';
|
|
625
|
+
}
|
|
626
|
+
// Check for go.mod (Go)
|
|
627
|
+
if (existsSync(join(compPath, 'go.mod'))) {
|
|
628
|
+
language = 'Go';
|
|
629
|
+
}
|
|
630
|
+
// Only add if not already present
|
|
631
|
+
const compFullPath = `${dir}/${subdir.name}`;
|
|
632
|
+
if (!analysis.components.find((c) => c.path === compFullPath)) {
|
|
633
|
+
analysis.components.push({
|
|
634
|
+
name: subdir.name,
|
|
635
|
+
path: compFullPath,
|
|
636
|
+
language,
|
|
637
|
+
framework: framework || undefined,
|
|
638
|
+
description: description || `${language}${framework ? ` ${framework}` : ''} component`,
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
catch {
|
|
644
|
+
// Ignore
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
function detectFileTypeRouting(analysis) {
|
|
649
|
+
// This function doesn't modify analysis directly but ensures languages are properly detected
|
|
650
|
+
// The FILE_TYPE_ROUTING template variable is built by the generator based on detected languages
|
|
651
|
+
// Ensure unique languages
|
|
652
|
+
analysis.languages = [...new Set(analysis.languages)];
|
|
653
|
+
// Ensure frameworks are unique
|
|
654
|
+
analysis.frameworks = [...new Set(analysis.frameworks)];
|
|
655
|
+
}
|
|
656
|
+
//# sourceMappingURL=index.js.map
|