claude-flow-novice 2.0.4 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/cli/commands/guidance.js +668 -487
- package/dist/src/cli/commands/index-validate.js +29 -18
- package/dist/src/cli/commands/mcp-troubleshoot.js +282 -230
- package/dist/src/cli/commands/neural-goal-init.js +125 -92
- package/dist/src/cli/commands/swarm-exec.js +393 -317
- package/dist/src/cli/commands/validate-framework.js +1100 -983
- package/dist/src/cli/commands/validate.js +223 -144
- package/dist/src/cli/main.js +1 -1
- package/dist/src/cli/simple-commands/__tests__/agent.test.js +277 -265
- package/dist/src/cli/simple-commands/__tests__/memory.test.js +7 -6
- package/dist/src/cli/simple-commands/__tests__/swarm.test.js +356 -373
- package/dist/src/cli/simple-commands/__tests__/task.test.js +7 -6
- package/dist/src/cli/simple-commands/agent.js +193 -157
- package/dist/src/cli/simple-commands/analysis.js +446 -336
- package/dist/src/cli/simple-commands/automation-executor.js +1339 -1095
- package/dist/src/cli/simple-commands/automation.js +469 -481
- package/dist/src/cli/simple-commands/batch-manager.js +313 -261
- package/dist/src/cli/simple-commands/claude-telemetry.js +267 -241
- package/dist/src/cli/simple-commands/claude-track.js +90 -68
- package/dist/src/cli/simple-commands/concurrent-display.js +320 -266
- package/dist/src/cli/simple-commands/config.js +290 -245
- package/dist/src/cli/simple-commands/coordination.js +234 -182
- package/dist/src/cli/simple-commands/enhanced-ui-views.js +615 -812
- package/dist/src/cli/simple-commands/enhanced-webui-complete.js +981 -922
- package/dist/src/cli/simple-commands/fix-hook-variables.js +294 -274
- package/dist/src/cli/simple-commands/github/gh-coordinator.js +457 -378
- package/dist/src/cli/simple-commands/github/github-api.js +574 -535
- package/dist/src/cli/simple-commands/github/init.js +303 -276
- package/dist/src/cli/simple-commands/github.js +247 -222
- package/dist/src/cli/simple-commands/goal.js +63 -51
- package/dist/src/cli/simple-commands/hive-mind/auto-save-middleware.js +278 -208
- package/dist/src/cli/simple-commands/hive-mind/communication.js +696 -601
- package/dist/src/cli/simple-commands/hive-mind/core.js +979 -907
- package/dist/src/cli/simple-commands/hive-mind/db-optimizer.js +655 -406
- package/dist/src/cli/simple-commands/hive-mind/mcp-wrapper.js +1245 -1125
- package/dist/src/cli/simple-commands/hive-mind/memory.js +1090 -854
- package/dist/src/cli/simple-commands/hive-mind/performance-optimizer.js +574 -459
- package/dist/src/cli/simple-commands/hive-mind/performance-test.js +347 -263
- package/dist/src/cli/simple-commands/hive-mind/queen.js +768 -727
- package/dist/src/cli/simple-commands/hive-mind/session-manager.js +1049 -745
- package/dist/src/cli/simple-commands/hive-mind-optimize.js +283 -227
- package/dist/src/cli/simple-commands/hive-mind-wizard.js +217 -174
- package/dist/src/cli/simple-commands/hive-mind.js +2282 -1841
- package/dist/src/cli/simple-commands/hive.js +79 -90
- package/dist/src/cli/simple-commands/hook-safety.js +521 -431
- package/dist/src/cli/simple-commands/hooks/session-start-soul.js +254 -203
- package/dist/src/cli/simple-commands/hooks.js +1204 -1064
- package/dist/src/cli/simple-commands/init/agent-copier.js +319 -294
- package/dist/src/cli/simple-commands/init/batch-init.js +562 -496
- package/dist/src/cli/simple-commands/init/claude-commands/claude-flow-commands.js +19 -13
- package/dist/src/cli/simple-commands/init/claude-commands/optimized-claude-flow-commands.js +19 -13
- package/dist/src/cli/simple-commands/init/claude-commands/optimized-slash-commands.js +88 -61
- package/dist/src/cli/simple-commands/init/claude-commands/optimized-sparc-commands.js +150 -125
- package/dist/src/cli/simple-commands/init/claude-commands/slash-commands.js +49 -42
- package/dist/src/cli/simple-commands/init/claude-commands/sparc-commands.js +61 -43
- package/dist/src/cli/simple-commands/init/copy-revised-templates.js +147 -141
- package/dist/src/cli/simple-commands/init/executable-wrapper.js +44 -31
- package/dist/src/cli/simple-commands/init/gitignore-updater.js +90 -64
- package/dist/src/cli/simple-commands/init/help.js +107 -104
- package/dist/src/cli/simple-commands/init/hive-mind-init.js +528 -509
- package/dist/src/cli/simple-commands/init/index.js +1759 -1510
- package/dist/src/cli/simple-commands/init/performance-monitor.js +317 -234
- package/dist/src/cli/simple-commands/init/rollback/backup-manager.js +504 -441
- package/dist/src/cli/simple-commands/init/rollback/index.js +364 -289
- package/dist/src/cli/simple-commands/init/rollback/recovery-manager.js +728 -652
- package/dist/src/cli/simple-commands/init/rollback/rollback-executor.js +481 -416
- package/dist/src/cli/simple-commands/init/rollback/state-tracker.js +448 -369
- package/dist/src/cli/simple-commands/init/sparc/roo-readme.js +2 -1
- package/dist/src/cli/simple-commands/init/sparc/roomodes-config.js +99 -122
- package/dist/src/cli/simple-commands/init/sparc/workflows.js +37 -32
- package/dist/src/cli/simple-commands/init/sparc-structure.js +62 -55
- package/dist/src/cli/simple-commands/init/template-copier.js +533 -421
- package/dist/src/cli/simple-commands/init/templates/coordination-md.js +6 -3
- package/dist/src/cli/simple-commands/init/templates/enhanced-templates.js +318 -344
- package/dist/src/cli/simple-commands/init/templates/github-safe-enhanced.js +218 -173
- package/dist/src/cli/simple-commands/init/templates/github-safe.js +75 -65
- package/dist/src/cli/simple-commands/init/templates/memory-bank-md.js +6 -3
- package/dist/src/cli/simple-commands/init/templates/readme-files.js +4 -2
- package/dist/src/cli/simple-commands/init/templates/safe-hook-patterns.js +230 -187
- package/dist/src/cli/simple-commands/init/templates/sparc-modes.js +80 -53
- package/dist/src/cli/simple-commands/init/templates/verification-claude-md.js +85 -101
- package/dist/src/cli/simple-commands/init/validation/config-validator.js +330 -283
- package/dist/src/cli/simple-commands/init/validation/health-checker.js +561 -495
- package/dist/src/cli/simple-commands/init/validation/index.js +358 -302
- package/dist/src/cli/simple-commands/init/validation/mode-validator.js +359 -308
- package/dist/src/cli/simple-commands/init/validation/post-init-validator.js +366 -389
- package/dist/src/cli/simple-commands/init/validation/pre-init-validator.js +268 -270
- package/dist/src/cli/simple-commands/init/validation/test-runner.js +447 -427
- package/dist/src/cli/simple-commands/init.js +2 -1
- package/dist/src/cli/simple-commands/mcp-health.js +158 -131
- package/dist/src/cli/simple-commands/mcp-integration-layer.js +634 -533
- package/dist/src/cli/simple-commands/mcp.js +400 -345
- package/dist/src/cli/simple-commands/memory-consolidation.js +537 -426
- package/dist/src/cli/simple-commands/memory.js +311 -247
- package/dist/src/cli/simple-commands/migrate-hooks.js +46 -39
- package/dist/src/cli/simple-commands/monitor.js +363 -294
- package/dist/src/cli/simple-commands/neural.js +65 -51
- package/dist/src/cli/simple-commands/pair-autofix-only.js +662 -538
- package/dist/src/cli/simple-commands/pair-basic.js +656 -528
- package/dist/src/cli/simple-commands/pair-old.js +543 -430
- package/dist/src/cli/simple-commands/pair-working.js +751 -615
- package/dist/src/cli/simple-commands/pair.js +751 -615
- package/dist/src/cli/simple-commands/performance-hooks.js +111 -83
- package/dist/src/cli/simple-commands/performance-metrics.js +433 -348
- package/dist/src/cli/simple-commands/process-ui-enhanced.js +787 -708
- package/dist/src/cli/simple-commands/process-ui.js +254 -230
- package/dist/src/cli/simple-commands/realtime-update-system.js +611 -525
- package/dist/src/cli/simple-commands/sparc/architecture.js +1530 -1704
- package/dist/src/cli/simple-commands/sparc/commands.js +516 -438
- package/dist/src/cli/simple-commands/sparc/completion.js +1481 -1224
- package/dist/src/cli/simple-commands/sparc/coordinator.js +978 -913
- package/dist/src/cli/simple-commands/sparc/index.js +298 -241
- package/dist/src/cli/simple-commands/sparc/phase-base.js +390 -314
- package/dist/src/cli/simple-commands/sparc/pseudocode.js +869 -965
- package/dist/src/cli/simple-commands/sparc/refinement.js +1273 -980
- package/dist/src/cli/simple-commands/sparc/specification.js +645 -559
- package/dist/src/cli/simple-commands/sparc-modes/architect.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/ask.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/code.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/debug.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/devops.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/docs-writer.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/generic.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/index.js +55 -47
- package/dist/src/cli/simple-commands/sparc-modes/integration.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/mcp.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/monitoring.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/optimization.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/security-review.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/sparc-orchestrator.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/spec-pseudocode.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/supabase-admin.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/swarm.js +87 -101
- package/dist/src/cli/simple-commands/sparc-modes/tdd.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/tutorial.js +1 -1
- package/dist/src/cli/simple-commands/sparc.js +493 -465
- package/dist/src/cli/simple-commands/start-ui.js +132 -108
- package/dist/src/cli/simple-commands/start-wrapper.js +268 -240
- package/dist/src/cli/simple-commands/start.js +1 -1
- package/dist/src/cli/simple-commands/status.js +275 -254
- package/dist/src/cli/simple-commands/stream-chain-clean.js +171 -128
- package/dist/src/cli/simple-commands/stream-chain-fixed.js +82 -61
- package/dist/src/cli/simple-commands/stream-chain-real.js +331 -267
- package/dist/src/cli/simple-commands/stream-chain-working.js +263 -211
- package/dist/src/cli/simple-commands/stream-chain.js +318 -260
- package/dist/src/cli/simple-commands/stream-processor.js +315 -290
- package/dist/src/cli/simple-commands/swarm-executor.js +222 -189
- package/dist/src/cli/simple-commands/swarm-metrics-integration.js +300 -208
- package/dist/src/cli/simple-commands/swarm-ui.js +703 -623
- package/dist/src/cli/simple-commands/swarm-webui-integration.js +286 -258
- package/dist/src/cli/simple-commands/swarm.js +1082 -887
- package/dist/src/cli/simple-commands/task.js +206 -161
- package/dist/src/cli/simple-commands/timestamp-fix.js +89 -59
- package/dist/src/cli/simple-commands/token-tracker.js +316 -258
- package/dist/src/cli/simple-commands/tool-execution-framework.js +519 -433
- package/dist/src/cli/simple-commands/train-and-stream.js +331 -275
- package/dist/src/cli/simple-commands/training-pipeline.js +725 -619
- package/dist/src/cli/simple-commands/training.js +227 -170
- package/dist/src/cli/simple-commands/verification-hooks.js +284 -261
- package/dist/src/cli/simple-commands/verification-integration.js +417 -389
- package/dist/src/cli/simple-commands/verification-training-integration.js +606 -486
- package/dist/src/cli/simple-commands/verification.js +513 -493
- package/dist/src/cli/simple-commands/web-server.js +836 -766
- package/dist/src/cli/simple-commands/webui-validator.js +124 -106
- package/dist/src/coordination/byzantine-memory-channels.js +25 -1
- package/dist/src/coordination/event-bus/demo-wasm-integration.js +251 -212
- package/dist/src/coordination/event-bus/qe-event-bus.js +748 -608
- package/dist/src/coordination/event-bus/qe-event-bus.test.js +454 -379
- package/dist/src/coordination/iteration-tracker.js +454 -363
- package/dist/src/index.js +384 -35
- package/dist/src/mcp/DEPRECATED.js +60 -46
- package/dist/src/mcp/fixes/mcp-error-fixes.js +134 -115
- package/dist/src/mcp/implementations/agent-tracker.js +128 -114
- package/dist/src/mcp/implementations/daa-tools.js +350 -292
- package/dist/src/mcp/implementations/workflow-tools.js +361 -329
- package/dist/src/mcp/mcp-config-manager.js +1331 -1183
- package/dist/src/mcp/mcp-server-novice-simplified.js +17 -11
- package/dist/src/mcp/mcp-server-novice.js +17 -11
- package/dist/src/mcp/mcp-server-sdk.js +17 -11
- package/dist/src/mcp/mcp-server.js +1484 -1620
- package/dist/src/mcp/ruv-swarm-wrapper.js +239 -209
- package/dist/src/memory/advanced-serializer.js +589 -609
- package/dist/src/memory/enhanced-examples.js +305 -220
- package/dist/src/memory/enhanced-memory.js +336 -295
- package/dist/src/memory/enhanced-session-serializer.js +492 -408
- package/dist/src/memory/fallback-memory-system.js +1021 -900
- package/dist/src/memory/fallback-store.js +131 -93
- package/dist/src/memory/high-performance-serialization.js +730 -592
- package/dist/src/memory/in-memory-store.js +213 -161
- package/dist/src/memory/index.js +157 -123
- package/dist/src/memory/lock-free-structures.js +764 -578
- package/dist/src/memory/memory-mapped-persistence.js +766 -585
- package/dist/src/memory/memory-pressure-manager.js +707 -569
- package/dist/src/memory/migration.js +445 -358
- package/dist/src/memory/shared-memory.js +768 -641
- package/dist/src/memory/sqlite-store.js +325 -245
- package/dist/src/memory/sqlite-wrapper.js +151 -122
- package/dist/src/memory/swarm-memory.js +603 -470
- package/dist/src/memory/test-example.js +134 -126
- package/dist/src/memory/ultra-fast-memory-store.js +821 -622
- package/dist/src/memory/unified-memory-manager.js +437 -356
- package/dist/src/swarm/CodeRefactoringSwarm.js +952 -777
- package/dist/src/utils/__tests__/github-cli-safety-wrapper.test.js +400 -332
- package/dist/src/utils/error-handler.js +2 -36
- package/dist/src/utils/github-cli-safe.js +64 -56
- package/dist/src/utils/github-cli-safety-wrapper.js +546 -451
- package/dist/src/utils/npx-isolated-cache.js +119 -104
- package/dist/src/utils/preference-manager.js +652 -622
- package/dist/src/utils/timezone-utils.js +105 -86
- package/dist/src/web/api/apm-routes.js +353 -0
- package/dist/src/web/api/config/api-config.js +184 -0
- package/dist/src/web/api/middleware/auth.js +203 -0
- package/dist/src/web/api/middleware/cache.js +273 -0
- package/dist/src/web/api/middleware/error-handler.js +257 -0
- package/dist/src/web/api/middleware/request-logger.js +215 -0
- package/dist/src/web/api/middleware/validation.js +323 -0
- package/dist/src/web/api/routes/events.js +463 -0
- package/dist/src/web/api/routes/hierarchy.js +300 -0
- package/dist/src/web/api/routes/index.js +12 -0
- package/dist/src/web/api/routes/metrics.js +559 -0
- package/dist/src/web/api/routes/parallel-status.js +359 -0
- package/dist/src/web/api/routes/status.js +448 -0
- package/dist/src/web/api/server.js +462 -0
- package/dist/src/web/dashboard/hooks/useWebSocket.js +383 -0
- package/dist/src/web/dashboard/index.js +85 -0
- package/dist/src/web/dashboard/realtime/CustomSyncManager.js +439 -0
- package/dist/src/web/dashboard/realtime/NativeWebSocketManager.js +323 -0
- package/dist/src/web/dashboard/realtime/PerformanceBenchmark.js +527 -0
- package/dist/src/web/dashboard/realtime/RealtimeCommunicationManager.js +474 -0
- package/dist/src/web/dashboard/realtime/RealtimeServer.js +666 -0
- package/dist/src/web/dashboard/realtime/SSEManager.js +426 -0
- package/dist/src/web/dashboard/types.js +4 -0
- package/dist/src/web/messaging/agent-status-tracker.js +453 -0
- package/dist/src/web/messaging/human-intervention-system.js +305 -0
- package/dist/src/web/messaging/message-filter.js +302 -0
- package/dist/src/web/messaging/swarm-message-router.js +324 -0
- package/dist/src/web/messaging/transparency-logger.js +421 -0
- package/dist/src/web/portal-server.js +460 -0
- package/dist/src/web/server.js +322 -0
- package/dist/src/web/websocket/apm-websocket-handler.js +453 -0
- package/dist/src/web/websocket/websocket-manager.js +780 -0
- package/package.json +5 -3
- package/dist/src/cli/minimal-main.js +0 -22
- package/dist/src/enterprise/analytics-manager.js +0 -1135
- package/dist/src/enterprise/audit-manager.js +0 -1115
- package/dist/src/enterprise/cloud-manager.js +0 -891
- package/dist/src/enterprise/deployment-manager.js +0 -966
- package/dist/src/enterprise/index.js +0 -6
- package/dist/src/enterprise/project-manager.js +0 -584
- package/dist/src/enterprise/security-manager.js +0 -991
- package/dist/src/migration/index.js +0 -92
- package/dist/src/migration/logger.js +0 -121
- package/dist/src/migration/migration-analyzer.js +0 -268
- package/dist/src/migration/migration-runner.js +0 -522
- package/dist/src/migration/migration-validator.js +0 -285
- package/dist/src/migration/progress-reporter.js +0 -150
- package/dist/src/migration/rollback-manager.js +0 -321
- package/dist/src/migration/tests/migration-system.test.js +0 -7
- package/dist/src/migration/types.js +0 -3
- package/dist/src/swarm/__tests__/integration.test.js +0 -227
- package/dist/src/swarm/__tests__/prompt-copier.test.js +0 -344
- package/dist/src/swarm/advanced-orchestrator.js +0 -1095
- package/dist/src/swarm/claude-code-interface.js +0 -961
- package/dist/src/swarm/claude-flow-executor.js +0 -229
- package/dist/src/swarm/consensus-coordinator.js +0 -475
- package/dist/src/swarm/coordinator.js +0 -2993
- package/dist/src/swarm/direct-executor.js +0 -1180
- package/dist/src/swarm/error-recovery/advanced-error-detection.js +0 -691
- package/dist/src/swarm/error-recovery/automated-recovery-workflows.js +0 -998
- package/dist/src/swarm/error-recovery/error-recovery-coordinator.js +0 -1197
- package/dist/src/swarm/error-recovery/recovery-monitoring.js +0 -772
- package/dist/src/swarm/error-recovery/resilience-architecture.js +0 -714
- package/dist/src/swarm/error-recovery/self-healing-mechanisms.js +0 -1319
- package/dist/src/swarm/error-recovery/test-error-recovery-effectiveness.js +0 -808
- package/dist/src/swarm/executor-v2.js +0 -322
- package/dist/src/swarm/executor.js +0 -815
- package/dist/src/swarm/hive-mind-integration.js +0 -703
- package/dist/src/swarm/index.js +0 -41
- package/dist/src/swarm/json-output-aggregator.js +0 -267
- package/dist/src/swarm/large-scale-coordinator.js +0 -542
- package/dist/src/swarm/mcp-integration-wrapper.js +0 -628
- package/dist/src/swarm/memory.js +0 -1117
- package/dist/src/swarm/optimizations/__tests__/optimization.test.js +0 -348
- package/dist/src/swarm/optimizations/async-file-manager.js +0 -285
- package/dist/src/swarm/optimizations/circular-buffer.js +0 -162
- package/dist/src/swarm/optimizations/connection-pool.js +0 -244
- package/dist/src/swarm/optimizations/index.js +0 -28
- package/dist/src/swarm/optimizations/optimized-executor.js +0 -320
- package/dist/src/swarm/optimizations/ttl-map.js +0 -234
- package/dist/src/swarm/prompt-cli.js +0 -200
- package/dist/src/swarm/prompt-copier-enhanced.js +0 -202
- package/dist/src/swarm/prompt-copier.js +0 -381
- package/dist/src/swarm/prompt-manager.js +0 -295
- package/dist/src/swarm/prompt-utils.js +0 -310
- package/dist/src/swarm/result-aggregator.js +0 -718
- package/dist/src/swarm/sparc-executor.js +0 -1568
- package/dist/src/swarm/strategies/auto.js +0 -758
- package/dist/src/swarm/strategies/base.js +0 -128
- package/dist/src/swarm/strategies/research.js +0 -914
- package/dist/src/swarm/strategies/strategy-metrics-patch.js +0 -2
- package/dist/src/swarm/types.js +0 -52
- package/dist/src/swarm/workers/copy-worker.js +0 -56
- package/dist/src/validators/epic-config-schema.js +0 -214
- package/dist/src/validators/index.js +0 -10
- package/dist/src/validators/swarm-init-validator.js +0 -259
- package/dist/src/validators/todowrite-batching-validator.js +0 -215
- package/dist/src/validators/todowrite-integration.js +0 -187
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/documentSymbols/browser/documentSymbols.js +0 -23
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteContribution.js +0 -57
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js +0 -401
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/dropOrPasteInto/browser/defaultProviders.js +0 -181
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/dropOrPasteInto/browser/dropIntoEditorContribution.js +0 -44
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/dropOrPasteInto/browser/dropIntoEditorController.js +0 -157
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/dropOrPasteInto/browser/edit.js +0 -71
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/editorState/browser/editorState.js +0 -112
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/find/browser/findController.js +0 -990
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/find/browser/findDecorations.js +0 -296
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/find/browser/findModel.js +0 -488
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/find/browser/findOptionsWidget.js +0 -138
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/find/browser/findState.js +0 -243
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/find/browser/findWidget.js +0 -1177
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/folding/browser/folding.js +0 -1093
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/folding/browser/foldingDecorations.js +0 -133
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/folding/browser/foldingModel.js +0 -538
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/folding/browser/foldingRanges.js +0 -351
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/fontZoom/browser/fontZoom.js +0 -49
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/format/browser/format.js +0 -360
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/format/browser/formatActions.js +0 -263
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/format/browser/formattingEdit.js +0 -54
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/gotoSymbol/browser/link/clickLinkGesture.js +0 -149
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/hover/browser/contentHover.js +0 -874
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/inlineCompletions/browser/commandIds.js +0 -7
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/inlineCompletions/browser/commands.js +0 -199
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/linesOperations/browser/copyLinesCommand.js +0 -70
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/quickAccess/browser/commandsQuickAccess.js +0 -26
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/quickAccess/browser/editorNavigationQuickAccess.js +0 -153
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/readOnlyMessage/browser/contribution.js +0 -33
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/semanticTokens/browser/documentSemanticTokens.js +0 -354
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/smartSelect/browser/bracketSelections.js +0 -146
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/suggest/browser/completionModel.js +0 -224
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/unicodeHighlighter/browser/bannerController.js +0 -119
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/edcore.main.js +0 -14
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/editor.all.js +0 -63
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/editor.api.js +0 -55
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/editor.main.js +0 -7
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/editor.worker.js +0 -25
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/standalone/browser/colorizer.js +0 -118
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/language/css/css.worker.js +0 -36869
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/language/css/cssMode.js +0 -2035
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/accessibility/browser/accessibilityService.js +0 -88
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/accessibility/common/accessibility.js +0 -9
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/action/common/action.js +0 -7
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/action/common/actionCommonCategories.js +0 -13
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/actionWidget/browser/actionList.js +0 -276
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/actionWidget/browser/actionWidget.js +0 -248
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/actionWidget/common/actionWidget.js +0 -5
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/actions/common/actions.js +0 -409
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/audioCues/browser/audioCueService.js +0 -176
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/clipboard/browser/clipboardService.js +0 -141
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/clipboard/common/clipboardService.js +0 -6
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/commands/common/commands.js +0 -80
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/configuration/common/configuration.js +0 -86
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/configuration/common/configurationModels.js +0 -554
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/configuration/common/configurationRegistry.js +0 -317
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/configuration/common/configurations.js +0 -41
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextkey/browser/contextKeyService.js +0 -432
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextkey/common/contextkey.js +0 -1547
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextkey/common/contextkeys.js +0 -18
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextview/browser/contextMenuHandler.js +0 -124
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextview/browser/contextMenuService.js +0 -101
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextview/browser/contextView.js +0 -7
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextview/browser/contextViewService.js +0 -72
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/dialogs/common/dialogs.js +0 -2
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/dnd/browser/dnd.js +0 -36
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/editor/common/editor.js +0 -17
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/environment/common/environment.js +0 -2
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/extensions/common/extensions.js +0 -47
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/files/common/files.js +0 -9
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/history/browser/contextScopedHistoryWidget.js +0 -105
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/instantiation/common/descriptors.js +0 -11
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/instantiation/common/extensions.js +0 -15
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/keybinding/common/abstractKeybindingService.js +0 -277
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/keybinding/common/baseResolvedKeybinding.js +0 -53
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/quickinput/browser/commandsQuickAccess.js +0 -354
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/theme/browser/defaultStyles.js +0 -162
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/theme/common/colorRegistry.js +0 -482
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/abap/abap.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/apex/apex.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/azcli/azcli.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/bat/bat.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/bicep/bicep.js +0 -11
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/cameligo/cameligo.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/clojure/clojure.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/coffee/coffee.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/cpp/cpp.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/csharp/csharp.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/csp/csp.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/css/css.js +0 -12
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/cypher/cypher.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/dart/dart.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/dockerfile/dockerfile.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/ecl/ecl.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/elixir/elixir.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/flow9/flow9.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.js +0 -745
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.de.js +0 -31
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.es.js +0 -31
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.fr.js +0 -29
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.it.js +0 -29
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.ja.js +0 -31
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.js +0 -29
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.ko.js +0 -29
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.ru.js +0 -31
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.zh-cn.js +0 -31
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.zh-tw.js +0 -29
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/language/css/cssMode.js +0 -13
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/language/css/cssWorker.js +0 -81
- package/dist/src/web/frontend/node_modules/.multicast-dns-iKseM9bB/cli.js +0 -64
- package/dist/src/web/frontend/node_modules/.multicast-dns-iKseM9bB/example.js +0 -36
- package/dist/src/web/frontend/node_modules/.multicast-dns-iKseM9bB/index.js +0 -205
- package/dist/src/web/frontend/node_modules/.multicast-dns-iKseM9bB/test.js +0 -260
- package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/async/index.browser.js +0 -34
- package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/async/index.js +0 -35
- package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/async/index.native.js +0 -26
- package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/index.browser.js +0 -34
- package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/index.js +0 -45
- package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/nanoid.js +0 -1
- package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/non-secure/index.js +0 -21
- package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/url-alphabet/index.js +0 -3
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/bin/nodemon.js +0 -16
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/cli/index.js +0 -49
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/cli/parse.js +0 -230
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/config/command.js +0 -43
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/config/defaults.js +0 -34
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/config/exec.js +0 -234
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/config/index.js +0 -93
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/config/load.js +0 -225
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/help/index.js +0 -27
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/index.js +0 -1
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/monitor/index.js +0 -4
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/monitor/match.js +0 -287
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/monitor/run.js +0 -562
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/monitor/signals.js +0 -34
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/monitor/watch.js +0 -244
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/nodemon.js +0 -317
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/rules/add.js +0 -89
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/rules/index.js +0 -53
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/rules/parse.js +0 -43
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/spawn.js +0 -74
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/utils/bus.js +0 -44
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/utils/clone.js +0 -40
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/utils/colour.js +0 -26
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/utils/index.js +0 -103
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/utils/log.js +0 -82
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/utils/merge.js +0 -47
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/version.js +0 -100
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/node_modules/brace-expansion/index.js +0 -201
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/node_modules/has-flag/index.js +0 -8
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/node_modules/minimatch/minimatch.js +0 -947
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/node_modules/supports-color/browser.js +0 -5
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/node_modules/supports-color/index.js +0 -131
- package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/bin/pidtree.js +0 -128
- package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/index.js +0 -49
- package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/lib/bin.js +0 -61
- package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/lib/get.js +0 -45
- package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/lib/pidtree.js +0 -104
- package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/lib/ps.js +0 -47
- package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/lib/wmic.js +0 -49
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/doc.js +0 -1270
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/acorn.js +0 -15
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/angular.js +0 -2
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/babel.js +0 -15
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/estree.js +0 -36
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/flow.js +0 -19
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/glimmer.js +0 -29
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/graphql.js +0 -29
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/html.js +0 -22
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/markdown.js +0 -63
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/meriyah.js +0 -4
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/postcss.js +0 -54
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/typescript.js +0 -20
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/yaml.js +0 -160
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/standalone.js +0 -34
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/bin/react-scripts.js +0 -58
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/env.js +0 -112
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/getHttpsConfig.js +0 -74
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/jest/babelTransform.js +0 -37
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/jest/cssTransform.js +0 -22
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/jest/fileTransform.js +0 -40
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/modules.js +0 -142
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/paths.js +0 -153
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/webpack/persistentCache/createEnvironmentHash.js +0 -9
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/webpack.config.js +0 -796
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/webpackDevServer.config.js +0 -135
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/scripts/build.js +0 -225
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/scripts/eject.js +0 -340
|
@@ -1,1722 +1,1493 @@
|
|
|
1
1
|
// SPARC Architecture Phase
|
|
2
2
|
// Design system architecture and component planning
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
import { SparcPhase } from './phase-base.js';
|
|
5
|
+
|
|
4
6
|
export class SparcArchitecture extends SparcPhase {
|
|
5
|
-
|
|
7
|
+
constructor(taskDescription, options) {
|
|
8
|
+
super('architecture', taskDescription, options);
|
|
9
|
+
this.components = [];
|
|
10
|
+
this.designPatterns = [];
|
|
11
|
+
this.systemDesign = null;
|
|
12
|
+
this.dataModel = null;
|
|
13
|
+
this.apiDesign = null;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
6
17
|
* Execute architecture phase
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
18
|
+
*/
|
|
19
|
+
async execute() {
|
|
20
|
+
console.log('🏗️ Starting Architecture Phase');
|
|
21
|
+
|
|
22
|
+
await this.initializePhase();
|
|
23
|
+
|
|
24
|
+
const result = {
|
|
25
|
+
systemDesign: null,
|
|
26
|
+
components: [],
|
|
27
|
+
designPatterns: [],
|
|
28
|
+
dataModel: null,
|
|
29
|
+
apiDesign: null,
|
|
30
|
+
deploymentArchitecture: null,
|
|
31
|
+
securityArchitecture: null,
|
|
32
|
+
scalabilityPlan: null,
|
|
33
|
+
integrationPoints: [],
|
|
34
|
+
qualityAttributes: {},
|
|
35
|
+
architecturalDecisions: [],
|
|
36
|
+
riskAssessment: [],
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
try {
|
|
40
|
+
// Load previous phases
|
|
41
|
+
const specification = await this.retrieveFromMemory('specification_complete');
|
|
42
|
+
const pseudocode = await this.retrieveFromMemory('pseudocode_complete');
|
|
43
|
+
|
|
44
|
+
if (!specification || !pseudocode) {
|
|
45
|
+
throw new Error('Specification and Pseudocode phases must be completed first');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Design system architecture
|
|
49
|
+
result.systemDesign = await this.designSystemArchitecture(specification, pseudocode);
|
|
50
|
+
|
|
51
|
+
// Define components
|
|
52
|
+
result.components = await this.defineComponents(specification, pseudocode);
|
|
53
|
+
|
|
54
|
+
// Select design patterns
|
|
55
|
+
result.designPatterns = await this.selectDesignPatterns(specification, pseudocode);
|
|
56
|
+
|
|
57
|
+
// Design data model
|
|
58
|
+
result.dataModel = await this.designDataModel(specification);
|
|
59
|
+
|
|
60
|
+
// Design API structure
|
|
61
|
+
result.apiDesign = await this.designApiStructure(specification);
|
|
62
|
+
|
|
63
|
+
// Plan deployment architecture
|
|
64
|
+
result.deploymentArchitecture = await this.planDeploymentArchitecture(specification);
|
|
65
|
+
|
|
66
|
+
// Design security architecture
|
|
67
|
+
result.securityArchitecture = await this.designSecurityArchitecture(specification);
|
|
68
|
+
|
|
69
|
+
// Plan scalability
|
|
70
|
+
result.scalabilityPlan = await this.planScalability(specification);
|
|
71
|
+
|
|
72
|
+
// Identify integration points
|
|
73
|
+
result.integrationPoints = await this.identifyIntegrationPoints(specification);
|
|
74
|
+
|
|
75
|
+
// Define quality attributes
|
|
76
|
+
result.qualityAttributes = await this.defineQualityAttributes(specification);
|
|
77
|
+
|
|
78
|
+
// Document architectural decisions
|
|
79
|
+
result.architecturalDecisions = await this.documentArchitecturalDecisions(result);
|
|
80
|
+
|
|
81
|
+
// Assess risks
|
|
82
|
+
result.riskAssessment = await this.assessArchitecturalRisks(result);
|
|
83
|
+
|
|
84
|
+
// Generate architecture document
|
|
85
|
+
await this.generateArchitectureDocument(result);
|
|
86
|
+
|
|
87
|
+
// Store in memory
|
|
88
|
+
await this.storeInMemory('architecture_complete', result);
|
|
89
|
+
|
|
90
|
+
console.log('✅ Architecture phase completed');
|
|
91
|
+
return result;
|
|
92
|
+
} catch (error) {
|
|
93
|
+
console.error('❌ Architecture phase failed:', error.message);
|
|
94
|
+
throw error;
|
|
65
95
|
}
|
|
66
|
-
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
67
99
|
* Design system architecture
|
|
68
|
-
*/
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
{
|
|
123
|
-
name: 'Infrastructure Layer',
|
|
124
|
-
responsibility: 'Cross-cutting concerns'
|
|
125
|
-
}
|
|
126
|
-
];
|
|
127
|
-
} else if (hasApiRequirements) {
|
|
128
|
-
architecture.style = 'layered';
|
|
129
|
-
architecture.layers = [
|
|
130
|
-
{
|
|
131
|
-
name: 'API Layer',
|
|
132
|
-
responsibility: 'External interface and contracts'
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
name: 'Business Layer',
|
|
136
|
-
responsibility: 'Core business logic'
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
name: 'Data Layer',
|
|
140
|
-
responsibility: 'Data persistence and retrieval'
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
name: 'Infrastructure Layer',
|
|
144
|
-
responsibility: 'Logging, monitoring, security'
|
|
145
|
-
}
|
|
146
|
-
];
|
|
147
|
-
} else {
|
|
148
|
-
architecture.style = 'modular';
|
|
149
|
-
architecture.layers = [
|
|
150
|
-
{
|
|
151
|
-
name: 'Interface Layer',
|
|
152
|
-
responsibility: 'External interactions'
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
name: 'Processing Layer',
|
|
156
|
-
responsibility: 'Core processing logic'
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
name: 'Storage Layer',
|
|
160
|
-
responsibility: 'Data management'
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
name: 'Utility Layer',
|
|
164
|
-
responsibility: 'Common utilities and helpers'
|
|
165
|
-
}
|
|
166
|
-
];
|
|
167
|
-
}
|
|
168
|
-
// Define data flow
|
|
169
|
-
architecture.dataFlow = this.defineDataFlow(architecture.layers);
|
|
170
|
-
// Define control flow
|
|
171
|
-
architecture.controlFlow = this.defineControlFlow(architecture.layers);
|
|
172
|
-
// Define boundaries
|
|
173
|
-
architecture.boundaries = this.defineBoundaries(architecture.layers);
|
|
174
|
-
return architecture;
|
|
100
|
+
*/
|
|
101
|
+
async designSystemArchitecture(specification, pseudocode) {
|
|
102
|
+
const architecture = {
|
|
103
|
+
style: 'layered',
|
|
104
|
+
layers: [],
|
|
105
|
+
components: [],
|
|
106
|
+
dataFlow: [],
|
|
107
|
+
controlFlow: [],
|
|
108
|
+
boundaries: [],
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
// Determine architecture style based on requirements
|
|
112
|
+
const requirements = specification.requirements || [];
|
|
113
|
+
const hasApiRequirements = requirements.some((req) => req.toLowerCase().includes('api'));
|
|
114
|
+
const hasUiRequirements = requirements.some((req) => req.toLowerCase().includes('ui'));
|
|
115
|
+
const hasDataRequirements = requirements.some((req) => req.toLowerCase().includes('data'));
|
|
116
|
+
const hasDistributedRequirements = requirements.some(
|
|
117
|
+
(req) =>
|
|
118
|
+
req.toLowerCase().includes('distributed') || req.toLowerCase().includes('microservice'),
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
if (hasDistributedRequirements) {
|
|
122
|
+
architecture.style = 'microservices';
|
|
123
|
+
architecture.layers = [
|
|
124
|
+
{ name: 'API Gateway', responsibility: 'Request routing and authentication' },
|
|
125
|
+
{ name: 'Service Layer', responsibility: 'Business logic microservices' },
|
|
126
|
+
{ name: 'Data Layer', responsibility: 'Database and storage services' },
|
|
127
|
+
{ name: 'Infrastructure Layer', responsibility: 'Monitoring and deployment' },
|
|
128
|
+
];
|
|
129
|
+
} else if (hasApiRequirements && hasUiRequirements) {
|
|
130
|
+
architecture.style = 'mvc';
|
|
131
|
+
architecture.layers = [
|
|
132
|
+
{ name: 'Presentation Layer', responsibility: 'User interface and user experience' },
|
|
133
|
+
{ name: 'Controller Layer', responsibility: 'Request handling and routing' },
|
|
134
|
+
{ name: 'Service Layer', responsibility: 'Business logic and processing' },
|
|
135
|
+
{ name: 'Data Access Layer', responsibility: 'Database operations' },
|
|
136
|
+
{ name: 'Infrastructure Layer', responsibility: 'Cross-cutting concerns' },
|
|
137
|
+
];
|
|
138
|
+
} else if (hasApiRequirements) {
|
|
139
|
+
architecture.style = 'layered';
|
|
140
|
+
architecture.layers = [
|
|
141
|
+
{ name: 'API Layer', responsibility: 'External interface and contracts' },
|
|
142
|
+
{ name: 'Business Layer', responsibility: 'Core business logic' },
|
|
143
|
+
{ name: 'Data Layer', responsibility: 'Data persistence and retrieval' },
|
|
144
|
+
{ name: 'Infrastructure Layer', responsibility: 'Logging, monitoring, security' },
|
|
145
|
+
];
|
|
146
|
+
} else {
|
|
147
|
+
architecture.style = 'modular';
|
|
148
|
+
architecture.layers = [
|
|
149
|
+
{ name: 'Interface Layer', responsibility: 'External interactions' },
|
|
150
|
+
{ name: 'Processing Layer', responsibility: 'Core processing logic' },
|
|
151
|
+
{ name: 'Storage Layer', responsibility: 'Data management' },
|
|
152
|
+
{ name: 'Utility Layer', responsibility: 'Common utilities and helpers' },
|
|
153
|
+
];
|
|
175
154
|
}
|
|
176
|
-
|
|
155
|
+
|
|
156
|
+
// Define data flow
|
|
157
|
+
architecture.dataFlow = this.defineDataFlow(architecture.layers);
|
|
158
|
+
|
|
159
|
+
// Define control flow
|
|
160
|
+
architecture.controlFlow = this.defineControlFlow(architecture.layers);
|
|
161
|
+
|
|
162
|
+
// Define boundaries
|
|
163
|
+
architecture.boundaries = this.defineBoundaries(architecture.layers);
|
|
164
|
+
|
|
165
|
+
return architecture;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
177
169
|
* Define data flow
|
|
178
|
-
*/
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
170
|
+
*/
|
|
171
|
+
defineDataFlow(layers) {
|
|
172
|
+
const dataFlow = [];
|
|
173
|
+
|
|
174
|
+
for (let i = 0; i < layers.length - 1; i++) {
|
|
175
|
+
dataFlow.push({
|
|
176
|
+
from: layers[i].name,
|
|
177
|
+
to: layers[i + 1].name,
|
|
178
|
+
direction: 'downstream',
|
|
179
|
+
dataType: 'processed data',
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
dataFlow.push({
|
|
183
|
+
from: layers[i + 1].name,
|
|
184
|
+
to: layers[i].name,
|
|
185
|
+
direction: 'upstream',
|
|
186
|
+
dataType: 'results/responses',
|
|
187
|
+
});
|
|
195
188
|
}
|
|
196
|
-
|
|
189
|
+
|
|
190
|
+
return dataFlow;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
197
194
|
* Define control flow
|
|
198
|
-
*/
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
'forward'
|
|
212
|
-
],
|
|
213
|
-
outcomes: index === layers.length - 1 ? [
|
|
214
|
-
'final response'
|
|
215
|
-
] : [
|
|
216
|
-
`trigger ${layers[index + 1].name}`
|
|
217
|
-
]
|
|
218
|
-
}));
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
195
|
+
*/
|
|
196
|
+
defineControlFlow(layers) {
|
|
197
|
+
return layers.map((layer, index) => ({
|
|
198
|
+
layer: layer.name,
|
|
199
|
+
order: index + 1,
|
|
200
|
+
triggers: index === 0 ? ['external request'] : [`${layers[index - 1].name} completion`],
|
|
201
|
+
actions: ['process', 'validate', 'transform', 'forward'],
|
|
202
|
+
outcomes:
|
|
203
|
+
index === layers.length - 1 ? ['final response'] : [`trigger ${layers[index + 1].name}`],
|
|
204
|
+
}));
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
221
208
|
* Define boundaries
|
|
222
|
-
*/
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}
|
|
231
|
-
|
|
209
|
+
*/
|
|
210
|
+
defineBoundaries(layers) {
|
|
211
|
+
return layers.map((layer) => ({
|
|
212
|
+
layer: layer.name,
|
|
213
|
+
type: 'logical',
|
|
214
|
+
encapsulation: 'interface-based',
|
|
215
|
+
dependencies: 'unidirectional',
|
|
216
|
+
contracts: 'well-defined APIs',
|
|
217
|
+
}));
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
232
221
|
* Define components
|
|
233
|
-
*/
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
// Remove duplicates and merge similar components
|
|
250
|
-
const uniqueComponents = this.mergeComponents(components);
|
|
251
|
-
return uniqueComponents;
|
|
222
|
+
*/
|
|
223
|
+
async defineComponents(specification, pseudocode) {
|
|
224
|
+
const components = [];
|
|
225
|
+
const requirements = specification.requirements || [];
|
|
226
|
+
const functions = pseudocode.pseudocode || [];
|
|
227
|
+
|
|
228
|
+
// Create components based on functional requirements
|
|
229
|
+
for (const requirement of requirements) {
|
|
230
|
+
const component = this.createComponentFromRequirement(requirement);
|
|
231
|
+
components.push(component);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// Create components based on pseudocode functions
|
|
235
|
+
for (const func of functions) {
|
|
236
|
+
const component = this.createComponentFromFunction(func);
|
|
237
|
+
components.push(component);
|
|
252
238
|
}
|
|
253
|
-
|
|
239
|
+
|
|
240
|
+
// Add infrastructure components
|
|
241
|
+
components.push(...this.createInfrastructureComponents());
|
|
242
|
+
|
|
243
|
+
// Remove duplicates and merge similar components
|
|
244
|
+
const uniqueComponents = this.mergeComponents(components);
|
|
245
|
+
|
|
246
|
+
return uniqueComponents;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
254
250
|
* Create component from requirement
|
|
255
|
-
*/
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
],
|
|
310
|
-
complexity: 'medium'
|
|
311
|
-
};
|
|
312
|
-
} else if (reqLower.includes('validate')) {
|
|
313
|
-
return {
|
|
314
|
-
name: 'ValidationService',
|
|
315
|
-
type: 'service',
|
|
316
|
-
responsibility: 'Validate input data and business rules',
|
|
317
|
-
interfaces: [
|
|
318
|
-
'IValidationService'
|
|
319
|
-
],
|
|
320
|
-
dependencies: [
|
|
321
|
-
'ValidationRules',
|
|
322
|
-
'ErrorHandler'
|
|
323
|
-
],
|
|
324
|
-
patterns: [
|
|
325
|
-
'Strategy',
|
|
326
|
-
'Chain of Responsibility'
|
|
327
|
-
],
|
|
328
|
-
complexity: 'low'
|
|
329
|
-
};
|
|
330
|
-
} else {
|
|
331
|
-
return {
|
|
332
|
-
name: 'GenericService',
|
|
333
|
-
type: 'service',
|
|
334
|
-
responsibility: 'Handle general business logic',
|
|
335
|
-
interfaces: [
|
|
336
|
-
'IService'
|
|
337
|
-
],
|
|
338
|
-
dependencies: [
|
|
339
|
-
'CommonUtilities'
|
|
340
|
-
],
|
|
341
|
-
patterns: [
|
|
342
|
-
'Service'
|
|
343
|
-
],
|
|
344
|
-
complexity: 'low'
|
|
345
|
-
};
|
|
346
|
-
}
|
|
251
|
+
*/
|
|
252
|
+
createComponentFromRequirement(requirement) {
|
|
253
|
+
const reqLower = requirement.toLowerCase();
|
|
254
|
+
|
|
255
|
+
if (reqLower.includes('api')) {
|
|
256
|
+
return {
|
|
257
|
+
name: 'APIController',
|
|
258
|
+
type: 'controller',
|
|
259
|
+
responsibility: 'Handle API requests and responses',
|
|
260
|
+
interfaces: ['HTTP', 'REST'],
|
|
261
|
+
dependencies: ['AuthenticationService', 'ValidationService'],
|
|
262
|
+
patterns: ['Controller', 'Facade'],
|
|
263
|
+
complexity: 'medium',
|
|
264
|
+
};
|
|
265
|
+
} else if (reqLower.includes('authenticate')) {
|
|
266
|
+
return {
|
|
267
|
+
name: 'AuthenticationService',
|
|
268
|
+
type: 'service',
|
|
269
|
+
responsibility: 'Manage user authentication and authorization',
|
|
270
|
+
interfaces: ['IAuthenticationService'],
|
|
271
|
+
dependencies: ['UserRepository', 'TokenManager'],
|
|
272
|
+
patterns: ['Service', 'Strategy'],
|
|
273
|
+
complexity: 'high',
|
|
274
|
+
};
|
|
275
|
+
} else if (reqLower.includes('data')) {
|
|
276
|
+
return {
|
|
277
|
+
name: 'DataRepository',
|
|
278
|
+
type: 'repository',
|
|
279
|
+
responsibility: 'Manage data persistence and retrieval',
|
|
280
|
+
interfaces: ['IRepository'],
|
|
281
|
+
dependencies: ['DatabaseConnection', 'DataMapper'],
|
|
282
|
+
patterns: ['Repository', 'Unit of Work'],
|
|
283
|
+
complexity: 'medium',
|
|
284
|
+
};
|
|
285
|
+
} else if (reqLower.includes('validate')) {
|
|
286
|
+
return {
|
|
287
|
+
name: 'ValidationService',
|
|
288
|
+
type: 'service',
|
|
289
|
+
responsibility: 'Validate input data and business rules',
|
|
290
|
+
interfaces: ['IValidationService'],
|
|
291
|
+
dependencies: ['ValidationRules', 'ErrorHandler'],
|
|
292
|
+
patterns: ['Strategy', 'Chain of Responsibility'],
|
|
293
|
+
complexity: 'low',
|
|
294
|
+
};
|
|
295
|
+
} else {
|
|
296
|
+
return {
|
|
297
|
+
name: 'GenericService',
|
|
298
|
+
type: 'service',
|
|
299
|
+
responsibility: 'Handle general business logic',
|
|
300
|
+
interfaces: ['IService'],
|
|
301
|
+
dependencies: ['CommonUtilities'],
|
|
302
|
+
patterns: ['Service'],
|
|
303
|
+
complexity: 'low',
|
|
304
|
+
};
|
|
347
305
|
}
|
|
348
|
-
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
349
309
|
* Create component from function
|
|
350
|
-
*/
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
310
|
+
*/
|
|
311
|
+
createComponentFromFunction(func) {
|
|
312
|
+
return {
|
|
313
|
+
name: this.toPascalCase(func.function) + 'Component',
|
|
314
|
+
type: 'component',
|
|
315
|
+
responsibility: func.description,
|
|
316
|
+
interfaces: [`I${this.toPascalCase(func.function)}`],
|
|
317
|
+
dependencies: this.extractDependencies(func.steps),
|
|
318
|
+
patterns: this.inferPatterns(func.steps),
|
|
319
|
+
complexity: func.complexity ? func.complexity.level : 'medium',
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/**
|
|
364
324
|
* Create infrastructure components
|
|
365
|
-
*/
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
patterns: [
|
|
409
|
-
'Strategy',
|
|
410
|
-
'Chain of Responsibility'
|
|
411
|
-
],
|
|
412
|
-
complexity: 'medium'
|
|
413
|
-
},
|
|
414
|
-
{
|
|
415
|
-
name: 'CacheManager',
|
|
416
|
-
type: 'utility',
|
|
417
|
-
responsibility: 'Caching and performance optimization',
|
|
418
|
-
interfaces: [
|
|
419
|
-
'ICacheManager'
|
|
420
|
-
],
|
|
421
|
-
dependencies: [
|
|
422
|
-
'CacheProvider'
|
|
423
|
-
],
|
|
424
|
-
patterns: [
|
|
425
|
-
'Proxy',
|
|
426
|
-
'Decorator'
|
|
427
|
-
],
|
|
428
|
-
complexity: 'medium'
|
|
429
|
-
}
|
|
430
|
-
];
|
|
431
|
-
}
|
|
432
|
-
/**
|
|
325
|
+
*/
|
|
326
|
+
createInfrastructureComponents() {
|
|
327
|
+
return [
|
|
328
|
+
{
|
|
329
|
+
name: 'Logger',
|
|
330
|
+
type: 'utility',
|
|
331
|
+
responsibility: 'Centralized logging and monitoring',
|
|
332
|
+
interfaces: ['ILogger'],
|
|
333
|
+
dependencies: ['LoggingProvider'],
|
|
334
|
+
patterns: ['Singleton', 'Factory'],
|
|
335
|
+
complexity: 'low',
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
name: 'ConfigurationManager',
|
|
339
|
+
type: 'utility',
|
|
340
|
+
responsibility: 'Manage application configuration',
|
|
341
|
+
interfaces: ['IConfigurationManager'],
|
|
342
|
+
dependencies: ['EnvironmentProvider'],
|
|
343
|
+
patterns: ['Singleton'],
|
|
344
|
+
complexity: 'low',
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
name: 'ErrorHandler',
|
|
348
|
+
type: 'utility',
|
|
349
|
+
responsibility: 'Global error handling and reporting',
|
|
350
|
+
interfaces: ['IErrorHandler'],
|
|
351
|
+
dependencies: ['Logger'],
|
|
352
|
+
patterns: ['Strategy', 'Chain of Responsibility'],
|
|
353
|
+
complexity: 'medium',
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
name: 'CacheManager',
|
|
357
|
+
type: 'utility',
|
|
358
|
+
responsibility: 'Caching and performance optimization',
|
|
359
|
+
interfaces: ['ICacheManager'],
|
|
360
|
+
dependencies: ['CacheProvider'],
|
|
361
|
+
patterns: ['Proxy', 'Decorator'],
|
|
362
|
+
complexity: 'medium',
|
|
363
|
+
},
|
|
364
|
+
];
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/**
|
|
433
368
|
* Merge similar components
|
|
434
|
-
*/
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
...component.interfaces
|
|
451
|
-
])
|
|
452
|
-
];
|
|
453
|
-
existing.patterns = [
|
|
454
|
-
...new Set([
|
|
455
|
-
...existing.patterns,
|
|
456
|
-
...component.patterns
|
|
457
|
-
])
|
|
458
|
-
];
|
|
459
|
-
} else {
|
|
460
|
-
componentMap.set(key, component);
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
return Array.from(componentMap.values());
|
|
369
|
+
*/
|
|
370
|
+
mergeComponents(components) {
|
|
371
|
+
const componentMap = new Map();
|
|
372
|
+
|
|
373
|
+
for (const component of components) {
|
|
374
|
+
const key = component.name;
|
|
375
|
+
|
|
376
|
+
if (componentMap.has(key)) {
|
|
377
|
+
const existing = componentMap.get(key);
|
|
378
|
+
// Merge dependencies and interfaces
|
|
379
|
+
existing.dependencies = [...new Set([...existing.dependencies, ...component.dependencies])];
|
|
380
|
+
existing.interfaces = [...new Set([...existing.interfaces, ...component.interfaces])];
|
|
381
|
+
existing.patterns = [...new Set([...existing.patterns, ...component.patterns])];
|
|
382
|
+
} else {
|
|
383
|
+
componentMap.set(key, component);
|
|
384
|
+
}
|
|
464
385
|
}
|
|
465
|
-
|
|
386
|
+
|
|
387
|
+
return Array.from(componentMap.values());
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/**
|
|
466
391
|
* Convert to PascalCase
|
|
467
|
-
*/
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
392
|
+
*/
|
|
393
|
+
toPascalCase(str) {
|
|
394
|
+
return str
|
|
395
|
+
.replace(/_([a-z])/g, (match, letter) => letter.toUpperCase())
|
|
396
|
+
.replace(/^([a-z])/, (match, letter) => letter.toUpperCase());
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/**
|
|
471
400
|
* Extract dependencies from steps
|
|
472
|
-
*/
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
...new Set(dependencies)
|
|
483
|
-
];
|
|
401
|
+
*/
|
|
402
|
+
extractDependencies(steps) {
|
|
403
|
+
const dependencies = [];
|
|
404
|
+
|
|
405
|
+
for (const step of steps) {
|
|
406
|
+
if (step.includes('database')) dependencies.push('DatabaseConnection');
|
|
407
|
+
if (step.includes('authenticate')) dependencies.push('AuthenticationService');
|
|
408
|
+
if (step.includes('validate')) dependencies.push('ValidationService');
|
|
409
|
+
if (step.includes('log')) dependencies.push('Logger');
|
|
410
|
+
if (step.includes('cache')) dependencies.push('CacheManager');
|
|
484
411
|
}
|
|
485
|
-
|
|
412
|
+
|
|
413
|
+
return [...new Set(dependencies)];
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/**
|
|
486
417
|
* Infer patterns from steps
|
|
487
|
-
*/
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
418
|
+
*/
|
|
419
|
+
inferPatterns(steps) {
|
|
420
|
+
const patterns = [];
|
|
421
|
+
|
|
422
|
+
if (steps.some((step) => step.includes('CALL'))) patterns.push('Command');
|
|
423
|
+
if (steps.some((step) => step.includes('IF'))) patterns.push('Strategy');
|
|
424
|
+
if (steps.some((step) => step.includes('VALIDATE'))) patterns.push('Chain of Responsibility');
|
|
425
|
+
if (steps.some((step) => step.includes('RETURN'))) patterns.push('Factory');
|
|
426
|
+
|
|
427
|
+
return patterns.length > 0 ? patterns : ['Service'];
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
/**
|
|
498
431
|
* Select design patterns
|
|
499
|
-
*/
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
if (requirements.some((req)=>req.toLowerCase().includes('interface') || req.toLowerCase().includes('adapt'))) {
|
|
519
|
-
patterns.push({
|
|
520
|
-
name: 'Adapter Pattern',
|
|
521
|
-
type: 'structural',
|
|
522
|
-
purpose: 'Allow incompatible interfaces to work together',
|
|
523
|
-
applicability: 'Integration with external systems',
|
|
524
|
-
implementation: 'Wrapper classes implementing target interfaces',
|
|
525
|
-
benefits: [
|
|
526
|
-
'Code reuse',
|
|
527
|
-
'Separation of concerns',
|
|
528
|
-
'Easy integration'
|
|
529
|
-
]
|
|
530
|
-
});
|
|
531
|
-
}
|
|
532
|
-
// Behavioral patterns
|
|
533
|
-
if (requirements.some((req)=>req.toLowerCase().includes('strategy') || req.toLowerCase().includes('algorithm'))) {
|
|
534
|
-
patterns.push({
|
|
535
|
-
name: 'Strategy Pattern',
|
|
536
|
-
type: 'behavioral',
|
|
537
|
-
purpose: 'Define family of algorithms and make them interchangeable',
|
|
538
|
-
applicability: 'Multiple ways to perform operations',
|
|
539
|
-
implementation: 'Strategy interfaces with concrete implementations',
|
|
540
|
-
benefits: [
|
|
541
|
-
'Flexibility',
|
|
542
|
-
'Open/closed principle',
|
|
543
|
-
'Runtime selection'
|
|
544
|
-
]
|
|
545
|
-
});
|
|
546
|
-
}
|
|
547
|
-
// Common patterns for all systems
|
|
548
|
-
patterns.push({
|
|
549
|
-
name: 'Repository Pattern',
|
|
550
|
-
type: 'architectural',
|
|
551
|
-
purpose: 'Separate data access logic from business logic',
|
|
552
|
-
applicability: 'Data persistence operations',
|
|
553
|
-
implementation: 'Repository interfaces with concrete implementations',
|
|
554
|
-
benefits: [
|
|
555
|
-
'Testability',
|
|
556
|
-
'Loose coupling',
|
|
557
|
-
'Centralized data access'
|
|
558
|
-
]
|
|
559
|
-
});
|
|
560
|
-
patterns.push({
|
|
561
|
-
name: 'Dependency Injection',
|
|
562
|
-
type: 'architectural',
|
|
563
|
-
purpose: 'Manage dependencies between objects',
|
|
564
|
-
applicability: 'All components requiring external dependencies',
|
|
565
|
-
implementation: 'Constructor injection with DI container',
|
|
566
|
-
benefits: [
|
|
567
|
-
'Testability',
|
|
568
|
-
'Loose coupling',
|
|
569
|
-
'Flexibility'
|
|
570
|
-
]
|
|
571
|
-
});
|
|
572
|
-
patterns.push({
|
|
573
|
-
name: 'Observer Pattern',
|
|
574
|
-
type: 'behavioral',
|
|
575
|
-
purpose: 'Notify multiple objects about state changes',
|
|
576
|
-
applicability: 'Event-driven communication',
|
|
577
|
-
implementation: 'Subject-observer relationships with event notifications',
|
|
578
|
-
benefits: [
|
|
579
|
-
'Loose coupling',
|
|
580
|
-
'Dynamic relationships',
|
|
581
|
-
'Broadcast communication'
|
|
582
|
-
]
|
|
583
|
-
});
|
|
584
|
-
return patterns;
|
|
432
|
+
*/
|
|
433
|
+
async selectDesignPatterns(specification, pseudocode) {
|
|
434
|
+
const patterns = [];
|
|
435
|
+
const requirements = specification.requirements || [];
|
|
436
|
+
|
|
437
|
+
// Creational patterns
|
|
438
|
+
if (
|
|
439
|
+
requirements.some(
|
|
440
|
+
(req) => req.toLowerCase().includes('create') || req.toLowerCase().includes('instantiate'),
|
|
441
|
+
)
|
|
442
|
+
) {
|
|
443
|
+
patterns.push({
|
|
444
|
+
name: 'Factory Pattern',
|
|
445
|
+
type: 'creational',
|
|
446
|
+
purpose: 'Create objects without specifying exact classes',
|
|
447
|
+
applicability: 'Object creation with varying configurations',
|
|
448
|
+
implementation: 'Factory classes with creation methods',
|
|
449
|
+
benefits: ['Loose coupling', 'Easy extensibility', 'Centralized creation logic'],
|
|
450
|
+
});
|
|
585
451
|
}
|
|
586
|
-
|
|
452
|
+
|
|
453
|
+
// Structural patterns
|
|
454
|
+
if (
|
|
455
|
+
requirements.some(
|
|
456
|
+
(req) => req.toLowerCase().includes('interface') || req.toLowerCase().includes('adapt'),
|
|
457
|
+
)
|
|
458
|
+
) {
|
|
459
|
+
patterns.push({
|
|
460
|
+
name: 'Adapter Pattern',
|
|
461
|
+
type: 'structural',
|
|
462
|
+
purpose: 'Allow incompatible interfaces to work together',
|
|
463
|
+
applicability: 'Integration with external systems',
|
|
464
|
+
implementation: 'Wrapper classes implementing target interfaces',
|
|
465
|
+
benefits: ['Code reuse', 'Separation of concerns', 'Easy integration'],
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
// Behavioral patterns
|
|
470
|
+
if (
|
|
471
|
+
requirements.some(
|
|
472
|
+
(req) => req.toLowerCase().includes('strategy') || req.toLowerCase().includes('algorithm'),
|
|
473
|
+
)
|
|
474
|
+
) {
|
|
475
|
+
patterns.push({
|
|
476
|
+
name: 'Strategy Pattern',
|
|
477
|
+
type: 'behavioral',
|
|
478
|
+
purpose: 'Define family of algorithms and make them interchangeable',
|
|
479
|
+
applicability: 'Multiple ways to perform operations',
|
|
480
|
+
implementation: 'Strategy interfaces with concrete implementations',
|
|
481
|
+
benefits: ['Flexibility', 'Open/closed principle', 'Runtime selection'],
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
// Common patterns for all systems
|
|
486
|
+
patterns.push({
|
|
487
|
+
name: 'Repository Pattern',
|
|
488
|
+
type: 'architectural',
|
|
489
|
+
purpose: 'Separate data access logic from business logic',
|
|
490
|
+
applicability: 'Data persistence operations',
|
|
491
|
+
implementation: 'Repository interfaces with concrete implementations',
|
|
492
|
+
benefits: ['Testability', 'Loose coupling', 'Centralized data access'],
|
|
493
|
+
});
|
|
494
|
+
|
|
495
|
+
patterns.push({
|
|
496
|
+
name: 'Dependency Injection',
|
|
497
|
+
type: 'architectural',
|
|
498
|
+
purpose: 'Manage dependencies between objects',
|
|
499
|
+
applicability: 'All components requiring external dependencies',
|
|
500
|
+
implementation: 'Constructor injection with DI container',
|
|
501
|
+
benefits: ['Testability', 'Loose coupling', 'Flexibility'],
|
|
502
|
+
});
|
|
503
|
+
|
|
504
|
+
patterns.push({
|
|
505
|
+
name: 'Observer Pattern',
|
|
506
|
+
type: 'behavioral',
|
|
507
|
+
purpose: 'Notify multiple objects about state changes',
|
|
508
|
+
applicability: 'Event-driven communication',
|
|
509
|
+
implementation: 'Subject-observer relationships with event notifications',
|
|
510
|
+
benefits: ['Loose coupling', 'Dynamic relationships', 'Broadcast communication'],
|
|
511
|
+
});
|
|
512
|
+
|
|
513
|
+
return patterns;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
/**
|
|
587
517
|
* Design data model
|
|
588
|
-
*/
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
dataModel.constraints = this.defineGlobalConstraints();
|
|
614
|
-
// Define indexes
|
|
615
|
-
dataModel.indexes = this.defineGlobalIndexes(dataModel.entities);
|
|
616
|
-
// Define views
|
|
617
|
-
dataModel.views = this.defineViews(dataModel.entities);
|
|
618
|
-
return dataModel;
|
|
518
|
+
*/
|
|
519
|
+
async designDataModel(specification) {
|
|
520
|
+
const dataModel = {
|
|
521
|
+
entities: [],
|
|
522
|
+
relationships: [],
|
|
523
|
+
constraints: [],
|
|
524
|
+
indexes: [],
|
|
525
|
+
views: [],
|
|
526
|
+
};
|
|
527
|
+
|
|
528
|
+
// Extract entities from requirements
|
|
529
|
+
const requirements = specification.requirements || [];
|
|
530
|
+
const entities = this.extractEntities(requirements);
|
|
531
|
+
|
|
532
|
+
for (const entityName of entities) {
|
|
533
|
+
const entity = {
|
|
534
|
+
name: entityName,
|
|
535
|
+
attributes: this.generateAttributes(entityName),
|
|
536
|
+
primaryKey: 'id',
|
|
537
|
+
foreignKeys: [],
|
|
538
|
+
constraints: this.generateConstraints(entityName),
|
|
539
|
+
indexes: this.generateIndexes(entityName),
|
|
540
|
+
};
|
|
541
|
+
|
|
542
|
+
dataModel.entities.push(entity);
|
|
619
543
|
}
|
|
620
|
-
|
|
544
|
+
|
|
545
|
+
// Define relationships
|
|
546
|
+
dataModel.relationships = this.defineRelationships(dataModel.entities);
|
|
547
|
+
|
|
548
|
+
// Define global constraints
|
|
549
|
+
dataModel.constraints = this.defineGlobalConstraints();
|
|
550
|
+
|
|
551
|
+
// Define indexes
|
|
552
|
+
dataModel.indexes = this.defineGlobalIndexes(dataModel.entities);
|
|
553
|
+
|
|
554
|
+
// Define views
|
|
555
|
+
dataModel.views = this.defineViews(dataModel.entities);
|
|
556
|
+
|
|
557
|
+
return dataModel;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
/**
|
|
621
561
|
* Extract entities from requirements
|
|
622
|
-
*/
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
// Add default entities if none found
|
|
644
|
-
if (entities.size === 0) {
|
|
645
|
-
entities.add('User');
|
|
646
|
-
entities.add('Session');
|
|
647
|
-
entities.add('Configuration');
|
|
562
|
+
*/
|
|
563
|
+
extractEntities(requirements) {
|
|
564
|
+
const entities = new Set();
|
|
565
|
+
|
|
566
|
+
for (const requirement of requirements) {
|
|
567
|
+
const words = requirement.split(' ');
|
|
568
|
+
|
|
569
|
+
for (const word of words) {
|
|
570
|
+
// Look for nouns that could be entities
|
|
571
|
+
if (
|
|
572
|
+
word.length > 3 &&
|
|
573
|
+
!['system', 'must', 'should', 'will', 'data', 'user', 'interface'].includes(
|
|
574
|
+
word.toLowerCase(),
|
|
575
|
+
)
|
|
576
|
+
) {
|
|
577
|
+
if (word[0] === word[0].toUpperCase()) {
|
|
578
|
+
entities.add(word);
|
|
579
|
+
}
|
|
648
580
|
}
|
|
649
|
-
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
// Add default entities if none found
|
|
585
|
+
if (entities.size === 0) {
|
|
586
|
+
entities.add('User');
|
|
587
|
+
entities.add('Session');
|
|
588
|
+
entities.add('Configuration');
|
|
650
589
|
}
|
|
651
|
-
|
|
590
|
+
|
|
591
|
+
return Array.from(entities);
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
/**
|
|
652
595
|
* Generate attributes for entity
|
|
653
|
-
*/
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
unique: true
|
|
688
|
-
}, {
|
|
689
|
-
name: 'email',
|
|
690
|
-
type: 'VARCHAR(255)',
|
|
691
|
-
nullable: false,
|
|
692
|
-
unique: true
|
|
693
|
-
}, {
|
|
694
|
-
name: 'password_hash',
|
|
695
|
-
type: 'VARCHAR(255)',
|
|
696
|
-
nullable: false
|
|
697
|
-
}, {
|
|
698
|
-
name: 'is_active',
|
|
699
|
-
type: 'BOOLEAN',
|
|
700
|
-
nullable: false,
|
|
701
|
-
default: 'true'
|
|
702
|
-
}, {
|
|
703
|
-
name: 'last_login',
|
|
704
|
-
type: 'TIMESTAMP',
|
|
705
|
-
nullable: true
|
|
706
|
-
});
|
|
707
|
-
} else if (entityLower.includes('session')) {
|
|
708
|
-
specificAttributes.push({
|
|
709
|
-
name: 'user_id',
|
|
710
|
-
type: 'UUID',
|
|
711
|
-
nullable: false
|
|
712
|
-
}, {
|
|
713
|
-
name: 'token',
|
|
714
|
-
type: 'VARCHAR(255)',
|
|
715
|
-
nullable: false,
|
|
716
|
-
unique: true
|
|
717
|
-
}, {
|
|
718
|
-
name: 'expires_at',
|
|
719
|
-
type: 'TIMESTAMP',
|
|
720
|
-
nullable: false
|
|
721
|
-
}, {
|
|
722
|
-
name: 'ip_address',
|
|
723
|
-
type: 'INET',
|
|
724
|
-
nullable: true
|
|
725
|
-
}, {
|
|
726
|
-
name: 'user_agent',
|
|
727
|
-
type: 'TEXT',
|
|
728
|
-
nullable: true
|
|
729
|
-
});
|
|
730
|
-
} else {
|
|
731
|
-
specificAttributes.push({
|
|
732
|
-
name: 'name',
|
|
733
|
-
type: 'VARCHAR(255)',
|
|
734
|
-
nullable: false
|
|
735
|
-
}, {
|
|
736
|
-
name: 'description',
|
|
737
|
-
type: 'TEXT',
|
|
738
|
-
nullable: true
|
|
739
|
-
}, {
|
|
740
|
-
name: 'status',
|
|
741
|
-
type: 'VARCHAR(50)',
|
|
742
|
-
nullable: false,
|
|
743
|
-
default: "'active'"
|
|
744
|
-
});
|
|
745
|
-
}
|
|
746
|
-
return [
|
|
747
|
-
...commonAttributes,
|
|
748
|
-
...specificAttributes
|
|
749
|
-
];
|
|
596
|
+
*/
|
|
597
|
+
generateAttributes(entityName) {
|
|
598
|
+
const commonAttributes = [
|
|
599
|
+
{ name: 'id', type: 'UUID', nullable: false, unique: true },
|
|
600
|
+
{ name: 'created_at', type: 'TIMESTAMP', nullable: false, default: 'CURRENT_TIMESTAMP' },
|
|
601
|
+
{ name: 'updated_at', type: 'TIMESTAMP', nullable: false, default: 'CURRENT_TIMESTAMP' },
|
|
602
|
+
{ name: 'version', type: 'INTEGER', nullable: false, default: '1' },
|
|
603
|
+
];
|
|
604
|
+
|
|
605
|
+
const specificAttributes = [];
|
|
606
|
+
const entityLower = entityName.toLowerCase();
|
|
607
|
+
|
|
608
|
+
if (entityLower.includes('user')) {
|
|
609
|
+
specificAttributes.push(
|
|
610
|
+
{ name: 'username', type: 'VARCHAR(50)', nullable: false, unique: true },
|
|
611
|
+
{ name: 'email', type: 'VARCHAR(255)', nullable: false, unique: true },
|
|
612
|
+
{ name: 'password_hash', type: 'VARCHAR(255)', nullable: false },
|
|
613
|
+
{ name: 'is_active', type: 'BOOLEAN', nullable: false, default: 'true' },
|
|
614
|
+
{ name: 'last_login', type: 'TIMESTAMP', nullable: true },
|
|
615
|
+
);
|
|
616
|
+
} else if (entityLower.includes('session')) {
|
|
617
|
+
specificAttributes.push(
|
|
618
|
+
{ name: 'user_id', type: 'UUID', nullable: false },
|
|
619
|
+
{ name: 'token', type: 'VARCHAR(255)', nullable: false, unique: true },
|
|
620
|
+
{ name: 'expires_at', type: 'TIMESTAMP', nullable: false },
|
|
621
|
+
{ name: 'ip_address', type: 'INET', nullable: true },
|
|
622
|
+
{ name: 'user_agent', type: 'TEXT', nullable: true },
|
|
623
|
+
);
|
|
624
|
+
} else {
|
|
625
|
+
specificAttributes.push(
|
|
626
|
+
{ name: 'name', type: 'VARCHAR(255)', nullable: false },
|
|
627
|
+
{ name: 'description', type: 'TEXT', nullable: true },
|
|
628
|
+
{ name: 'status', type: 'VARCHAR(50)', nullable: false, default: "'active'" },
|
|
629
|
+
);
|
|
750
630
|
}
|
|
751
|
-
|
|
631
|
+
|
|
632
|
+
return [...commonAttributes, ...specificAttributes];
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
/**
|
|
752
636
|
* Generate constraints for entity
|
|
753
|
-
*/
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
condition: 'length(username) >= 3'
|
|
781
|
-
});
|
|
782
|
-
}
|
|
783
|
-
return constraints;
|
|
637
|
+
*/
|
|
638
|
+
generateConstraints(entityName) {
|
|
639
|
+
const constraints = [
|
|
640
|
+
{ name: `${entityName.toLowerCase()}_id_pk`, type: 'PRIMARY KEY', column: 'id' },
|
|
641
|
+
{
|
|
642
|
+
name: `${entityName.toLowerCase()}_version_positive`,
|
|
643
|
+
type: 'CHECK',
|
|
644
|
+
condition: 'version > 0',
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
name: `${entityName.toLowerCase()}_created_before_updated`,
|
|
648
|
+
type: 'CHECK',
|
|
649
|
+
condition: 'created_at <= updated_at',
|
|
650
|
+
},
|
|
651
|
+
];
|
|
652
|
+
|
|
653
|
+
const entityLower = entityName.toLowerCase();
|
|
654
|
+
|
|
655
|
+
if (entityLower.includes('user')) {
|
|
656
|
+
constraints.push(
|
|
657
|
+
{
|
|
658
|
+
name: 'user_email_format',
|
|
659
|
+
type: 'CHECK',
|
|
660
|
+
condition: "email ~* '^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}$'",
|
|
661
|
+
},
|
|
662
|
+
{ name: 'user_username_length', type: 'CHECK', condition: 'length(username) >= 3' },
|
|
663
|
+
);
|
|
784
664
|
}
|
|
785
|
-
|
|
665
|
+
|
|
666
|
+
return constraints;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
/**
|
|
786
670
|
* Generate indexes for entity
|
|
787
|
-
*/
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
'email'
|
|
811
|
-
]
|
|
812
|
-
}, {
|
|
813
|
-
name: 'idx_user_username',
|
|
814
|
-
type: 'BTREE',
|
|
815
|
-
columns: [
|
|
816
|
-
'username'
|
|
817
|
-
]
|
|
818
|
-
}, {
|
|
819
|
-
name: 'idx_user_active',
|
|
820
|
-
type: 'BTREE',
|
|
821
|
-
columns: [
|
|
822
|
-
'is_active'
|
|
823
|
-
]
|
|
824
|
-
});
|
|
825
|
-
}
|
|
826
|
-
return indexes;
|
|
671
|
+
*/
|
|
672
|
+
generateIndexes(entityName) {
|
|
673
|
+
const indexes = [
|
|
674
|
+
{
|
|
675
|
+
name: `idx_${entityName.toLowerCase()}_created_at`,
|
|
676
|
+
type: 'BTREE',
|
|
677
|
+
columns: ['created_at'],
|
|
678
|
+
},
|
|
679
|
+
{
|
|
680
|
+
name: `idx_${entityName.toLowerCase()}_updated_at`,
|
|
681
|
+
type: 'BTREE',
|
|
682
|
+
columns: ['updated_at'],
|
|
683
|
+
},
|
|
684
|
+
];
|
|
685
|
+
|
|
686
|
+
const entityLower = entityName.toLowerCase();
|
|
687
|
+
|
|
688
|
+
if (entityLower.includes('user')) {
|
|
689
|
+
indexes.push(
|
|
690
|
+
{ name: 'idx_user_email', type: 'BTREE', columns: ['email'] },
|
|
691
|
+
{ name: 'idx_user_username', type: 'BTREE', columns: ['username'] },
|
|
692
|
+
{ name: 'idx_user_active', type: 'BTREE', columns: ['is_active'] },
|
|
693
|
+
);
|
|
827
694
|
}
|
|
828
|
-
|
|
695
|
+
|
|
696
|
+
return indexes;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
/**
|
|
829
700
|
* Define relationships between entities
|
|
830
|
-
*/
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
701
|
+
*/
|
|
702
|
+
defineRelationships(entities) {
|
|
703
|
+
const relationships = [];
|
|
704
|
+
|
|
705
|
+
// Look for entities that could have relationships
|
|
706
|
+
const userEntity = entities.find((e) => e.name.toLowerCase().includes('user'));
|
|
707
|
+
const sessionEntity = entities.find((e) => e.name.toLowerCase().includes('session'));
|
|
708
|
+
|
|
709
|
+
if (userEntity && sessionEntity) {
|
|
710
|
+
relationships.push({
|
|
711
|
+
name: 'user_sessions',
|
|
712
|
+
type: 'one-to-many',
|
|
713
|
+
parent: userEntity.name,
|
|
714
|
+
child: sessionEntity.name,
|
|
715
|
+
parentKey: 'id',
|
|
716
|
+
childKey: 'user_id',
|
|
717
|
+
onDelete: 'CASCADE',
|
|
718
|
+
onUpdate: 'RESTRICT',
|
|
719
|
+
});
|
|
848
720
|
}
|
|
849
|
-
|
|
721
|
+
|
|
722
|
+
return relationships;
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
/**
|
|
850
726
|
* Define global constraints
|
|
851
|
-
*/
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
type: 'CHECK',
|
|
861
|
-
condition: 'updated_at <= CURRENT_TIMESTAMP'
|
|
862
|
-
}
|
|
863
|
-
];
|
|
864
|
-
}
|
|
865
|
-
/**
|
|
727
|
+
*/
|
|
728
|
+
defineGlobalConstraints() {
|
|
729
|
+
return [
|
|
730
|
+
{ name: 'no_future_created_at', type: 'CHECK', condition: 'created_at <= CURRENT_TIMESTAMP' },
|
|
731
|
+
{ name: 'no_future_updated_at', type: 'CHECK', condition: 'updated_at <= CURRENT_TIMESTAMP' },
|
|
732
|
+
];
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
/**
|
|
866
736
|
* Define global indexes
|
|
867
|
-
*/
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
});
|
|
880
|
-
}
|
|
881
|
-
return indexes;
|
|
737
|
+
*/
|
|
738
|
+
defineGlobalIndexes(entities) {
|
|
739
|
+
const indexes = [];
|
|
740
|
+
|
|
741
|
+
// Add composite indexes for common query patterns
|
|
742
|
+
for (const entity of entities) {
|
|
743
|
+
indexes.push({
|
|
744
|
+
name: `idx_${entity.name.toLowerCase()}_status_created`,
|
|
745
|
+
type: 'BTREE',
|
|
746
|
+
table: entity.name,
|
|
747
|
+
columns: ['status', 'created_at'],
|
|
748
|
+
});
|
|
882
749
|
}
|
|
883
|
-
|
|
750
|
+
|
|
751
|
+
return indexes;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
/**
|
|
884
755
|
* Define views
|
|
885
|
-
*/
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
}
|
|
897
|
-
|
|
756
|
+
*/
|
|
757
|
+
defineViews(entities) {
|
|
758
|
+
const views = [];
|
|
759
|
+
|
|
760
|
+
// Create a view for active entities
|
|
761
|
+
for (const entity of entities) {
|
|
762
|
+
if (entity.attributes.some((attr) => attr.name === 'is_active' || attr.name === 'status')) {
|
|
763
|
+
views.push({
|
|
764
|
+
name: `active_${entity.name.toLowerCase()}s`,
|
|
765
|
+
definition: `SELECT * FROM ${entity.name} WHERE ${entity.attributes.some((attr) => attr.name === 'is_active') ? 'is_active = true' : "status = 'active'"}`,
|
|
766
|
+
purpose: `Show only active ${entity.name.toLowerCase()} records`,
|
|
767
|
+
});
|
|
768
|
+
}
|
|
898
769
|
}
|
|
899
|
-
|
|
770
|
+
|
|
771
|
+
return views;
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
/**
|
|
900
775
|
* Design API structure
|
|
901
|
-
*/
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
// Define error handling
|
|
923
|
-
apiDesign.errorHandling = this.defineApiErrorHandling();
|
|
924
|
-
// Define rate limiting
|
|
925
|
-
apiDesign.rateLimiting = this.defineApiRateLimiting();
|
|
926
|
-
// Define versioning strategy
|
|
927
|
-
apiDesign.versioning = this.defineApiVersioning();
|
|
928
|
-
return apiDesign;
|
|
776
|
+
*/
|
|
777
|
+
async designApiStructure(specification) {
|
|
778
|
+
const apiDesign = {
|
|
779
|
+
version: 'v1',
|
|
780
|
+
baseUrl: '/api/v1',
|
|
781
|
+
authentication: 'Bearer Token',
|
|
782
|
+
endpoints: [],
|
|
783
|
+
schemas: [],
|
|
784
|
+
errorHandling: {},
|
|
785
|
+
rateLimiting: {},
|
|
786
|
+
versioning: {},
|
|
787
|
+
};
|
|
788
|
+
|
|
789
|
+
// Generate endpoints based on requirements
|
|
790
|
+
const requirements = specification.requirements || [];
|
|
791
|
+
|
|
792
|
+
for (const requirement of requirements) {
|
|
793
|
+
if (requirement.toLowerCase().includes('api')) {
|
|
794
|
+
const endpoints = this.generateEndpoints(requirement);
|
|
795
|
+
apiDesign.endpoints.push(...endpoints);
|
|
796
|
+
}
|
|
929
797
|
}
|
|
930
|
-
|
|
798
|
+
|
|
799
|
+
// Generate schemas
|
|
800
|
+
apiDesign.schemas = this.generateApiSchemas(apiDesign.endpoints);
|
|
801
|
+
|
|
802
|
+
// Define error handling
|
|
803
|
+
apiDesign.errorHandling = this.defineApiErrorHandling();
|
|
804
|
+
|
|
805
|
+
// Define rate limiting
|
|
806
|
+
apiDesign.rateLimiting = this.defineApiRateLimiting();
|
|
807
|
+
|
|
808
|
+
// Define versioning strategy
|
|
809
|
+
apiDesign.versioning = this.defineApiVersioning();
|
|
810
|
+
|
|
811
|
+
return apiDesign;
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
/**
|
|
931
815
|
* Generate endpoints from requirement
|
|
932
|
-
*/
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
description: 'Created',
|
|
1006
|
-
schema: 'Resource'
|
|
1007
|
-
},
|
|
1008
|
-
400: {
|
|
1009
|
-
description: 'Bad Request',
|
|
1010
|
-
schema: 'Error'
|
|
1011
|
-
},
|
|
1012
|
-
401: {
|
|
1013
|
-
description: 'Unauthorized',
|
|
1014
|
-
schema: 'Error'
|
|
1015
|
-
}
|
|
1016
|
-
}
|
|
1017
|
-
}, {
|
|
1018
|
-
path: '/resources/{id}',
|
|
1019
|
-
method: 'PUT',
|
|
1020
|
-
summary: 'Update resource',
|
|
1021
|
-
parameters: [
|
|
1022
|
-
{
|
|
1023
|
-
name: 'id',
|
|
1024
|
-
type: 'string',
|
|
1025
|
-
description: 'Resource ID',
|
|
1026
|
-
required: true
|
|
1027
|
-
}
|
|
1028
|
-
],
|
|
1029
|
-
requestBody: {
|
|
1030
|
-
schema: 'UpdateResourceRequest'
|
|
1031
|
-
},
|
|
1032
|
-
responses: {
|
|
1033
|
-
200: {
|
|
1034
|
-
description: 'Updated',
|
|
1035
|
-
schema: 'Resource'
|
|
1036
|
-
},
|
|
1037
|
-
404: {
|
|
1038
|
-
description: 'Not Found',
|
|
1039
|
-
schema: 'Error'
|
|
1040
|
-
},
|
|
1041
|
-
400: {
|
|
1042
|
-
description: 'Bad Request',
|
|
1043
|
-
schema: 'Error'
|
|
1044
|
-
},
|
|
1045
|
-
401: {
|
|
1046
|
-
description: 'Unauthorized',
|
|
1047
|
-
schema: 'Error'
|
|
1048
|
-
}
|
|
1049
|
-
}
|
|
1050
|
-
}, {
|
|
1051
|
-
path: '/resources/{id}',
|
|
1052
|
-
method: 'DELETE',
|
|
1053
|
-
summary: 'Delete resource',
|
|
1054
|
-
parameters: [
|
|
1055
|
-
{
|
|
1056
|
-
name: 'id',
|
|
1057
|
-
type: 'string',
|
|
1058
|
-
description: 'Resource ID',
|
|
1059
|
-
required: true
|
|
1060
|
-
}
|
|
1061
|
-
],
|
|
1062
|
-
responses: {
|
|
1063
|
-
204: {
|
|
1064
|
-
description: 'Deleted'
|
|
1065
|
-
},
|
|
1066
|
-
404: {
|
|
1067
|
-
description: 'Not Found',
|
|
1068
|
-
schema: 'Error'
|
|
1069
|
-
},
|
|
1070
|
-
401: {
|
|
1071
|
-
description: 'Unauthorized',
|
|
1072
|
-
schema: 'Error'
|
|
1073
|
-
}
|
|
1074
|
-
}
|
|
1075
|
-
});
|
|
1076
|
-
return endpoints;
|
|
1077
|
-
}
|
|
1078
|
-
/**
|
|
816
|
+
*/
|
|
817
|
+
generateEndpoints(requirement) {
|
|
818
|
+
const endpoints = [];
|
|
819
|
+
|
|
820
|
+
// Basic CRUD endpoints
|
|
821
|
+
endpoints.push(
|
|
822
|
+
{
|
|
823
|
+
path: '/resources',
|
|
824
|
+
method: 'GET',
|
|
825
|
+
summary: 'List all resources',
|
|
826
|
+
parameters: [
|
|
827
|
+
{ name: 'page', type: 'integer', description: 'Page number' },
|
|
828
|
+
{ name: 'limit', type: 'integer', description: 'Items per page' },
|
|
829
|
+
{ name: 'sort', type: 'string', description: 'Sort field' },
|
|
830
|
+
],
|
|
831
|
+
responses: {
|
|
832
|
+
200: { description: 'Success', schema: 'ResourceList' },
|
|
833
|
+
400: { description: 'Bad Request', schema: 'Error' },
|
|
834
|
+
401: { description: 'Unauthorized', schema: 'Error' },
|
|
835
|
+
},
|
|
836
|
+
},
|
|
837
|
+
{
|
|
838
|
+
path: '/resources/{id}',
|
|
839
|
+
method: 'GET',
|
|
840
|
+
summary: 'Get resource by ID',
|
|
841
|
+
parameters: [{ name: 'id', type: 'string', description: 'Resource ID', required: true }],
|
|
842
|
+
responses: {
|
|
843
|
+
200: { description: 'Success', schema: 'Resource' },
|
|
844
|
+
404: { description: 'Not Found', schema: 'Error' },
|
|
845
|
+
401: { description: 'Unauthorized', schema: 'Error' },
|
|
846
|
+
},
|
|
847
|
+
},
|
|
848
|
+
{
|
|
849
|
+
path: '/resources',
|
|
850
|
+
method: 'POST',
|
|
851
|
+
summary: 'Create new resource',
|
|
852
|
+
requestBody: { schema: 'CreateResourceRequest' },
|
|
853
|
+
responses: {
|
|
854
|
+
201: { description: 'Created', schema: 'Resource' },
|
|
855
|
+
400: { description: 'Bad Request', schema: 'Error' },
|
|
856
|
+
401: { description: 'Unauthorized', schema: 'Error' },
|
|
857
|
+
},
|
|
858
|
+
},
|
|
859
|
+
{
|
|
860
|
+
path: '/resources/{id}',
|
|
861
|
+
method: 'PUT',
|
|
862
|
+
summary: 'Update resource',
|
|
863
|
+
parameters: [{ name: 'id', type: 'string', description: 'Resource ID', required: true }],
|
|
864
|
+
requestBody: { schema: 'UpdateResourceRequest' },
|
|
865
|
+
responses: {
|
|
866
|
+
200: { description: 'Updated', schema: 'Resource' },
|
|
867
|
+
404: { description: 'Not Found', schema: 'Error' },
|
|
868
|
+
400: { description: 'Bad Request', schema: 'Error' },
|
|
869
|
+
401: { description: 'Unauthorized', schema: 'Error' },
|
|
870
|
+
},
|
|
871
|
+
},
|
|
872
|
+
{
|
|
873
|
+
path: '/resources/{id}',
|
|
874
|
+
method: 'DELETE',
|
|
875
|
+
summary: 'Delete resource',
|
|
876
|
+
parameters: [{ name: 'id', type: 'string', description: 'Resource ID', required: true }],
|
|
877
|
+
responses: {
|
|
878
|
+
204: { description: 'Deleted' },
|
|
879
|
+
404: { description: 'Not Found', schema: 'Error' },
|
|
880
|
+
401: { description: 'Unauthorized', schema: 'Error' },
|
|
881
|
+
},
|
|
882
|
+
},
|
|
883
|
+
);
|
|
884
|
+
|
|
885
|
+
return endpoints;
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
/**
|
|
1079
889
|
* Generate API schemas
|
|
1080
|
-
*/
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
type: 'integer'
|
|
1135
|
-
},
|
|
1136
|
-
limit: {
|
|
1137
|
-
type: 'integer'
|
|
1138
|
-
},
|
|
1139
|
-
total: {
|
|
1140
|
-
type: 'integer'
|
|
1141
|
-
},
|
|
1142
|
-
pages: {
|
|
1143
|
-
type: 'integer'
|
|
1144
|
-
}
|
|
1145
|
-
}
|
|
1146
|
-
}
|
|
1147
|
-
}
|
|
1148
|
-
});
|
|
1149
|
-
// Error schema
|
|
1150
|
-
schemas.push({
|
|
1151
|
-
name: 'Error',
|
|
1152
|
-
type: 'object',
|
|
1153
|
-
properties: {
|
|
1154
|
-
error: {
|
|
1155
|
-
type: 'string'
|
|
1156
|
-
},
|
|
1157
|
-
message: {
|
|
1158
|
-
type: 'string'
|
|
1159
|
-
},
|
|
1160
|
-
details: {
|
|
1161
|
-
type: 'array',
|
|
1162
|
-
items: {
|
|
1163
|
-
type: 'string'
|
|
1164
|
-
}
|
|
1165
|
-
},
|
|
1166
|
-
timestamp: {
|
|
1167
|
-
type: 'string',
|
|
1168
|
-
format: 'date-time'
|
|
1169
|
-
}
|
|
1170
|
-
},
|
|
1171
|
-
required: [
|
|
1172
|
-
'error',
|
|
1173
|
-
'message'
|
|
1174
|
-
]
|
|
1175
|
-
});
|
|
1176
|
-
return schemas;
|
|
1177
|
-
}
|
|
1178
|
-
/**
|
|
890
|
+
*/
|
|
891
|
+
generateApiSchemas(endpoints) {
|
|
892
|
+
const schemas = [];
|
|
893
|
+
|
|
894
|
+
// Basic resource schema
|
|
895
|
+
schemas.push({
|
|
896
|
+
name: 'Resource',
|
|
897
|
+
type: 'object',
|
|
898
|
+
properties: {
|
|
899
|
+
id: { type: 'string', format: 'uuid' },
|
|
900
|
+
name: { type: 'string' },
|
|
901
|
+
description: { type: 'string' },
|
|
902
|
+
status: { type: 'string', enum: ['active', 'inactive'] },
|
|
903
|
+
created_at: { type: 'string', format: 'date-time' },
|
|
904
|
+
updated_at: { type: 'string', format: 'date-time' },
|
|
905
|
+
},
|
|
906
|
+
required: ['id', 'name', 'status'],
|
|
907
|
+
});
|
|
908
|
+
|
|
909
|
+
// Resource list schema
|
|
910
|
+
schemas.push({
|
|
911
|
+
name: 'ResourceList',
|
|
912
|
+
type: 'object',
|
|
913
|
+
properties: {
|
|
914
|
+
data: { type: 'array', items: { $ref: '#/schemas/Resource' } },
|
|
915
|
+
pagination: {
|
|
916
|
+
type: 'object',
|
|
917
|
+
properties: {
|
|
918
|
+
page: { type: 'integer' },
|
|
919
|
+
limit: { type: 'integer' },
|
|
920
|
+
total: { type: 'integer' },
|
|
921
|
+
pages: { type: 'integer' },
|
|
922
|
+
},
|
|
923
|
+
},
|
|
924
|
+
},
|
|
925
|
+
});
|
|
926
|
+
|
|
927
|
+
// Error schema
|
|
928
|
+
schemas.push({
|
|
929
|
+
name: 'Error',
|
|
930
|
+
type: 'object',
|
|
931
|
+
properties: {
|
|
932
|
+
error: { type: 'string' },
|
|
933
|
+
message: { type: 'string' },
|
|
934
|
+
details: { type: 'array', items: { type: 'string' } },
|
|
935
|
+
timestamp: { type: 'string', format: 'date-time' },
|
|
936
|
+
},
|
|
937
|
+
required: ['error', 'message'],
|
|
938
|
+
});
|
|
939
|
+
|
|
940
|
+
return schemas;
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
/**
|
|
1179
944
|
* Define API error handling
|
|
1180
|
-
*/
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
}
|
|
1203
|
-
|
|
945
|
+
*/
|
|
946
|
+
defineApiErrorHandling() {
|
|
947
|
+
return {
|
|
948
|
+
strategy: 'Consistent error responses with proper HTTP status codes',
|
|
949
|
+
errorCodes: {
|
|
950
|
+
400: 'Bad Request - Invalid input data',
|
|
951
|
+
401: 'Unauthorized - Authentication required',
|
|
952
|
+
403: 'Forbidden - Insufficient permissions',
|
|
953
|
+
404: 'Not Found - Resource not found',
|
|
954
|
+
409: 'Conflict - Resource already exists',
|
|
955
|
+
422: 'Unprocessable Entity - Validation errors',
|
|
956
|
+
429: 'Too Many Requests - Rate limit exceeded',
|
|
957
|
+
500: 'Internal Server Error - Server error',
|
|
958
|
+
503: 'Service Unavailable - Service temporarily unavailable',
|
|
959
|
+
},
|
|
960
|
+
errorFormat: {
|
|
961
|
+
error: 'Error type',
|
|
962
|
+
message: 'Human-readable error message',
|
|
963
|
+
details: 'Array of specific error details',
|
|
964
|
+
timestamp: 'ISO 8601 timestamp',
|
|
965
|
+
},
|
|
966
|
+
logging: 'All errors logged with request ID and stack trace',
|
|
967
|
+
};
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
/**
|
|
1204
971
|
* Define API rate limiting
|
|
1205
|
-
*/
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
'X-RateLimit-Remaining': 'Remaining requests in current window',
|
|
1225
|
-
'X-RateLimit-Reset': 'Unix timestamp when limit resets'
|
|
1226
|
-
},
|
|
1227
|
-
handling: 'Return 429 status with retry-after header'
|
|
1228
|
-
};
|
|
1229
|
-
}
|
|
1230
|
-
/**
|
|
972
|
+
*/
|
|
973
|
+
defineApiRateLimiting() {
|
|
974
|
+
return {
|
|
975
|
+
strategy: 'Token bucket algorithm with per-user and per-IP limits',
|
|
976
|
+
limits: {
|
|
977
|
+
authenticated: { requests: 1000, window: '1 hour' },
|
|
978
|
+
anonymous: { requests: 100, window: '1 hour' },
|
|
979
|
+
burst: { requests: 10, window: '1 minute' },
|
|
980
|
+
},
|
|
981
|
+
headers: {
|
|
982
|
+
'X-RateLimit-Limit': 'Request limit for current window',
|
|
983
|
+
'X-RateLimit-Remaining': 'Remaining requests in current window',
|
|
984
|
+
'X-RateLimit-Reset': 'Unix timestamp when limit resets',
|
|
985
|
+
},
|
|
986
|
+
handling: 'Return 429 status with retry-after header',
|
|
987
|
+
};
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
/**
|
|
1231
991
|
* Define API versioning
|
|
1232
|
-
*/
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
}
|
|
1245
|
-
|
|
992
|
+
*/
|
|
993
|
+
defineApiVersioning() {
|
|
994
|
+
return {
|
|
995
|
+
strategy: 'URL path versioning with backward compatibility',
|
|
996
|
+
format: '/api/v{major}',
|
|
997
|
+
lifecycle: {
|
|
998
|
+
development: 'Active development with breaking changes',
|
|
999
|
+
stable: 'Stable API with backward compatibility',
|
|
1000
|
+
deprecated: 'Deprecated with migration guide',
|
|
1001
|
+
retired: 'No longer supported',
|
|
1002
|
+
},
|
|
1003
|
+
migration: 'Gradual migration with parallel support periods',
|
|
1004
|
+
};
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
/**
|
|
1246
1008
|
* Plan deployment architecture
|
|
1247
|
-
*/
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1009
|
+
*/
|
|
1010
|
+
async planDeploymentArchitecture(specification) {
|
|
1011
|
+
const deployment = {
|
|
1012
|
+
strategy: 'containerized',
|
|
1013
|
+
environments: [],
|
|
1014
|
+
infrastructure: {},
|
|
1015
|
+
monitoring: {},
|
|
1016
|
+
security: {},
|
|
1017
|
+
scalability: {},
|
|
1018
|
+
};
|
|
1019
|
+
|
|
1020
|
+
// Define environments
|
|
1021
|
+
deployment.environments = [
|
|
1022
|
+
{
|
|
1023
|
+
name: 'development',
|
|
1024
|
+
purpose: 'Development and testing',
|
|
1025
|
+
resources: 'Single node with shared resources',
|
|
1026
|
+
database: 'SQLite or embedded database',
|
|
1027
|
+
monitoring: 'Basic logging',
|
|
1028
|
+
},
|
|
1029
|
+
{
|
|
1030
|
+
name: 'staging',
|
|
1031
|
+
purpose: 'Pre-production testing',
|
|
1032
|
+
resources: 'Production-like environment with reduced capacity',
|
|
1033
|
+
database: 'Managed database service',
|
|
1034
|
+
monitoring: 'Full monitoring stack',
|
|
1035
|
+
},
|
|
1036
|
+
{
|
|
1037
|
+
name: 'production',
|
|
1038
|
+
purpose: 'Live application serving users',
|
|
1039
|
+
resources: 'Multiple nodes with load balancing',
|
|
1040
|
+
database: 'High-availability managed database',
|
|
1041
|
+
monitoring: 'Comprehensive monitoring and alerting',
|
|
1042
|
+
},
|
|
1043
|
+
];
|
|
1044
|
+
|
|
1045
|
+
// Define infrastructure
|
|
1046
|
+
deployment.infrastructure = {
|
|
1047
|
+
platform: 'Container orchestration (Kubernetes/Docker Swarm)',
|
|
1048
|
+
compute: 'Auto-scaling container instances',
|
|
1049
|
+
storage: 'Persistent volumes with backup',
|
|
1050
|
+
networking: 'Load balancer with SSL termination',
|
|
1051
|
+
dns: 'Managed DNS with health checks',
|
|
1052
|
+
};
|
|
1053
|
+
|
|
1054
|
+
// Define monitoring
|
|
1055
|
+
deployment.monitoring = {
|
|
1056
|
+
metrics: 'Application and infrastructure metrics',
|
|
1057
|
+
logging: 'Centralized logging with log aggregation',
|
|
1058
|
+
tracing: 'Distributed tracing for request flow',
|
|
1059
|
+
alerting: 'Multi-channel alerting for critical issues',
|
|
1060
|
+
dashboards: 'Real-time dashboards for system health',
|
|
1061
|
+
};
|
|
1062
|
+
|
|
1063
|
+
// Define security
|
|
1064
|
+
deployment.security = {
|
|
1065
|
+
secrets: 'Encrypted secrets management',
|
|
1066
|
+
network: 'Network policies and firewall rules',
|
|
1067
|
+
access: 'Role-based access control',
|
|
1068
|
+
scanning: 'Container and dependency vulnerability scanning',
|
|
1069
|
+
compliance: 'Security compliance monitoring',
|
|
1070
|
+
};
|
|
1071
|
+
|
|
1072
|
+
// Define scalability
|
|
1073
|
+
deployment.scalability = {
|
|
1074
|
+
horizontal: 'Auto-scaling based on CPU/memory/requests',
|
|
1075
|
+
vertical: 'Resource limits and requests optimization',
|
|
1076
|
+
database: 'Database scaling with read replicas',
|
|
1077
|
+
caching: 'Multi-layer caching strategy',
|
|
1078
|
+
cdn: 'Content delivery network for static assets',
|
|
1079
|
+
};
|
|
1080
|
+
|
|
1081
|
+
return deployment;
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
/**
|
|
1315
1085
|
* Design security architecture
|
|
1316
|
-
*/
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1086
|
+
*/
|
|
1087
|
+
async designSecurityArchitecture(specification) {
|
|
1088
|
+
const security = {
|
|
1089
|
+
authentication: {},
|
|
1090
|
+
authorization: {},
|
|
1091
|
+
dataProtection: {},
|
|
1092
|
+
networkSecurity: {},
|
|
1093
|
+
monitoring: {},
|
|
1094
|
+
compliance: {},
|
|
1095
|
+
};
|
|
1096
|
+
|
|
1097
|
+
// Authentication design
|
|
1098
|
+
security.authentication = {
|
|
1099
|
+
mechanism: 'JWT tokens with refresh token rotation',
|
|
1100
|
+
providers: ['Local credentials', 'OAuth2/OpenID Connect'],
|
|
1101
|
+
session: 'Stateless with secure token storage',
|
|
1102
|
+
mfa: 'Multi-factor authentication for sensitive operations',
|
|
1103
|
+
passwordPolicy: 'Strong password requirements with complexity rules',
|
|
1104
|
+
};
|
|
1105
|
+
|
|
1106
|
+
// Authorization design
|
|
1107
|
+
security.authorization = {
|
|
1108
|
+
model: 'Role-based access control (RBAC)',
|
|
1109
|
+
permissions: 'Fine-grained permissions with resource-level access',
|
|
1110
|
+
policies: 'Attribute-based access control for complex rules',
|
|
1111
|
+
delegation: 'Secure delegation with time-limited tokens',
|
|
1112
|
+
auditing: 'Complete audit trail of access decisions',
|
|
1113
|
+
};
|
|
1114
|
+
|
|
1115
|
+
// Data protection design
|
|
1116
|
+
security.dataProtection = {
|
|
1117
|
+
encryption: {
|
|
1118
|
+
atRest: 'AES-256 encryption for stored data',
|
|
1119
|
+
inTransit: 'TLS 1.3 for all network communication',
|
|
1120
|
+
keys: 'Hardware security module or managed key service',
|
|
1121
|
+
},
|
|
1122
|
+
privacy: {
|
|
1123
|
+
pii: 'Personal information identification and protection',
|
|
1124
|
+
anonymization: 'Data anonymization for analytics',
|
|
1125
|
+
retention: 'Data retention policies with automatic deletion',
|
|
1126
|
+
},
|
|
1127
|
+
backup: {
|
|
1128
|
+
encryption: 'Encrypted backups with separate key management',
|
|
1129
|
+
testing: 'Regular backup restoration testing',
|
|
1130
|
+
offsite: 'Geographically distributed backup storage',
|
|
1131
|
+
},
|
|
1132
|
+
};
|
|
1133
|
+
|
|
1134
|
+
// Network security design
|
|
1135
|
+
security.networkSecurity = {
|
|
1136
|
+
firewall: 'Web application firewall with DDoS protection',
|
|
1137
|
+
segmentation: 'Network segmentation with micro-segmentation',
|
|
1138
|
+
monitoring: 'Network traffic monitoring and analysis',
|
|
1139
|
+
vpn: 'VPN access for administrative operations',
|
|
1140
|
+
certificates: 'Automated certificate management and renewal',
|
|
1141
|
+
};
|
|
1142
|
+
|
|
1143
|
+
// Security monitoring design
|
|
1144
|
+
security.monitoring = {
|
|
1145
|
+
siem: 'Security information and event management',
|
|
1146
|
+
ids: 'Intrusion detection and prevention systems',
|
|
1147
|
+
behavior: 'User and entity behavior analytics',
|
|
1148
|
+
threat: 'Threat intelligence integration',
|
|
1149
|
+
incident: 'Automated incident response workflows',
|
|
1150
|
+
};
|
|
1151
|
+
|
|
1152
|
+
// Compliance design
|
|
1153
|
+
security.compliance = {
|
|
1154
|
+
frameworks: ['GDPR', 'SOC 2', 'ISO 27001'],
|
|
1155
|
+
auditing: 'Regular security audits and penetration testing',
|
|
1156
|
+
documentation: 'Security policies and procedures documentation',
|
|
1157
|
+
training: 'Security awareness training for all personnel',
|
|
1158
|
+
reporting: 'Compliance reporting and evidence collection',
|
|
1159
|
+
};
|
|
1160
|
+
|
|
1161
|
+
return security;
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
/**
|
|
1393
1165
|
* Plan scalability
|
|
1394
|
-
*/
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
/**
|
|
1166
|
+
*/
|
|
1167
|
+
async planScalability(specification) {
|
|
1168
|
+
const scalability = {
|
|
1169
|
+
horizontalScaling: {},
|
|
1170
|
+
verticalScaling: {},
|
|
1171
|
+
dataScaling: {},
|
|
1172
|
+
performanceOptimization: {},
|
|
1173
|
+
monitoring: {},
|
|
1174
|
+
};
|
|
1175
|
+
|
|
1176
|
+
// Horizontal scaling plan
|
|
1177
|
+
scalability.horizontalScaling = {
|
|
1178
|
+
strategy: 'Auto-scaling based on demand metrics',
|
|
1179
|
+
triggers: ['CPU utilization > 70%', 'Memory utilization > 80%', 'Request queue length > 10'],
|
|
1180
|
+
limits: { minimum: 2, maximum: 20, scaleUpRate: 2, scaleDownRate: 1 },
|
|
1181
|
+
loadBalancing: 'Round-robin with health checks',
|
|
1182
|
+
sessionAffinity: 'Stateless design with external session storage',
|
|
1183
|
+
};
|
|
1184
|
+
|
|
1185
|
+
// Vertical scaling plan
|
|
1186
|
+
scalability.verticalScaling = {
|
|
1187
|
+
strategy: 'Resource optimization based on usage patterns',
|
|
1188
|
+
monitoring: 'Continuous resource utilization monitoring',
|
|
1189
|
+
recommendations: 'Automated resource recommendation engine',
|
|
1190
|
+
limits: 'Resource limits to prevent resource exhaustion',
|
|
1191
|
+
optimization: 'Container resource optimization',
|
|
1192
|
+
};
|
|
1193
|
+
|
|
1194
|
+
// Data scaling plan
|
|
1195
|
+
scalability.dataScaling = {
|
|
1196
|
+
database: {
|
|
1197
|
+
readReplicas: 'Read replicas for read-heavy workloads',
|
|
1198
|
+
sharding: 'Database sharding for large datasets',
|
|
1199
|
+
caching: 'Multi-layer caching with Redis/Memcached',
|
|
1200
|
+
indexing: 'Optimized indexing strategies',
|
|
1201
|
+
},
|
|
1202
|
+
storage: {
|
|
1203
|
+
tiering: 'Storage tiering based on access patterns',
|
|
1204
|
+
compression: 'Data compression for storage efficiency',
|
|
1205
|
+
archiving: 'Automatic archiving of old data',
|
|
1206
|
+
partitioning: 'Data partitioning for improved performance',
|
|
1207
|
+
},
|
|
1208
|
+
};
|
|
1209
|
+
|
|
1210
|
+
// Performance optimization plan
|
|
1211
|
+
scalability.performanceOptimization = {
|
|
1212
|
+
caching: {
|
|
1213
|
+
application: 'In-memory application caching',
|
|
1214
|
+
database: 'Database query result caching',
|
|
1215
|
+
cdn: 'Content delivery network for static assets',
|
|
1216
|
+
browser: 'Browser caching with appropriate headers',
|
|
1217
|
+
},
|
|
1218
|
+
optimization: {
|
|
1219
|
+
queries: 'Database query optimization',
|
|
1220
|
+
algorithms: 'Algorithm complexity optimization',
|
|
1221
|
+
resources: 'Resource usage optimization',
|
|
1222
|
+
networking: 'Network latency optimization',
|
|
1223
|
+
},
|
|
1224
|
+
};
|
|
1225
|
+
|
|
1226
|
+
// Monitoring plan
|
|
1227
|
+
scalability.monitoring = {
|
|
1228
|
+
metrics: [
|
|
1229
|
+
'Response time and latency',
|
|
1230
|
+
'Throughput and requests per second',
|
|
1231
|
+
'Error rates and success rates',
|
|
1232
|
+
'Resource utilization (CPU, memory, disk)',
|
|
1233
|
+
'Database performance metrics',
|
|
1234
|
+
],
|
|
1235
|
+
alerting: 'Proactive alerting for performance degradation',
|
|
1236
|
+
capacity: 'Capacity planning based on growth projections',
|
|
1237
|
+
testing: 'Regular performance testing and load testing',
|
|
1238
|
+
};
|
|
1239
|
+
|
|
1240
|
+
return scalability;
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
/**
|
|
1473
1244
|
* Identify integration points
|
|
1474
|
-
*/
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
purpose: 'Integrate with external services',
|
|
1485
|
-
protocol: 'HTTPS',
|
|
1486
|
-
authentication: 'API Key or OAuth2',
|
|
1487
|
-
dataFormat: 'JSON',
|
|
1488
|
-
errorHandling: 'Retry with exponential backoff',
|
|
1489
|
-
monitoring: 'API health checks and response time monitoring'
|
|
1490
|
-
});
|
|
1491
|
-
}
|
|
1492
|
-
if (reqLower.includes('database') || reqLower.includes('data')) {
|
|
1493
|
-
integrations.push({
|
|
1494
|
-
name: 'Database Integration',
|
|
1495
|
-
type: 'Database',
|
|
1496
|
-
purpose: 'Data persistence and retrieval',
|
|
1497
|
-
protocol: 'Database-specific protocol',
|
|
1498
|
-
authentication: 'Connection string with credentials',
|
|
1499
|
-
dataFormat: 'SQL or NoSQL',
|
|
1500
|
-
errorHandling: 'Connection pooling and retry logic',
|
|
1501
|
-
monitoring: 'Database performance and connection monitoring'
|
|
1502
|
-
});
|
|
1503
|
-
}
|
|
1504
|
-
if (reqLower.includes('message') || reqLower.includes('event')) {
|
|
1505
|
-
integrations.push({
|
|
1506
|
-
name: 'Message Queue Integration',
|
|
1507
|
-
type: 'Message Queue',
|
|
1508
|
-
purpose: 'Asynchronous communication',
|
|
1509
|
-
protocol: 'AMQP or proprietary',
|
|
1510
|
-
authentication: 'Queue-specific authentication',
|
|
1511
|
-
dataFormat: 'JSON or Binary',
|
|
1512
|
-
errorHandling: 'Dead letter queues and retry policies',
|
|
1513
|
-
monitoring: 'Queue depth and processing time monitoring'
|
|
1514
|
-
});
|
|
1515
|
-
}
|
|
1516
|
-
}
|
|
1517
|
-
// Add common integrations
|
|
1245
|
+
*/
|
|
1246
|
+
async identifyIntegrationPoints(specification) {
|
|
1247
|
+
const integrations = [];
|
|
1248
|
+
const requirements = specification.requirements || [];
|
|
1249
|
+
|
|
1250
|
+
// Analyze requirements for integration needs
|
|
1251
|
+
for (const requirement of requirements) {
|
|
1252
|
+
const reqLower = requirement.toLowerCase();
|
|
1253
|
+
|
|
1254
|
+
if (reqLower.includes('external') || reqLower.includes('third-party')) {
|
|
1518
1255
|
integrations.push({
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1256
|
+
name: 'External API Integration',
|
|
1257
|
+
type: 'REST API',
|
|
1258
|
+
purpose: 'Integrate with external services',
|
|
1259
|
+
protocol: 'HTTPS',
|
|
1260
|
+
authentication: 'API Key or OAuth2',
|
|
1261
|
+
dataFormat: 'JSON',
|
|
1262
|
+
errorHandling: 'Retry with exponential backoff',
|
|
1263
|
+
monitoring: 'API health checks and response time monitoring',
|
|
1527
1264
|
});
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
reliability: {
|
|
1541
|
-
availability: '99.9% uptime with planned maintenance windows',
|
|
1542
|
-
faultTolerance: 'Graceful degradation when components fail',
|
|
1543
|
-
recoverability: 'Automatic recovery from transient failures',
|
|
1544
|
-
durability: 'Data persistence with backup and recovery'
|
|
1545
|
-
},
|
|
1546
|
-
security: {
|
|
1547
|
-
confidentiality: 'Protect sensitive data with encryption',
|
|
1548
|
-
integrity: 'Ensure data accuracy and prevent tampering',
|
|
1549
|
-
authentication: 'Verify user identity before access',
|
|
1550
|
-
authorization: 'Control access based on user permissions'
|
|
1551
|
-
},
|
|
1552
|
-
usability: {
|
|
1553
|
-
learnability: 'Intuitive interfaces requiring minimal training',
|
|
1554
|
-
efficiency: 'Allow experienced users to work efficiently',
|
|
1555
|
-
memorability: 'Easy to remember after periods of non-use',
|
|
1556
|
-
errors: 'Minimize user errors and provide clear error messages'
|
|
1557
|
-
},
|
|
1558
|
-
maintainability: {
|
|
1559
|
-
modifiability: 'Easy to modify and extend functionality',
|
|
1560
|
-
testability: 'Comprehensive test coverage and automated testing',
|
|
1561
|
-
reusability: 'Modular design with reusable components',
|
|
1562
|
-
analyzability: 'Clear code structure and documentation'
|
|
1563
|
-
}
|
|
1564
|
-
};
|
|
1565
|
-
}
|
|
1566
|
-
/**
|
|
1567
|
-
* Document architectural decisions
|
|
1568
|
-
*/ async documentArchitecturalDecisions(result) {
|
|
1569
|
-
const decisions = [];
|
|
1570
|
-
// Architecture style decision
|
|
1571
|
-
decisions.push({
|
|
1572
|
-
id: 'AD-001',
|
|
1573
|
-
title: `Use ${result.systemDesign.style} Architecture`,
|
|
1574
|
-
status: 'Accepted',
|
|
1575
|
-
context: 'Need to choose appropriate architectural style for the system',
|
|
1576
|
-
decision: `Implement ${result.systemDesign.style} architecture with ${result.systemDesign.layers.length} layers`,
|
|
1577
|
-
consequences: {
|
|
1578
|
-
positive: [
|
|
1579
|
-
'Clear separation of concerns',
|
|
1580
|
-
'Maintainable code structure',
|
|
1581
|
-
'Scalable design'
|
|
1582
|
-
],
|
|
1583
|
-
negative: [
|
|
1584
|
-
'Potential performance overhead',
|
|
1585
|
-
'Added complexity for simple operations'
|
|
1586
|
-
]
|
|
1587
|
-
},
|
|
1588
|
-
alternatives: [
|
|
1589
|
-
'Monolithic',
|
|
1590
|
-
'Microservices',
|
|
1591
|
-
'Event-driven'
|
|
1592
|
-
],
|
|
1593
|
-
date: new Date().toISOString()
|
|
1594
|
-
});
|
|
1595
|
-
// Design patterns decision
|
|
1596
|
-
decisions.push({
|
|
1597
|
-
id: 'AD-002',
|
|
1598
|
-
title: 'Apply Standard Design Patterns',
|
|
1599
|
-
status: 'Accepted',
|
|
1600
|
-
context: 'Need to ensure consistent and well-understood design patterns',
|
|
1601
|
-
decision: `Implement ${result.designPatterns.length} design patterns including Repository, Factory, and Strategy patterns`,
|
|
1602
|
-
consequences: {
|
|
1603
|
-
positive: [
|
|
1604
|
-
'Improved code maintainability',
|
|
1605
|
-
'Better testability',
|
|
1606
|
-
'Consistent design approach'
|
|
1607
|
-
],
|
|
1608
|
-
negative: [
|
|
1609
|
-
'Learning curve for developers',
|
|
1610
|
-
'Potential over-engineering'
|
|
1611
|
-
]
|
|
1612
|
-
},
|
|
1613
|
-
alternatives: [
|
|
1614
|
-
'Ad-hoc design',
|
|
1615
|
-
'Framework-specific patterns'
|
|
1616
|
-
],
|
|
1617
|
-
date: new Date().toISOString()
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
if (reqLower.includes('database') || reqLower.includes('data')) {
|
|
1268
|
+
integrations.push({
|
|
1269
|
+
name: 'Database Integration',
|
|
1270
|
+
type: 'Database',
|
|
1271
|
+
purpose: 'Data persistence and retrieval',
|
|
1272
|
+
protocol: 'Database-specific protocol',
|
|
1273
|
+
authentication: 'Connection string with credentials',
|
|
1274
|
+
dataFormat: 'SQL or NoSQL',
|
|
1275
|
+
errorHandling: 'Connection pooling and retry logic',
|
|
1276
|
+
monitoring: 'Database performance and connection monitoring',
|
|
1618
1277
|
});
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
],
|
|
1632
|
-
negative: [
|
|
1633
|
-
'Potential scalability limitations',
|
|
1634
|
-
'Schema migration complexity'
|
|
1635
|
-
]
|
|
1636
|
-
},
|
|
1637
|
-
alternatives: [
|
|
1638
|
-
'NoSQL database',
|
|
1639
|
-
'Document database',
|
|
1640
|
-
'Graph database'
|
|
1641
|
-
],
|
|
1642
|
-
date: new Date().toISOString()
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
if (reqLower.includes('message') || reqLower.includes('event')) {
|
|
1281
|
+
integrations.push({
|
|
1282
|
+
name: 'Message Queue Integration',
|
|
1283
|
+
type: 'Message Queue',
|
|
1284
|
+
purpose: 'Asynchronous communication',
|
|
1285
|
+
protocol: 'AMQP or proprietary',
|
|
1286
|
+
authentication: 'Queue-specific authentication',
|
|
1287
|
+
dataFormat: 'JSON or Binary',
|
|
1288
|
+
errorHandling: 'Dead letter queues and retry policies',
|
|
1289
|
+
monitoring: 'Queue depth and processing time monitoring',
|
|
1643
1290
|
});
|
|
1644
|
-
|
|
1291
|
+
}
|
|
1645
1292
|
}
|
|
1646
|
-
|
|
1293
|
+
|
|
1294
|
+
// Add common integrations
|
|
1295
|
+
integrations.push({
|
|
1296
|
+
name: 'Logging Integration',
|
|
1297
|
+
type: 'Logging Service',
|
|
1298
|
+
purpose: 'Centralized logging and monitoring',
|
|
1299
|
+
protocol: 'HTTP/HTTPS',
|
|
1300
|
+
authentication: 'API Key',
|
|
1301
|
+
dataFormat: 'Structured logs (JSON)',
|
|
1302
|
+
errorHandling: 'Local buffering with batch sending',
|
|
1303
|
+
monitoring: 'Log ingestion and processing monitoring',
|
|
1304
|
+
});
|
|
1305
|
+
|
|
1306
|
+
return integrations;
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
/**
|
|
1310
|
+
* Define quality attributes
|
|
1311
|
+
*/
|
|
1312
|
+
async defineQualityAttributes(specification) {
|
|
1313
|
+
return {
|
|
1314
|
+
performance: {
|
|
1315
|
+
responseTime: 'API responses under 200ms for 95th percentile',
|
|
1316
|
+
throughput: 'Handle 1000+ requests per second',
|
|
1317
|
+
scalability: 'Scale horizontally to handle load increases',
|
|
1318
|
+
efficiency: 'Optimize resource usage and minimize waste',
|
|
1319
|
+
},
|
|
1320
|
+
reliability: {
|
|
1321
|
+
availability: '99.9% uptime with planned maintenance windows',
|
|
1322
|
+
faultTolerance: 'Graceful degradation when components fail',
|
|
1323
|
+
recoverability: 'Automatic recovery from transient failures',
|
|
1324
|
+
durability: 'Data persistence with backup and recovery',
|
|
1325
|
+
},
|
|
1326
|
+
security: {
|
|
1327
|
+
confidentiality: 'Protect sensitive data with encryption',
|
|
1328
|
+
integrity: 'Ensure data accuracy and prevent tampering',
|
|
1329
|
+
authentication: 'Verify user identity before access',
|
|
1330
|
+
authorization: 'Control access based on user permissions',
|
|
1331
|
+
},
|
|
1332
|
+
usability: {
|
|
1333
|
+
learnability: 'Intuitive interfaces requiring minimal training',
|
|
1334
|
+
efficiency: 'Allow experienced users to work efficiently',
|
|
1335
|
+
memorability: 'Easy to remember after periods of non-use',
|
|
1336
|
+
errors: 'Minimize user errors and provide clear error messages',
|
|
1337
|
+
},
|
|
1338
|
+
maintainability: {
|
|
1339
|
+
modifiability: 'Easy to modify and extend functionality',
|
|
1340
|
+
testability: 'Comprehensive test coverage and automated testing',
|
|
1341
|
+
reusability: 'Modular design with reusable components',
|
|
1342
|
+
analyzability: 'Clear code structure and documentation',
|
|
1343
|
+
},
|
|
1344
|
+
};
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
/**
|
|
1348
|
+
* Document architectural decisions
|
|
1349
|
+
*/
|
|
1350
|
+
async documentArchitecturalDecisions(result) {
|
|
1351
|
+
const decisions = [];
|
|
1352
|
+
|
|
1353
|
+
// Architecture style decision
|
|
1354
|
+
decisions.push({
|
|
1355
|
+
id: 'AD-001',
|
|
1356
|
+
title: `Use ${result.systemDesign.style} Architecture`,
|
|
1357
|
+
status: 'Accepted',
|
|
1358
|
+
context: 'Need to choose appropriate architectural style for the system',
|
|
1359
|
+
decision: `Implement ${result.systemDesign.style} architecture with ${result.systemDesign.layers.length} layers`,
|
|
1360
|
+
consequences: {
|
|
1361
|
+
positive: [
|
|
1362
|
+
'Clear separation of concerns',
|
|
1363
|
+
'Maintainable code structure',
|
|
1364
|
+
'Scalable design',
|
|
1365
|
+
],
|
|
1366
|
+
negative: ['Potential performance overhead', 'Added complexity for simple operations'],
|
|
1367
|
+
},
|
|
1368
|
+
alternatives: ['Monolithic', 'Microservices', 'Event-driven'],
|
|
1369
|
+
date: new Date().toISOString(),
|
|
1370
|
+
});
|
|
1371
|
+
|
|
1372
|
+
// Design patterns decision
|
|
1373
|
+
decisions.push({
|
|
1374
|
+
id: 'AD-002',
|
|
1375
|
+
title: 'Apply Standard Design Patterns',
|
|
1376
|
+
status: 'Accepted',
|
|
1377
|
+
context: 'Need to ensure consistent and well-understood design patterns',
|
|
1378
|
+
decision: `Implement ${result.designPatterns.length} design patterns including Repository, Factory, and Strategy patterns`,
|
|
1379
|
+
consequences: {
|
|
1380
|
+
positive: [
|
|
1381
|
+
'Improved code maintainability',
|
|
1382
|
+
'Better testability',
|
|
1383
|
+
'Consistent design approach',
|
|
1384
|
+
],
|
|
1385
|
+
negative: ['Learning curve for developers', 'Potential over-engineering'],
|
|
1386
|
+
},
|
|
1387
|
+
alternatives: ['Ad-hoc design', 'Framework-specific patterns'],
|
|
1388
|
+
date: new Date().toISOString(),
|
|
1389
|
+
});
|
|
1390
|
+
|
|
1391
|
+
// Data model decision
|
|
1392
|
+
decisions.push({
|
|
1393
|
+
id: 'AD-003',
|
|
1394
|
+
title: 'Relational Database Design',
|
|
1395
|
+
status: 'Accepted',
|
|
1396
|
+
context: 'Need to choose appropriate data storage and modeling approach',
|
|
1397
|
+
decision: `Use relational database with ${result.dataModel.entities.length} entities and normalized schema`,
|
|
1398
|
+
consequences: {
|
|
1399
|
+
positive: ['ACID compliance', 'Strong consistency', 'Mature ecosystem'],
|
|
1400
|
+
negative: ['Potential scalability limitations', 'Schema migration complexity'],
|
|
1401
|
+
},
|
|
1402
|
+
alternatives: ['NoSQL database', 'Document database', 'Graph database'],
|
|
1403
|
+
date: new Date().toISOString(),
|
|
1404
|
+
});
|
|
1405
|
+
|
|
1406
|
+
return decisions;
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
/**
|
|
1647
1410
|
* Assess architectural risks
|
|
1648
|
-
*/
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1411
|
+
*/
|
|
1412
|
+
async assessArchitecturalRisks(result) {
|
|
1413
|
+
const risks = [];
|
|
1414
|
+
|
|
1415
|
+
// Complexity risk
|
|
1416
|
+
risks.push({
|
|
1417
|
+
id: 'AR-001',
|
|
1418
|
+
category: 'Complexity',
|
|
1419
|
+
description: 'System complexity may lead to maintenance challenges',
|
|
1420
|
+
probability: 'Medium',
|
|
1421
|
+
impact: 'High',
|
|
1422
|
+
riskLevel: 'High',
|
|
1423
|
+
mitigation: [
|
|
1424
|
+
'Implement comprehensive documentation',
|
|
1425
|
+
'Provide developer training',
|
|
1426
|
+
'Establish coding standards',
|
|
1427
|
+
'Regular code reviews',
|
|
1428
|
+
],
|
|
1429
|
+
monitoring: 'Code complexity metrics and maintainability index',
|
|
1430
|
+
});
|
|
1431
|
+
|
|
1432
|
+
// Performance risk
|
|
1433
|
+
risks.push({
|
|
1434
|
+
id: 'AR-002',
|
|
1435
|
+
category: 'Performance',
|
|
1436
|
+
description: 'Layered architecture may introduce performance overhead',
|
|
1437
|
+
probability: 'Low',
|
|
1438
|
+
impact: 'Medium',
|
|
1439
|
+
riskLevel: 'Medium',
|
|
1440
|
+
mitigation: [
|
|
1441
|
+
'Performance testing and profiling',
|
|
1442
|
+
'Caching strategies',
|
|
1443
|
+
'Database optimization',
|
|
1444
|
+
'Load balancing',
|
|
1445
|
+
],
|
|
1446
|
+
monitoring: 'Response time and throughput monitoring',
|
|
1447
|
+
});
|
|
1448
|
+
|
|
1449
|
+
// Security risk
|
|
1450
|
+
risks.push({
|
|
1451
|
+
id: 'AR-003',
|
|
1452
|
+
category: 'Security',
|
|
1453
|
+
description: 'Multiple integration points increase attack surface',
|
|
1454
|
+
probability: 'Medium',
|
|
1455
|
+
impact: 'High',
|
|
1456
|
+
riskLevel: 'High',
|
|
1457
|
+
mitigation: [
|
|
1458
|
+
'Security architecture review',
|
|
1459
|
+
'Regular security testing',
|
|
1460
|
+
'Input validation and sanitization',
|
|
1461
|
+
'Secure communication protocols',
|
|
1462
|
+
],
|
|
1463
|
+
monitoring: 'Security event monitoring and alerting',
|
|
1464
|
+
});
|
|
1465
|
+
|
|
1466
|
+
// Scalability risk
|
|
1467
|
+
risks.push({
|
|
1468
|
+
id: 'AR-004',
|
|
1469
|
+
category: 'Scalability',
|
|
1470
|
+
description: 'Database may become bottleneck under high load',
|
|
1471
|
+
probability: 'Medium',
|
|
1472
|
+
impact: 'High',
|
|
1473
|
+
riskLevel: 'High',
|
|
1474
|
+
mitigation: [
|
|
1475
|
+
'Database optimization',
|
|
1476
|
+
'Read replicas and caching',
|
|
1477
|
+
'Connection pooling',
|
|
1478
|
+
'Horizontal scaling strategies',
|
|
1479
|
+
],
|
|
1480
|
+
monitoring: 'Database performance and connection monitoring',
|
|
1481
|
+
});
|
|
1482
|
+
|
|
1483
|
+
return risks;
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1486
|
+
/**
|
|
1717
1487
|
* Generate architecture document
|
|
1718
|
-
*/
|
|
1719
|
-
|
|
1488
|
+
*/
|
|
1489
|
+
async generateArchitectureDocument(result) {
|
|
1490
|
+
const document = `# ${this.taskDescription} - Architecture Design
|
|
1720
1491
|
|
|
1721
1492
|
## System Architecture
|
|
1722
1493
|
|
|
@@ -1724,26 +1495,36 @@ export class SparcArchitecture extends SparcPhase {
|
|
|
1724
1495
|
**Style**: ${result.systemDesign.style}
|
|
1725
1496
|
**Layers**: ${result.systemDesign.layers.length}
|
|
1726
1497
|
|
|
1727
|
-
${result.systemDesign.layers
|
|
1498
|
+
${result.systemDesign.layers
|
|
1499
|
+
.map(
|
|
1500
|
+
(layer, index) => `
|
|
1728
1501
|
#### ${index + 1}. ${layer.name}
|
|
1729
1502
|
**Responsibility**: ${layer.responsibility}
|
|
1730
|
-
|
|
1503
|
+
`,
|
|
1504
|
+
)
|
|
1505
|
+
.join('\n')}
|
|
1731
1506
|
|
|
1732
1507
|
### Data Flow
|
|
1733
|
-
${result.systemDesign.dataFlow.map((flow)
|
|
1508
|
+
${result.systemDesign.dataFlow.map((flow) => `- ${flow.from} → ${flow.to} (${flow.direction}): ${flow.dataType}`).join('\n')}
|
|
1734
1509
|
|
|
1735
1510
|
### Control Flow
|
|
1736
|
-
${result.systemDesign.controlFlow
|
|
1511
|
+
${result.systemDesign.controlFlow
|
|
1512
|
+
.map(
|
|
1513
|
+
(flow) => `
|
|
1737
1514
|
#### ${flow.layer}
|
|
1738
1515
|
- **Order**: ${flow.order}
|
|
1739
1516
|
- **Triggers**: ${flow.triggers.join(', ')}
|
|
1740
1517
|
- **Actions**: ${flow.actions.join(', ')}
|
|
1741
1518
|
- **Outcomes**: ${flow.outcomes.join(', ')}
|
|
1742
|
-
|
|
1519
|
+
`,
|
|
1520
|
+
)
|
|
1521
|
+
.join('\n')}
|
|
1743
1522
|
|
|
1744
1523
|
## Components
|
|
1745
1524
|
|
|
1746
|
-
${result.components
|
|
1525
|
+
${result.components
|
|
1526
|
+
.map(
|
|
1527
|
+
(component, index) => `
|
|
1747
1528
|
### ${index + 1}. ${component.name}
|
|
1748
1529
|
**Type**: ${component.type}
|
|
1749
1530
|
**Responsibility**: ${component.responsibility}
|
|
@@ -1751,44 +1532,58 @@ ${result.components.map((component, index)=>`
|
|
|
1751
1532
|
**Dependencies**: ${component.dependencies.join(', ')}
|
|
1752
1533
|
**Patterns**: ${component.patterns.join(', ')}
|
|
1753
1534
|
**Complexity**: ${component.complexity}
|
|
1754
|
-
|
|
1535
|
+
`,
|
|
1536
|
+
)
|
|
1537
|
+
.join('\n')}
|
|
1755
1538
|
|
|
1756
1539
|
## Design Patterns
|
|
1757
1540
|
|
|
1758
|
-
${result.designPatterns
|
|
1541
|
+
${result.designPatterns
|
|
1542
|
+
.map(
|
|
1543
|
+
(pattern, index) => `
|
|
1759
1544
|
### ${index + 1}. ${pattern.name}
|
|
1760
1545
|
**Type**: ${pattern.type}
|
|
1761
1546
|
**Purpose**: ${pattern.purpose}
|
|
1762
1547
|
**Applicability**: ${pattern.applicability}
|
|
1763
1548
|
**Implementation**: ${pattern.implementation}
|
|
1764
1549
|
**Benefits**: ${pattern.benefits.join(', ')}
|
|
1765
|
-
|
|
1550
|
+
`,
|
|
1551
|
+
)
|
|
1552
|
+
.join('\n')}
|
|
1766
1553
|
|
|
1767
1554
|
## Data Model
|
|
1768
1555
|
|
|
1769
1556
|
### Entities
|
|
1770
|
-
${result.dataModel.entities
|
|
1557
|
+
${result.dataModel.entities
|
|
1558
|
+
.map(
|
|
1559
|
+
(entity, index) => `
|
|
1771
1560
|
#### ${index + 1}. ${entity.name}
|
|
1772
1561
|
**Primary Key**: ${entity.primaryKey}
|
|
1773
1562
|
**Attributes**:
|
|
1774
|
-
${entity.attributes.map((attr)
|
|
1563
|
+
${entity.attributes.map((attr) => `- ${attr.name}: ${attr.type}${attr.nullable ? '' : ' NOT NULL'}${attr.unique ? ' UNIQUE' : ''}${attr.default ? ` DEFAULT ${attr.default}` : ''}`).join('\n')}
|
|
1775
1564
|
|
|
1776
1565
|
**Constraints**:
|
|
1777
|
-
${entity.constraints.map((constraint)
|
|
1566
|
+
${entity.constraints.map((constraint) => `- ${constraint.name}: ${constraint.type}${constraint.condition ? ` (${constraint.condition})` : ''}`).join('\n')}
|
|
1778
1567
|
|
|
1779
1568
|
**Indexes**:
|
|
1780
|
-
${entity.indexes.map((index)
|
|
1781
|
-
|
|
1569
|
+
${entity.indexes.map((index) => `- ${index.name}: ${index.type} (${index.columns.join(', ')})`).join('\n')}
|
|
1570
|
+
`,
|
|
1571
|
+
)
|
|
1572
|
+
.join('\n')}
|
|
1782
1573
|
|
|
1783
1574
|
### Relationships
|
|
1784
|
-
${result.dataModel.relationships
|
|
1575
|
+
${result.dataModel.relationships
|
|
1576
|
+
.map(
|
|
1577
|
+
(rel, index) => `
|
|
1785
1578
|
#### ${index + 1}. ${rel.name}
|
|
1786
1579
|
**Type**: ${rel.type}
|
|
1787
1580
|
**Parent**: ${rel.parent} (${rel.parentKey})
|
|
1788
1581
|
**Child**: ${rel.child} (${rel.childKey})
|
|
1789
1582
|
**On Delete**: ${rel.onDelete}
|
|
1790
1583
|
**On Update**: ${rel.onUpdate}
|
|
1791
|
-
|
|
1584
|
+
`,
|
|
1585
|
+
)
|
|
1586
|
+
.join('\n')}
|
|
1792
1587
|
|
|
1793
1588
|
## API Design
|
|
1794
1589
|
|
|
@@ -1798,33 +1593,52 @@ ${result.dataModel.relationships.map((rel, index)=>`
|
|
|
1798
1593
|
**Authentication**: ${result.apiDesign.authentication}
|
|
1799
1594
|
|
|
1800
1595
|
### Endpoints
|
|
1801
|
-
${result.apiDesign.endpoints
|
|
1596
|
+
${result.apiDesign.endpoints
|
|
1597
|
+
.map(
|
|
1598
|
+
(endpoint, index) => `
|
|
1802
1599
|
#### ${index + 1}. ${endpoint.method} ${endpoint.path}
|
|
1803
1600
|
**Summary**: ${endpoint.summary}
|
|
1804
|
-
**Parameters**: ${endpoint.parameters ? endpoint.parameters.map((p)
|
|
1601
|
+
**Parameters**: ${endpoint.parameters ? endpoint.parameters.map((p) => `${p.name} (${p.type})`).join(', ') : 'None'}
|
|
1805
1602
|
**Request Body**: ${endpoint.requestBody ? endpoint.requestBody.schema : 'None'}
|
|
1806
|
-
**Responses**: ${Object.entries(endpoint.responses)
|
|
1807
|
-
|
|
1603
|
+
**Responses**: ${Object.entries(endpoint.responses)
|
|
1604
|
+
.map(([code, resp]) => `${code}: ${resp.description}`)
|
|
1605
|
+
.join(', ')}
|
|
1606
|
+
`,
|
|
1607
|
+
)
|
|
1608
|
+
.join('\n')}
|
|
1808
1609
|
|
|
1809
1610
|
### Schemas
|
|
1810
|
-
${result.apiDesign.schemas
|
|
1611
|
+
${result.apiDesign.schemas
|
|
1612
|
+
.map(
|
|
1613
|
+
(schema, index) => `
|
|
1811
1614
|
#### ${index + 1}. ${schema.name}
|
|
1812
1615
|
**Type**: ${schema.type}
|
|
1813
1616
|
**Properties**:
|
|
1814
|
-
${Object.entries(schema.properties)
|
|
1617
|
+
${Object.entries(schema.properties)
|
|
1618
|
+
.map(
|
|
1619
|
+
([name, prop]) =>
|
|
1620
|
+
`- ${name}: ${prop.type}${prop.format ? ` (${prop.format})` : ''}${prop.enum ? ` [${prop.enum.join(', ')}]` : ''}`,
|
|
1621
|
+
)
|
|
1622
|
+
.join('\n')}
|
|
1815
1623
|
**Required**: ${schema.required ? schema.required.join(', ') : 'None'}
|
|
1816
|
-
|
|
1624
|
+
`,
|
|
1625
|
+
)
|
|
1626
|
+
.join('\n')}
|
|
1817
1627
|
|
|
1818
1628
|
## Deployment Architecture
|
|
1819
1629
|
|
|
1820
1630
|
### Environments
|
|
1821
|
-
${result.deploymentArchitecture.environments
|
|
1631
|
+
${result.deploymentArchitecture.environments
|
|
1632
|
+
.map(
|
|
1633
|
+
(env, index) => `
|
|
1822
1634
|
#### ${index + 1}. ${env.name}
|
|
1823
1635
|
**Purpose**: ${env.purpose}
|
|
1824
1636
|
**Resources**: ${env.resources}
|
|
1825
1637
|
**Database**: ${env.database}
|
|
1826
1638
|
**Monitoring**: ${env.monitoring}
|
|
1827
|
-
|
|
1639
|
+
`,
|
|
1640
|
+
)
|
|
1641
|
+
.join('\n')}
|
|
1828
1642
|
|
|
1829
1643
|
### Infrastructure
|
|
1830
1644
|
**Platform**: ${result.deploymentArchitecture.infrastructure.platform}
|
|
@@ -1865,14 +1679,22 @@ ${result.deploymentArchitecture.environments.map((env, index)=>`
|
|
|
1865
1679
|
|
|
1866
1680
|
## Quality Attributes
|
|
1867
1681
|
|
|
1868
|
-
${Object.entries(result.qualityAttributes)
|
|
1682
|
+
${Object.entries(result.qualityAttributes)
|
|
1683
|
+
.map(
|
|
1684
|
+
([category, attributes]) => `
|
|
1869
1685
|
### ${category.charAt(0).toUpperCase() + category.slice(1)}
|
|
1870
|
-
${Object.entries(attributes)
|
|
1871
|
-
|
|
1686
|
+
${Object.entries(attributes)
|
|
1687
|
+
.map(([attr, desc]) => `- **${attr}**: ${desc}`)
|
|
1688
|
+
.join('\n')}
|
|
1689
|
+
`,
|
|
1690
|
+
)
|
|
1691
|
+
.join('\n')}
|
|
1872
1692
|
|
|
1873
1693
|
## Architectural Decisions
|
|
1874
1694
|
|
|
1875
|
-
${result.architecturalDecisions
|
|
1695
|
+
${result.architecturalDecisions
|
|
1696
|
+
.map(
|
|
1697
|
+
(decision, index) => `
|
|
1876
1698
|
### ${decision.id}: ${decision.title}
|
|
1877
1699
|
**Status**: ${decision.status}
|
|
1878
1700
|
**Context**: ${decision.context}
|
|
@@ -1881,11 +1703,15 @@ ${result.architecturalDecisions.map((decision, index)=>`
|
|
|
1881
1703
|
**Negative Consequences**: ${decision.consequences.negative.join(', ')}
|
|
1882
1704
|
**Alternatives Considered**: ${decision.alternatives.join(', ')}
|
|
1883
1705
|
**Date**: ${decision.date}
|
|
1884
|
-
|
|
1706
|
+
`,
|
|
1707
|
+
)
|
|
1708
|
+
.join('\n')}
|
|
1885
1709
|
|
|
1886
1710
|
## Risk Assessment
|
|
1887
1711
|
|
|
1888
|
-
${result.riskAssessment
|
|
1712
|
+
${result.riskAssessment
|
|
1713
|
+
.map(
|
|
1714
|
+
(risk, index) => `
|
|
1889
1715
|
### ${risk.id}: ${risk.category}
|
|
1890
1716
|
**Description**: ${risk.description}
|
|
1891
1717
|
**Probability**: ${risk.probability}
|
|
@@ -1893,11 +1719,15 @@ ${result.riskAssessment.map((risk, index)=>`
|
|
|
1893
1719
|
**Risk Level**: ${risk.riskLevel}
|
|
1894
1720
|
**Mitigation**: ${risk.mitigation.join(', ')}
|
|
1895
1721
|
**Monitoring**: ${risk.monitoring}
|
|
1896
|
-
|
|
1722
|
+
`,
|
|
1723
|
+
)
|
|
1724
|
+
.join('\n')}
|
|
1897
1725
|
|
|
1898
1726
|
## Integration Points
|
|
1899
1727
|
|
|
1900
|
-
${result.integrationPoints
|
|
1728
|
+
${result.integrationPoints
|
|
1729
|
+
.map(
|
|
1730
|
+
(integration, index) => `
|
|
1901
1731
|
### ${index + 1}. ${integration.name}
|
|
1902
1732
|
**Type**: ${integration.type}
|
|
1903
1733
|
**Purpose**: ${integration.purpose}
|
|
@@ -1906,19 +1736,15 @@ ${result.integrationPoints.map((integration, index)=>`
|
|
|
1906
1736
|
**Data Format**: ${integration.dataFormat}
|
|
1907
1737
|
**Error Handling**: ${integration.errorHandling}
|
|
1908
1738
|
**Monitoring**: ${integration.monitoring}
|
|
1909
|
-
|
|
1739
|
+
`,
|
|
1740
|
+
)
|
|
1741
|
+
.join('\n')}
|
|
1910
1742
|
`;
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
super('architecture', taskDescription, options);
|
|
1917
|
-
this.components = [];
|
|
1918
|
-
this.designPatterns = [];
|
|
1919
|
-
this.systemDesign = null;
|
|
1920
|
-
this.dataModel = null;
|
|
1921
|
-
this.apiDesign = null;
|
|
1922
|
-
}
|
|
1743
|
+
|
|
1744
|
+
// Save document
|
|
1745
|
+
await this.saveArtifact('architecture.md', document);
|
|
1746
|
+
return document;
|
|
1747
|
+
}
|
|
1923
1748
|
}
|
|
1749
|
+
|
|
1924
1750
|
export default SparcArchitecture;
|