snow-flow 1.4.49 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/helpers/github-setup.sh +28 -0
- package/.claude/helpers/quick-start.sh +19 -0
- package/.claude/helpers/setup-mcp.sh +18 -0
- package/{.claude.settings.template → .claude/settings.local.json} +18 -21
- package/.claude-flow/metrics/system-metrics.json +3060 -0
- package/.env.example +64 -0
- package/.roo/README.md +402 -0
- package/.roo/mcp-list.txt +257 -0
- package/.roo/mcp.json +32 -0
- package/.roo/workflows/basic-tdd.json +32 -0
- package/.roomodes +201 -0
- package/README.md +140 -614
- package/dist/cli.js.bak +2052 -0
- package/package.json +2 -2
- package/scripts/create-env.js +6 -1
- package/scripts/reset-mcp-servers.js +246 -0
- package/scripts/update-version.js +31 -0
- package/src/agents/README.md +192 -0
- package/src/agents/base-agent.ts +251 -0
- package/src/agents/coordinator.ts +971 -0
- package/src/agents/index.ts +18 -0
- package/src/agents/queen-403-handler.ts +230 -0
- package/src/agents/queen-agent.ts +1399 -0
- package/src/agents/script-writer-agent.ts +769 -0
- package/src/agents/security-agent.ts +726 -0
- package/src/agents/widget-creator-agent.ts +568 -0
- package/src/api/error-handling.ts +1758 -0
- package/src/api/natural-language-mapper.ts +630 -0
- package/src/api/performance-optimizer.ts +891 -0
- package/src/api/transaction-manager.ts +754 -0
- package/src/cli/deploy-artifact.ts +304 -0
- package/src/cli/snow-flow-cli-integration.ts +434 -0
- package/src/cli.ts +4455 -0
- package/src/cli.ts.bak +5616 -0
- package/src/compliance/advanced-compliance-system.ts +1268 -0
- package/src/compliance/index.ts +19 -0
- package/src/config/snow-flow-config.ts +1019 -0
- package/src/documentation/index.ts +16 -0
- package/src/documentation/self-documenting-system.ts +1421 -0
- package/src/dynamic-version.ts +44 -0
- package/src/healing/index.ts +20 -0
- package/src/healing/self-healing-system.ts +1435 -0
- package/src/health/README.md +161 -0
- package/src/health/system-health.ts +995 -0
- package/src/index.ts +60 -0
- package/src/intelligence/acl-analyzer.ts +377 -0
- package/src/intelligence/auto-resolution-engine.ts +643 -0
- package/src/intelligence/gap-analysis-engine.ts +488 -0
- package/src/intelligence/manual-instructions-generator.ts +744 -0
- package/src/intelligence/mcp-coverage-analyzer.ts +708 -0
- package/src/intelligence/multi-pass-requirements-analyzer.ts +603 -0
- package/src/intelligence/performance-recommendations-engine.ts +1223 -0
- package/src/intelligence/requirements-analyzer.ts +1148 -0
- package/src/intelligence/task-analyzer.ts +628 -0
- package/src/managers/scope-manager.ts +555 -0
- package/src/mcp/advanced/servicenow-advanced-features-mcp.ts +16110 -0
- package/src/mcp/base-mcp-server.ts +660 -0
- package/src/mcp/http-transport-wrapper.ts +426 -0
- package/src/mcp/service-discovery-client.ts +312 -0
- package/src/mcp/servicenow-automation-mcp-refactored.ts +678 -0
- package/src/mcp/servicenow-automation-mcp.ts +838 -0
- package/src/mcp/servicenow-deployment-mcp-refactored.ts +1292 -0
- package/src/mcp/servicenow-deployment-mcp.ts +7244 -0
- package/src/mcp/servicenow-graph-memory-mcp-refactored.ts +721 -0
- package/src/mcp/servicenow-graph-memory-mcp.ts +832 -0
- package/src/mcp/servicenow-integration-mcp-refactored.ts +655 -0
- package/src/mcp/servicenow-integration-mcp.ts +819 -0
- package/src/mcp/servicenow-intelligent-mcp-refactored.ts +977 -0
- package/src/mcp/servicenow-intelligent-mcp.ts +4638 -0
- package/src/mcp/servicenow-mcp-server.ts +728 -0
- package/src/mcp/servicenow-memory-mcp.ts +474 -0
- package/src/mcp/servicenow-operations-mcp-refactored.ts +1995 -0
- package/src/mcp/servicenow-operations-mcp.ts +3384 -0
- package/src/mcp/servicenow-platform-development-mcp-refactored.ts +611 -0
- package/src/mcp/servicenow-platform-development-mcp.ts +970 -0
- package/src/mcp/servicenow-progressive-indexer.ts +370 -0
- package/src/mcp/servicenow-reporting-analytics-mcp-refactored.ts +695 -0
- package/src/mcp/servicenow-reporting-analytics-mcp.ts +1123 -0
- package/src/mcp/servicenow-security-compliance-mcp-refactored.ts +642 -0
- package/src/mcp/servicenow-security-compliance-mcp.ts +1157 -0
- package/src/mcp/servicenow-update-set-mcp-refactored.ts +751 -0
- package/src/mcp/servicenow-update-set-mcp.ts +811 -0
- package/src/mcp/shared/agent-context-provider.ts +365 -0
- package/src/mcp/shared/base-mcp-server.ts +2463 -0
- package/src/mcp/shared/mcp-memory-manager.ts +540 -0
- package/src/mcp/shared/mcp-resource-manager.ts +367 -0
- package/src/mcp/snow-flow-mcp.ts +911 -0
- package/src/mcp/start-all-mcp-servers.ts +102 -0
- package/src/mcp/start-servicenow-mcp.ts +67 -0
- package/src/monitoring/enhanced-monitoring-system.ts +1345 -0
- package/src/monitoring/performance-tracker.ts +777 -0
- package/src/optimization/cost-optimization-engine.ts +1125 -0
- package/src/optimization/index.ts +10 -0
- package/src/queen/README.md +403 -0
- package/src/queen/agent-factory.ts +574 -0
- package/src/queen/index.ts +94 -0
- package/src/queen/mcp-execution-bridge.ts +681 -0
- package/src/queen/neural-learning.ts +319 -0
- package/src/queen/parallel-agent-engine.ts +848 -0
- package/src/queen/queen-memory-system.ts +490 -0
- package/src/queen/queen-memory.ts +456 -0
- package/src/queen/servicenow-queen.ts +1029 -0
- package/src/queen/types.ts +87 -0
- package/src/rollback/smart-rollback-system.ts +866 -0
- package/src/schemas/deployment.schema.json +58 -0
- package/src/schemas/flow.schema.json +79 -0
- package/src/schemas/widget.schema.json +72 -0
- package/src/snow-flow-system.ts +541 -0
- package/src/sparc/sparc-help.ts +49 -0
- package/src/sparc/team-sparc.ts +88 -0
- package/src/strategies/global-scope-strategy.ts +736 -0
- package/src/templates/base/application.template.json +45 -0
- package/src/templates/base/business_rule.template.json +33 -0
- package/src/templates/base/script_include.template.json +18 -0
- package/src/templates/base/table.template.json +64 -0
- package/src/templates/base/widget.template.json +25 -0
- package/src/templates/patterns/composite.incident-management.template.json +140 -0
- package/src/templates/patterns/widget.dashboard.template.json +238 -0
- package/src/templates/patterns/widget.datatable.template.json +292 -0
- package/src/testing/integration-test-suite.ts +1276 -0
- package/src/types/index.ts +183 -0
- package/src/types/neo4j-driver.d.ts +23 -0
- package/src/types/servicenow.types.ts +307 -0
- package/src/types/snow-flow.types.ts +186 -0
- package/src/types/todo.types.ts +70 -0
- package/src/utils/action-type-cache.ts +286 -0
- package/src/utils/agent-detector.ts +573 -0
- package/src/utils/artifact-tracker.ts +379 -0
- package/src/utils/dependency-detector.ts +233 -0
- package/src/utils/deployment-metadata-handler.ts +518 -0
- package/src/utils/error-recovery.ts +680 -0
- package/src/utils/logger.ts +60 -0
- package/src/utils/mcp-auth-middleware.ts +262 -0
- package/src/utils/mcp-config-manager.ts +270 -0
- package/src/utils/mcp-server-manager.ts +446 -0
- package/src/utils/mcp-tool-registry.ts +298 -0
- package/src/utils/migrate-snow-flow.ts +98 -0
- package/src/utils/oauth-html-templates.ts +188 -0
- package/src/utils/scope-utils.ts +443 -0
- package/src/utils/servicenow-client.ts +3321 -0
- package/src/utils/servicenow-id-generator.ts +181 -0
- package/src/utils/snow-memory-manager.ts +605 -0
- package/src/utils/snow-oauth.ts +797 -0
- package/src/utils/template-engine.ts +463 -0
- package/src/utils/theme-manager.ts +295 -0
- package/src/utils/unified-auth-store.ts +222 -0
- package/src/utils/update-set-importer.ts +422 -0
- package/src/utils/update-set-xml-packager.ts +371 -0
- package/src/utils/widget-template-generator.ts +1744 -0
- package/src/version.ts +1950 -0
- package/.claude/commands/memory/README.md +0 -9
- package/.claude.mcp-config.template +0 -149
- package/SIMPLE_TEST_COMMANDS.txt +0 -143
- package/SNOW_FLOW_ADVANCED_FEATURES_PLAIN.txt +0 -78
- package/TEST_COMMANDS_v139.sh +0 -126
- package/claude-flow +0 -81
- package/claude-flow.bat +0 -18
- package/claude-flow.config.json +0 -20
- package/claude-flow.ps1 +0 -24
- package/dist/agents/app-creator.agent.d.ts.map +0 -1
- package/dist/agents/app-creator.agent.js.map +0 -1
- package/dist/agents/base/base-snow-agent.d.ts.map +0 -1
- package/dist/agents/base/base-snow-agent.js.map +0 -1
- package/dist/agents/base-agent.d.ts.map +0 -1
- package/dist/agents/base-agent.js.map +0 -1
- package/dist/agents/base-snow-agent.d.ts.map +0 -1
- package/dist/agents/base-snow-agent.js.map +0 -1
- package/dist/agents/coordinator.d.ts.map +0 -1
- package/dist/agents/coordinator.js.map +0 -1
- package/dist/agents/flow-builder-agent.d.ts.map +0 -1
- package/dist/agents/flow-builder-agent.js.map +0 -1
- package/dist/agents/index.d.ts.map +0 -1
- package/dist/agents/index.js.map +0 -1
- package/dist/agents/queen-403-handler.d.ts.map +0 -1
- package/dist/agents/queen-403-handler.js.map +0 -1
- package/dist/agents/queen-agent-example.d.ts.map +0 -1
- package/dist/agents/queen-agent-example.js.map +0 -1
- package/dist/agents/queen-agent.d.ts.map +0 -1
- package/dist/agents/queen-agent.js.map +0 -1
- package/dist/agents/queen-agent.test.d.ts.map +0 -1
- package/dist/agents/queen-agent.test.js.map +0 -1
- package/dist/agents/script-generator.agent.d.ts.map +0 -1
- package/dist/agents/script-generator.agent.js.map +0 -1
- package/dist/agents/script-writer-agent.d.ts.map +0 -1
- package/dist/agents/script-writer-agent.js.map +0 -1
- package/dist/agents/security-agent.d.ts.map +0 -1
- package/dist/agents/security-agent.js.map +0 -1
- package/dist/agents/specialists/automation-specialist.agent.d.ts.map +0 -1
- package/dist/agents/specialists/automation-specialist.agent.js.map +0 -1
- package/dist/agents/specialists/data-specialist.agent.d.ts.map +0 -1
- package/dist/agents/specialists/data-specialist.agent.js.map +0 -1
- package/dist/agents/specialists/integration-specialist.agent.d.ts.map +0 -1
- package/dist/agents/specialists/integration-specialist.agent.js.map +0 -1
- package/dist/agents/specialists/reporting-specialist.agent.d.ts.map +0 -1
- package/dist/agents/specialists/reporting-specialist.agent.js.map +0 -1
- package/dist/agents/specialists/security-specialist.agent.d.ts.map +0 -1
- package/dist/agents/specialists/security-specialist.agent.js.map +0 -1
- package/dist/agents/teams/adaptive/adaptive-coordinator.agent.d.ts.map +0 -1
- package/dist/agents/teams/adaptive/adaptive-coordinator.agent.js.map +0 -1
- package/dist/agents/teams/base-team.d.ts.map +0 -1
- package/dist/agents/teams/base-team.js.map +0 -1
- package/dist/agents/teams/team-types.d.ts.map +0 -1
- package/dist/agents/teams/team-types.js.map +0 -1
- package/dist/agents/teams/widget/widget-architect.agent.d.ts.map +0 -1
- package/dist/agents/teams/widget/widget-architect.agent.js.map +0 -1
- package/dist/agents/teams/widget/widget-backend.agent.d.ts.map +0 -1
- package/dist/agents/teams/widget/widget-backend.agent.js.map +0 -1
- package/dist/agents/teams/widget/widget-frontend.agent.d.ts.map +0 -1
- package/dist/agents/teams/widget/widget-frontend.agent.js.map +0 -1
- package/dist/agents/teams/widget/widget-platform.agent.d.ts.map +0 -1
- package/dist/agents/teams/widget/widget-platform.agent.js.map +0 -1
- package/dist/agents/teams/widget/widget-uiux.agent.d.ts.map +0 -1
- package/dist/agents/teams/widget/widget-uiux.agent.js.map +0 -1
- package/dist/agents/test-agent.d.ts.map +0 -1
- package/dist/agents/test-agent.js.map +0 -1
- package/dist/agents/test-agents.d.ts.map +0 -1
- package/dist/agents/test-agents.js.map +0 -1
- package/dist/agents/ui-builder.agent.d.ts.map +0 -1
- package/dist/agents/ui-builder.agent.js.map +0 -1
- package/dist/agents/widget-builder.agent.d.ts.map +0 -1
- package/dist/agents/widget-builder.agent.js.map +0 -1
- package/dist/agents/widget-creator-agent.d.ts.map +0 -1
- package/dist/agents/widget-creator-agent.js.map +0 -1
- package/dist/agents/workflow-designer.agent.d.ts.map +0 -1
- package/dist/agents/workflow-designer.agent.js.map +0 -1
- package/dist/api/error-handling.d.ts.map +0 -1
- package/dist/api/error-handling.js.map +0 -1
- package/dist/api/flow-designer-api.d.ts.map +0 -1
- package/dist/api/flow-designer-api.js.map +0 -1
- package/dist/api/natural-language-mapper.d.ts.map +0 -1
- package/dist/api/natural-language-mapper.js.map +0 -1
- package/dist/api/performance-optimizer.d.ts.map +0 -1
- package/dist/api/performance-optimizer.js.map +0 -1
- package/dist/api/transaction-manager.d.ts.map +0 -1
- package/dist/api/transaction-manager.js.map +0 -1
- package/dist/assembly/team-assembler.d.ts.map +0 -1
- package/dist/assembly/team-assembler.js.map +0 -1
- package/dist/cli/deploy-artifact.d.ts.map +0 -1
- package/dist/cli/deploy-artifact.js.map +0 -1
- package/dist/cli/snow-flow-cli-integration.d.ts.map +0 -1
- package/dist/cli/snow-flow-cli-integration.js.map +0 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/compliance/advanced-compliance-system.d.ts.map +0 -1
- package/dist/compliance/advanced-compliance-system.js.map +0 -1
- package/dist/compliance/index.d.ts.map +0 -1
- package/dist/compliance/index.js.map +0 -1
- package/dist/config/snow-flow-config.d.ts.map +0 -1
- package/dist/config/snow-flow-config.js.map +0 -1
- package/dist/documentation/index.d.ts.map +0 -1
- package/dist/documentation/index.js.map +0 -1
- package/dist/documentation/self-documenting-system.d.ts.map +0 -1
- package/dist/documentation/self-documenting-system.js.map +0 -1
- package/dist/dynamic-version.d.ts.map +0 -1
- package/dist/dynamic-version.js.map +0 -1
- package/dist/healing/index.d.ts.map +0 -1
- package/dist/healing/index.js.map +0 -1
- package/dist/healing/self-healing-system.d.ts.map +0 -1
- package/dist/healing/self-healing-system.js.map +0 -1
- package/dist/health/system-health.d.ts.map +0 -1
- package/dist/health/system-health.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/intelligence/acl-analyzer.d.ts.map +0 -1
- package/dist/intelligence/acl-analyzer.js.map +0 -1
- package/dist/intelligence/auto-resolution-engine.d.ts.map +0 -1
- package/dist/intelligence/auto-resolution-engine.js.map +0 -1
- package/dist/intelligence/gap-analysis-engine.d.ts.map +0 -1
- package/dist/intelligence/gap-analysis-engine.js.map +0 -1
- package/dist/intelligence/manual-instructions-generator.d.ts.map +0 -1
- package/dist/intelligence/manual-instructions-generator.js.map +0 -1
- package/dist/intelligence/mcp-coverage-analyzer.d.ts.map +0 -1
- package/dist/intelligence/mcp-coverage-analyzer.js.map +0 -1
- package/dist/intelligence/multi-pass-requirements-analyzer.d.ts.map +0 -1
- package/dist/intelligence/multi-pass-requirements-analyzer.js.map +0 -1
- package/dist/intelligence/performance-recommendations-engine.d.ts.map +0 -1
- package/dist/intelligence/performance-recommendations-engine.js.map +0 -1
- package/dist/intelligence/requirements-analyzer.d.ts.map +0 -1
- package/dist/intelligence/requirements-analyzer.js.map +0 -1
- package/dist/intelligence/task-analyzer.d.ts.map +0 -1
- package/dist/intelligence/task-analyzer.js.map +0 -1
- package/dist/managers/scope-manager.d.ts.map +0 -1
- package/dist/managers/scope-manager.js.map +0 -1
- package/dist/mcp/advanced/servicenow-advanced-features-mcp.d.ts.map +0 -1
- package/dist/mcp/advanced/servicenow-advanced-features-mcp.js.map +0 -1
- package/dist/mcp/base-mcp-server.d.ts.map +0 -1
- package/dist/mcp/base-mcp-server.js.map +0 -1
- package/dist/mcp/example-refactored-server.d.ts.map +0 -1
- package/dist/mcp/example-refactored-server.js.map +0 -1
- package/dist/mcp/http-transport-wrapper.d.ts.map +0 -1
- package/dist/mcp/http-transport-wrapper.js.map +0 -1
- package/dist/mcp/mcp-wrapper.d.ts.map +0 -1
- package/dist/mcp/mcp-wrapper.js.map +0 -1
- package/dist/mcp/service-discovery-client.d.ts.map +0 -1
- package/dist/mcp/service-discovery-client.js.map +0 -1
- package/dist/mcp/servicenow-automation-mcp-refactored.d.ts.map +0 -1
- package/dist/mcp/servicenow-automation-mcp-refactored.js.map +0 -1
- package/dist/mcp/servicenow-automation-mcp.d.ts.map +0 -1
- package/dist/mcp/servicenow-automation-mcp.js.map +0 -1
- package/dist/mcp/servicenow-deployment-mcp-refactored.d.ts.map +0 -1
- package/dist/mcp/servicenow-deployment-mcp-refactored.js.map +0 -1
- package/dist/mcp/servicenow-deployment-mcp.d.ts.map +0 -1
- package/dist/mcp/servicenow-deployment-mcp.js.map +0 -1
- package/dist/mcp/servicenow-flow-composer-mcp-refactored.d.ts.map +0 -1
- package/dist/mcp/servicenow-flow-composer-mcp-refactored.js.map +0 -1
- package/dist/mcp/servicenow-flow-composer-mcp.d.ts.map +0 -1
- package/dist/mcp/servicenow-flow-composer-mcp.js.map +0 -1
- package/dist/mcp/servicenow-graph-memory-mcp-refactored.d.ts.map +0 -1
- package/dist/mcp/servicenow-graph-memory-mcp-refactored.js.map +0 -1
- package/dist/mcp/servicenow-graph-memory-mcp.d.ts.map +0 -1
- package/dist/mcp/servicenow-graph-memory-mcp.js.map +0 -1
- package/dist/mcp/servicenow-integration-mcp-refactored.d.ts.map +0 -1
- package/dist/mcp/servicenow-integration-mcp-refactored.js.map +0 -1
- package/dist/mcp/servicenow-integration-mcp.d.ts.map +0 -1
- package/dist/mcp/servicenow-integration-mcp.js.map +0 -1
- package/dist/mcp/servicenow-intelligent-mcp-refactored.d.ts.map +0 -1
- package/dist/mcp/servicenow-intelligent-mcp-refactored.js.map +0 -1
- package/dist/mcp/servicenow-intelligent-mcp.d.ts.map +0 -1
- package/dist/mcp/servicenow-intelligent-mcp.js.map +0 -1
- package/dist/mcp/servicenow-mcp-server.d.ts.map +0 -1
- package/dist/mcp/servicenow-mcp-server.js.map +0 -1
- package/dist/mcp/servicenow-memory-mcp.d.ts.map +0 -1
- package/dist/mcp/servicenow-memory-mcp.js.map +0 -1
- package/dist/mcp/servicenow-operations-mcp-refactored.d.ts.map +0 -1
- package/dist/mcp/servicenow-operations-mcp-refactored.js.map +0 -1
- package/dist/mcp/servicenow-operations-mcp.d.ts.map +0 -1
- package/dist/mcp/servicenow-operations-mcp.js.map +0 -1
- package/dist/mcp/servicenow-platform-development-mcp-refactored.d.ts.map +0 -1
- package/dist/mcp/servicenow-platform-development-mcp-refactored.js.map +0 -1
- package/dist/mcp/servicenow-platform-development-mcp.d.ts.map +0 -1
- package/dist/mcp/servicenow-platform-development-mcp.js.map +0 -1
- package/dist/mcp/servicenow-progressive-indexer.d.ts.map +0 -1
- package/dist/mcp/servicenow-progressive-indexer.js.map +0 -1
- package/dist/mcp/servicenow-reporting-analytics-mcp-refactored.d.ts.map +0 -1
- package/dist/mcp/servicenow-reporting-analytics-mcp-refactored.js.map +0 -1
- package/dist/mcp/servicenow-reporting-analytics-mcp.d.ts.map +0 -1
- package/dist/mcp/servicenow-reporting-analytics-mcp.js.map +0 -1
- package/dist/mcp/servicenow-security-compliance-mcp-refactored.d.ts.map +0 -1
- package/dist/mcp/servicenow-security-compliance-mcp-refactored.js.map +0 -1
- package/dist/mcp/servicenow-security-compliance-mcp.d.ts.map +0 -1
- package/dist/mcp/servicenow-security-compliance-mcp.js.map +0 -1
- package/dist/mcp/servicenow-update-set-mcp-refactored.d.ts.map +0 -1
- package/dist/mcp/servicenow-update-set-mcp-refactored.js.map +0 -1
- package/dist/mcp/servicenow-update-set-mcp.d.ts.map +0 -1
- package/dist/mcp/servicenow-update-set-mcp.js.map +0 -1
- package/dist/mcp/servicenow-xml-flow-mcp.d.ts.map +0 -1
- package/dist/mcp/servicenow-xml-flow-mcp.js.map +0 -1
- package/dist/mcp/shared/agent-context-provider.d.ts.map +0 -1
- package/dist/mcp/shared/agent-context-provider.js.map +0 -1
- package/dist/mcp/shared/base-mcp-server.d.ts.map +0 -1
- package/dist/mcp/shared/base-mcp-server.js.map +0 -1
- package/dist/mcp/shared/mcp-memory-manager.d.ts.map +0 -1
- package/dist/mcp/shared/mcp-memory-manager.js.map +0 -1
- package/dist/mcp/shared/mcp-resource-manager.d.ts.map +0 -1
- package/dist/mcp/shared/mcp-resource-manager.js.map +0 -1
- package/dist/mcp/snow-flow-mcp.d.ts.map +0 -1
- package/dist/mcp/snow-flow-mcp.js.map +0 -1
- package/dist/mcp/start-all-mcp-servers.d.ts.map +0 -1
- package/dist/mcp/start-all-mcp-servers.js.map +0 -1
- package/dist/mcp/start-servicenow-mcp.d.ts.map +0 -1
- package/dist/mcp/start-servicenow-mcp.js.map +0 -1
- package/dist/mcp/test-simple-mcp.d.ts.map +0 -1
- package/dist/mcp/test-simple-mcp.js.map +0 -1
- package/dist/memory/hierarchical-memory-system.d.ts +0 -90
- package/dist/memory/hierarchical-memory-system.d.ts.map +0 -1
- package/dist/memory/hierarchical-memory-system.js +0 -400
- package/dist/memory/hierarchical-memory-system.js.map +0 -1
- package/dist/memory/index.d.ts +0 -9
- package/dist/memory/index.d.ts.map +0 -1
- package/dist/memory/index.js +0 -20
- package/dist/memory/index.js.map +0 -1
- package/dist/memory/mcp-integration-example.d.ts +0 -6
- package/dist/memory/mcp-integration-example.d.ts.map +0 -1
- package/dist/memory/mcp-integration-example.js +0 -281
- package/dist/memory/mcp-integration-example.js.map +0 -1
- package/dist/memory/memory-client.d.ts +0 -199
- package/dist/memory/memory-client.d.ts.map +0 -1
- package/dist/memory/memory-client.js +0 -364
- package/dist/memory/memory-client.js.map +0 -1
- package/dist/memory/memory-manager.d.ts +0 -29
- package/dist/memory/memory-manager.d.ts.map +0 -1
- package/dist/memory/memory-manager.js +0 -280
- package/dist/memory/memory-manager.js.map +0 -1
- package/dist/memory/memory-operations.d.ts +0 -179
- package/dist/memory/memory-operations.d.ts.map +0 -1
- package/dist/memory/memory-operations.js +0 -691
- package/dist/memory/memory-operations.js.map +0 -1
- package/dist/memory/memory-system.d.ts +0 -152
- package/dist/memory/memory-system.d.ts.map +0 -1
- package/dist/memory/memory-system.js +0 -632
- package/dist/memory/memory-system.js.map +0 -1
- package/dist/memory/memory-test.d.ts +0 -6
- package/dist/memory/memory-test.d.ts.map +0 -1
- package/dist/memory/memory-test.js +0 -161
- package/dist/memory/memory-test.js.map +0 -1
- package/dist/memory/servicenow-artifact-indexer.d.ts +0 -119
- package/dist/memory/servicenow-artifact-indexer.d.ts.map +0 -1
- package/dist/memory/servicenow-artifact-indexer.js +0 -560
- package/dist/memory/servicenow-artifact-indexer.js.map +0 -1
- package/dist/memory/snow-flow-memory-patterns.d.ts +0 -213
- package/dist/memory/snow-flow-memory-patterns.d.ts.map +0 -1
- package/dist/memory/snow-flow-memory-patterns.js +0 -200
- package/dist/memory/snow-flow-memory-patterns.js.map +0 -1
- package/dist/memory/snow-memory.d.ts +0 -54
- package/dist/memory/snow-memory.d.ts.map +0 -1
- package/dist/memory/snow-memory.js +0 -301
- package/dist/memory/snow-memory.js.map +0 -1
- package/dist/memory/swarm-memory.d.ts +0 -135
- package/dist/memory/swarm-memory.d.ts.map +0 -1
- package/dist/memory/swarm-memory.js +0 -378
- package/dist/memory/swarm-memory.js.map +0 -1
- package/dist/monitoring/enhanced-monitoring-system.d.ts.map +0 -1
- package/dist/monitoring/enhanced-monitoring-system.js.map +0 -1
- package/dist/monitoring/performance-tracker.d.ts.map +0 -1
- package/dist/monitoring/performance-tracker.js.map +0 -1
- package/dist/optimization/cost-optimization-engine.d.ts.map +0 -1
- package/dist/optimization/cost-optimization-engine.js.map +0 -1
- package/dist/optimization/index.d.ts.map +0 -1
- package/dist/optimization/index.js.map +0 -1
- package/dist/orchestration/discovery/service-discovery.d.ts.map +0 -1
- package/dist/orchestration/discovery/service-discovery.js.map +0 -1
- package/dist/orchestration/distributed-orchestrator.d.ts.map +0 -1
- package/dist/orchestration/distributed-orchestrator.js.map +0 -1
- package/dist/orchestration/distribution/task-distribution-engine.d.ts.map +0 -1
- package/dist/orchestration/distribution/task-distribution-engine.js.map +0 -1
- package/dist/orchestration/interfaces/distributed-orchestration.interface.d.ts.map +0 -1
- package/dist/orchestration/interfaces/distributed-orchestration.interface.js.map +0 -1
- package/dist/orchestration/protocols/mcpx-protocol.d.ts.map +0 -1
- package/dist/orchestration/protocols/mcpx-protocol.js.map +0 -1
- package/dist/orchestration/state/distributed-state-manager.d.ts.map +0 -1
- package/dist/orchestration/state/distributed-state-manager.js.map +0 -1
- package/dist/orchestrator/flow-composer.d.ts.map +0 -1
- package/dist/orchestrator/flow-composer.js.map +0 -1
- package/dist/orchestrator/flow-pattern-templates.d.ts.map +0 -1
- package/dist/orchestrator/flow-pattern-templates.js.map +0 -1
- package/dist/orchestrator/flow-subflow-decision-engine.d.ts.map +0 -1
- package/dist/orchestrator/flow-subflow-decision-engine.js.map +0 -1
- package/dist/orchestrator/flow-validation-engine.d.ts.map +0 -1
- package/dist/orchestrator/flow-validation-engine.js.map +0 -1
- package/dist/orchestrator/snow-orchestrator.d.ts.map +0 -1
- package/dist/orchestrator/snow-orchestrator.js.map +0 -1
- package/dist/orchestrator/subflow-creation-handler.d.ts.map +0 -1
- package/dist/orchestrator/subflow-creation-handler.js.map +0 -1
- package/dist/patterns/adaptive-patterns.d.ts.map +0 -1
- package/dist/patterns/adaptive-patterns.js.map +0 -1
- package/dist/queen/advanced-integration-test.d.ts.map +0 -1
- package/dist/queen/advanced-integration-test.js.map +0 -1
- package/dist/queen/agent-factory.d.ts.map +0 -1
- package/dist/queen/agent-factory.js.map +0 -1
- package/dist/queen/index.d.ts.map +0 -1
- package/dist/queen/index.js.map +0 -1
- package/dist/queen/integration-example.d.ts.map +0 -1
- package/dist/queen/integration-example.js.map +0 -1
- package/dist/queen/integration-test.d.ts.map +0 -1
- package/dist/queen/integration-test.js.map +0 -1
- package/dist/queen/mcp-execution-bridge.d.ts.map +0 -1
- package/dist/queen/mcp-execution-bridge.js.map +0 -1
- package/dist/queen/mock-mcp-client.d.ts.map +0 -1
- package/dist/queen/mock-mcp-client.js.map +0 -1
- package/dist/queen/neural-learning.d.ts.map +0 -1
- package/dist/queen/neural-learning.js.map +0 -1
- package/dist/queen/parallel-agent-engine.d.ts.map +0 -1
- package/dist/queen/parallel-agent-engine.js.map +0 -1
- package/dist/queen/queen-memory-system.d.ts.map +0 -1
- package/dist/queen/queen-memory-system.js.map +0 -1
- package/dist/queen/queen-memory.d.ts.map +0 -1
- package/dist/queen/queen-memory.js.map +0 -1
- package/dist/queen/run-integration-tests.d.ts.map +0 -1
- package/dist/queen/run-integration-tests.js.map +0 -1
- package/dist/queen/servicenow-queen.d.ts.map +0 -1
- package/dist/queen/servicenow-queen.js.map +0 -1
- package/dist/queen/types.d.ts.map +0 -1
- package/dist/queen/types.js.map +0 -1
- package/dist/rollback/smart-rollback-system.d.ts.map +0 -1
- package/dist/rollback/smart-rollback-system.js.map +0 -1
- package/dist/snow-flow-system.d.ts.map +0 -1
- package/dist/snow-flow-system.js.map +0 -1
- package/dist/sparc/coordinators/adaptive-coordinator.d.ts.map +0 -1
- package/dist/sparc/coordinators/adaptive-coordinator.js.map +0 -1
- package/dist/sparc/coordinators/team-coordinator.d.ts.map +0 -1
- package/dist/sparc/coordinators/team-coordinator.js.map +0 -1
- package/dist/sparc/modes/team-modes.d.ts.map +0 -1
- package/dist/sparc/modes/team-modes.js.map +0 -1
- package/dist/sparc/sparc-help.d.ts.map +0 -1
- package/dist/sparc/sparc-help.js.map +0 -1
- package/dist/sparc/team-sparc.d.ts.map +0 -1
- package/dist/sparc/team-sparc.js.map +0 -1
- package/dist/sparc/teams/application-team.d.ts.map +0 -1
- package/dist/sparc/teams/application-team.js.map +0 -1
- package/dist/sparc/teams/flow-team.d.ts.map +0 -1
- package/dist/sparc/teams/flow-team.js.map +0 -1
- package/dist/sparc/teams/widget-team.d.ts.map +0 -1
- package/dist/sparc/teams/widget-team.js.map +0 -1
- package/dist/specialists/app-specialists.d.ts.map +0 -1
- package/dist/specialists/app-specialists.js.map +0 -1
- package/dist/specialists/base-specialist.d.ts.map +0 -1
- package/dist/specialists/base-specialist.js.map +0 -1
- package/dist/specialists/flow-specialists.d.ts.map +0 -1
- package/dist/specialists/flow-specialists.js.map +0 -1
- package/dist/specialists/individual-specialists.d.ts.map +0 -1
- package/dist/specialists/individual-specialists.js.map +0 -1
- package/dist/specialists/widget-specialists.d.ts.map +0 -1
- package/dist/specialists/widget-specialists.js.map +0 -1
- package/dist/strategies/global-scope-strategy.d.ts.map +0 -1
- package/dist/strategies/global-scope-strategy.js.map +0 -1
- package/dist/teams/adaptive-team.d.ts.map +0 -1
- package/dist/teams/adaptive-team.js.map +0 -1
- package/dist/teams/application-team.d.ts.map +0 -1
- package/dist/teams/application-team.js.map +0 -1
- package/dist/teams/base-team.d.ts.map +0 -1
- package/dist/teams/base-team.js.map +0 -1
- package/dist/teams/flow-team.d.ts.map +0 -1
- package/dist/teams/flow-team.js.map +0 -1
- package/dist/teams/widget-team.d.ts.map +0 -1
- package/dist/teams/widget-team.js.map +0 -1
- package/dist/testing/integration-test-suite.d.ts.map +0 -1
- package/dist/testing/integration-test-suite.js.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js.map +0 -1
- package/dist/types/servicenow.types.d.ts.map +0 -1
- package/dist/types/servicenow.types.js.map +0 -1
- package/dist/types/snow-flow.types.d.ts.map +0 -1
- package/dist/types/snow-flow.types.js.map +0 -1
- package/dist/types/todo.types.d.ts.map +0 -1
- package/dist/types/todo.types.js.map +0 -1
- package/dist/utils/action-type-cache.d.ts.map +0 -1
- package/dist/utils/action-type-cache.js.map +0 -1
- package/dist/utils/agent-detector.d.ts.map +0 -1
- package/dist/utils/agent-detector.js.map +0 -1
- package/dist/utils/artifact-tracker.d.ts.map +0 -1
- package/dist/utils/artifact-tracker.js.map +0 -1
- package/dist/utils/dependency-detector.d.ts.map +0 -1
- package/dist/utils/dependency-detector.js.map +0 -1
- package/dist/utils/deployment-metadata-handler.d.ts.map +0 -1
- package/dist/utils/deployment-metadata-handler.js.map +0 -1
- package/dist/utils/error-recovery.d.ts.map +0 -1
- package/dist/utils/error-recovery.js.map +0 -1
- package/dist/utils/flow-api-discovery.d.ts.map +0 -1
- package/dist/utils/flow-api-discovery.js.map +0 -1
- package/dist/utils/flow-xml-generator.d.ts.map +0 -1
- package/dist/utils/flow-xml-generator.js.map +0 -1
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js.map +0 -1
- package/dist/utils/mcp-auth-middleware.d.ts.map +0 -1
- package/dist/utils/mcp-auth-middleware.js.map +0 -1
- package/dist/utils/mcp-config-manager.d.ts.map +0 -1
- package/dist/utils/mcp-config-manager.js.map +0 -1
- package/dist/utils/mcp-server-manager.d.ts.map +0 -1
- package/dist/utils/mcp-server-manager.js.map +0 -1
- package/dist/utils/mcp-tool-registry.d.ts.map +0 -1
- package/dist/utils/mcp-tool-registry.js.map +0 -1
- package/dist/utils/migrate-claude-flow.d.ts.map +0 -1
- package/dist/utils/migrate-claude-flow.js.map +0 -1
- package/dist/utils/migrate-snow-flow.d.ts.map +0 -1
- package/dist/utils/migrate-snow-flow.js.map +0 -1
- package/dist/utils/oauth-html-templates.d.ts.map +0 -1
- package/dist/utils/oauth-html-templates.js.map +0 -1
- package/dist/utils/scope-utils.d.ts.map +0 -1
- package/dist/utils/scope-utils.js.map +0 -1
- package/dist/utils/servicenow-client.d.ts.map +0 -1
- package/dist/utils/servicenow-client.js.map +0 -1
- package/dist/utils/servicenow-id-generator.d.ts.map +0 -1
- package/dist/utils/servicenow-id-generator.js.map +0 -1
- package/dist/utils/snow-memory-manager.d.ts.map +0 -1
- package/dist/utils/snow-memory-manager.js.map +0 -1
- package/dist/utils/snow-oauth-old.d.ts.map +0 -1
- package/dist/utils/snow-oauth-old.js.map +0 -1
- package/dist/utils/snow-oauth.d.ts.map +0 -1
- package/dist/utils/snow-oauth.js.map +0 -1
- package/dist/utils/template-engine.d.ts.map +0 -1
- package/dist/utils/template-engine.js.map +0 -1
- package/dist/utils/theme-manager.d.ts.map +0 -1
- package/dist/utils/theme-manager.js.map +0 -1
- package/dist/utils/unified-auth-store.d.ts.map +0 -1
- package/dist/utils/unified-auth-store.js.map +0 -1
- package/dist/utils/update-set-importer.d.ts.map +0 -1
- package/dist/utils/update-set-importer.js.map +0 -1
- package/dist/utils/update-set-xml-packager.d.ts.map +0 -1
- package/dist/utils/update-set-xml-packager.js.map +0 -1
- package/dist/utils/widget-template-generator.d.ts.map +0 -1
- package/dist/utils/widget-template-generator.js.map +0 -1
- package/dist/version.d.ts.map +0 -1
- package/dist/version.js.map +0 -1
- package/memory/agents/README.md +0 -31
- package/memory/claude-flow-data.json +0 -5
- package/memory/servicenow_artifacts/000d9224c895221055906c7518aa2d3d.json +0 -30
- package/memory/servicenow_artifacts/0196b66173303010e46b4a2214f6a7a2.json +0 -36
- package/memory/servicenow_artifacts/125e5d1d837e2a102a7ea130ceaad397.json +0 -30
- package/memory/servicenow_artifacts/7637c1f2b7112210a5e5911cde11a972.json +0 -30
- package/memory/servicenow_artifacts/default_documentation_tables_1754056582292.json +0 -55
- package/memory/servicenow_artifacts/default_documentation_tables_1754057477189.json +0 -55
- package/memory/sessions/README.md +0 -32
- package/memory/update-set-sessions/01f82af583faea102a7ea130ceaad3d4.json +0 -9
- package/memory/update-set-sessions/27718fb983faea102a7ea130ceaad34b.json +0 -9
- package/memory/update-set-sessions/412e9bf6833e22502a7ea130ceaad30a.json +0 -8
- package/memory/update-set-sessions/66fc5a79837aea102a7ea130ceaad3ab.json +0 -9
- package/memory/update-set-sessions/71a30ff5837eea102a7ea130ceaad37f.json +0 -9
- package/memory/update-set-sessions/74fba27983faea102a7ea130ceaad3bd.json +0 -9
- package/memory/update-set-sessions/a0b147b5837eea102a7ea130ceaad344.json +0 -58
- package/memory/update-set-sessions/b13f5eb983baea102a7ea130ceaad33e.json +0 -9
|
@@ -0,0 +1,555 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scope Manager for ServiceNow Artifact Deployment
|
|
3
|
+
*
|
|
4
|
+
* Centralized management of deployment scopes, providing intelligent
|
|
5
|
+
* scope selection and management capabilities.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { GlobalScopeStrategy, ScopeType, ScopeConfiguration, GlobalScopeDeploymentResult } from '../strategies/global-scope-strategy.js';
|
|
9
|
+
import { ServiceNowClient } from '../utils/servicenow-client.js';
|
|
10
|
+
import { Logger } from '../utils/logger.js';
|
|
11
|
+
|
|
12
|
+
export interface ScopeManagerOptions {
|
|
13
|
+
defaultScope?: ScopeType;
|
|
14
|
+
allowFallback?: boolean;
|
|
15
|
+
validatePermissions?: boolean;
|
|
16
|
+
enableMigration?: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface ScopeDecision {
|
|
20
|
+
selectedScope: ScopeType;
|
|
21
|
+
confidence: number;
|
|
22
|
+
rationale: string;
|
|
23
|
+
fallbackScope?: ScopeType;
|
|
24
|
+
validationResult: any;
|
|
25
|
+
recommendations: string[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface DeploymentContext {
|
|
29
|
+
artifactType: string;
|
|
30
|
+
artifactData: any;
|
|
31
|
+
userPreferences?: ScopeConfiguration;
|
|
32
|
+
projectScope?: ScopeType;
|
|
33
|
+
environmentType?: 'development' | 'testing' | 'production';
|
|
34
|
+
complianceRequirements?: string[];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export class ScopeManager {
|
|
38
|
+
private strategy: GlobalScopeStrategy;
|
|
39
|
+
private client: ServiceNowClient;
|
|
40
|
+
private logger: Logger;
|
|
41
|
+
private options: ScopeManagerOptions;
|
|
42
|
+
private scopeCache: Map<string, ScopeDecision> = new Map();
|
|
43
|
+
|
|
44
|
+
constructor(options: ScopeManagerOptions = {}) {
|
|
45
|
+
this.strategy = new GlobalScopeStrategy();
|
|
46
|
+
this.client = new ServiceNowClient();
|
|
47
|
+
this.logger = new Logger('ScopeManager');
|
|
48
|
+
this.options = {
|
|
49
|
+
defaultScope: ScopeType.GLOBAL,
|
|
50
|
+
allowFallback: true,
|
|
51
|
+
validatePermissions: true,
|
|
52
|
+
enableMigration: false,
|
|
53
|
+
...options
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
this.logger.info('ScopeManager initialized', { options: this.options });
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Make intelligent scope decision based on context
|
|
61
|
+
*/
|
|
62
|
+
async makeScopeDecision(context: DeploymentContext): Promise<ScopeDecision> {
|
|
63
|
+
const cacheKey = this.generateCacheKey(context);
|
|
64
|
+
|
|
65
|
+
// Check cache first
|
|
66
|
+
if (this.scopeCache.has(cacheKey)) {
|
|
67
|
+
const cached = this.scopeCache.get(cacheKey)!;
|
|
68
|
+
this.logger.info('Using cached scope decision', { selectedScope: cached.selectedScope });
|
|
69
|
+
return cached;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
this.logger.info('Making scope decision', {
|
|
73
|
+
artifactType: context.artifactType,
|
|
74
|
+
artifactName: context.artifactData.name,
|
|
75
|
+
environmentType: context.environmentType
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
// Step 1: Analyze artifact requirements
|
|
79
|
+
const scopeConfig = await this.strategy.analyzeScopeRequirements(
|
|
80
|
+
context.artifactType,
|
|
81
|
+
context.artifactData
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
// Step 2: Apply user preferences and project scope
|
|
85
|
+
const adjustedConfig = this.applyUserPreferences(scopeConfig, context);
|
|
86
|
+
|
|
87
|
+
// Step 3: Validate permissions if enabled
|
|
88
|
+
let validationResult: any = { isValid: true, issues: [], warnings: [] };
|
|
89
|
+
if (this.options.validatePermissions) {
|
|
90
|
+
validationResult = await this.strategy.validateScopePermissions(adjustedConfig);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Step 4: Make final decision
|
|
94
|
+
const decision = this.makeFinalDecision(adjustedConfig, validationResult, context);
|
|
95
|
+
|
|
96
|
+
// Step 5: Cache the decision
|
|
97
|
+
this.scopeCache.set(cacheKey, decision);
|
|
98
|
+
|
|
99
|
+
this.logger.info('Scope decision made', {
|
|
100
|
+
selectedScope: decision.selectedScope,
|
|
101
|
+
confidence: decision.confidence,
|
|
102
|
+
rationale: decision.rationale
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
return decision;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Deploy artifact using intelligent scope management
|
|
110
|
+
*/
|
|
111
|
+
async deployWithScopeManagement(context: DeploymentContext): Promise<GlobalScopeDeploymentResult> {
|
|
112
|
+
this.logger.info('Starting scope-managed deployment', {
|
|
113
|
+
artifactType: context.artifactType,
|
|
114
|
+
artifactName: context.artifactData.name
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
// Make scope decision
|
|
118
|
+
const decision = await this.makeScopeDecision(context);
|
|
119
|
+
|
|
120
|
+
// Prepare deployment configuration
|
|
121
|
+
const deploymentConfig: ScopeConfiguration = {
|
|
122
|
+
type: decision.selectedScope,
|
|
123
|
+
fallbackToGlobal: this.options.allowFallback && decision.fallbackScope !== undefined,
|
|
124
|
+
permissions: decision.validationResult.permissions || []
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
// Add environment-specific configurations
|
|
128
|
+
if (context.environmentType === 'production') {
|
|
129
|
+
deploymentConfig.permissions?.push('production_deployment');
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Add compliance requirements
|
|
133
|
+
if (context.complianceRequirements) {
|
|
134
|
+
deploymentConfig.permissions?.push(...context.complianceRequirements);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Execute deployment
|
|
138
|
+
const result = await this.strategy.deployWithGlobalScope(
|
|
139
|
+
context.artifactType,
|
|
140
|
+
context.artifactData,
|
|
141
|
+
deploymentConfig
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
// Log deployment outcome
|
|
145
|
+
this.logger.info('Scope-managed deployment completed', {
|
|
146
|
+
success: result.success,
|
|
147
|
+
actualScope: result.scope,
|
|
148
|
+
fallbackApplied: result.fallbackApplied
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
return result;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Migrate existing artifacts to optimal scope
|
|
156
|
+
*/
|
|
157
|
+
async migrateArtifactsToOptimalScope(artifacts: any[]): Promise<any> {
|
|
158
|
+
if (!this.options.enableMigration) {
|
|
159
|
+
throw new Error('Migration is not enabled in scope manager options');
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
this.logger.info('Starting artifact migration', { count: artifacts.length });
|
|
163
|
+
|
|
164
|
+
const migrationResults = {
|
|
165
|
+
totalArtifacts: artifacts.length,
|
|
166
|
+
successful: 0,
|
|
167
|
+
failed: 0,
|
|
168
|
+
skipped: 0,
|
|
169
|
+
details: [] as any[]
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
for (const artifact of artifacts) {
|
|
173
|
+
try {
|
|
174
|
+
const context: DeploymentContext = {
|
|
175
|
+
artifactType: artifact.sys_class_name || artifact.type,
|
|
176
|
+
artifactData: artifact,
|
|
177
|
+
environmentType: 'development' // Safe default for migration
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
const decision = await this.makeScopeDecision(context);
|
|
181
|
+
|
|
182
|
+
// Only migrate if the optimal scope is different from current
|
|
183
|
+
if (this.shouldMigrateArtifact(artifact, decision)) {
|
|
184
|
+
const migrationResult = await this.migrateArtifact(artifact, decision);
|
|
185
|
+
migrationResults.details.push(migrationResult);
|
|
186
|
+
|
|
187
|
+
if (migrationResult.success) {
|
|
188
|
+
migrationResults.successful++;
|
|
189
|
+
} else {
|
|
190
|
+
migrationResults.failed++;
|
|
191
|
+
}
|
|
192
|
+
} else {
|
|
193
|
+
migrationResults.skipped++;
|
|
194
|
+
migrationResults.details.push({
|
|
195
|
+
artifactId: artifact.sys_id,
|
|
196
|
+
name: artifact.name,
|
|
197
|
+
currentScope: artifact.sys_scope,
|
|
198
|
+
recommendedScope: decision.selectedScope,
|
|
199
|
+
action: 'skipped',
|
|
200
|
+
reason: 'Already in optimal scope'
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
} catch (error) {
|
|
204
|
+
migrationResults.failed++;
|
|
205
|
+
migrationResults.details.push({
|
|
206
|
+
artifactId: artifact.sys_id,
|
|
207
|
+
name: artifact.name,
|
|
208
|
+
action: 'failed',
|
|
209
|
+
error: error instanceof Error ? error.message : String(error)
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
this.logger.info('Migration completed', {
|
|
215
|
+
successful: migrationResults.successful,
|
|
216
|
+
failed: migrationResults.failed,
|
|
217
|
+
skipped: migrationResults.skipped
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
return migrationResults;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Get scope recommendations for a project
|
|
225
|
+
*/
|
|
226
|
+
async getProjectScopeRecommendations(projectArtifacts: any[]): Promise<any> {
|
|
227
|
+
this.logger.info('Generating project scope recommendations', {
|
|
228
|
+
artifactCount: projectArtifacts.length
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
const recommendations = {
|
|
232
|
+
overallScope: ScopeType.GLOBAL,
|
|
233
|
+
confidence: 0,
|
|
234
|
+
artifactBreakdown: {
|
|
235
|
+
global: 0,
|
|
236
|
+
application: 0,
|
|
237
|
+
mixed: 0
|
|
238
|
+
},
|
|
239
|
+
recommendations: [] as string[],
|
|
240
|
+
risks: [] as string[],
|
|
241
|
+
benefits: [] as string[]
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
const decisions: ScopeDecision[] = [];
|
|
245
|
+
|
|
246
|
+
// Analyze each artifact
|
|
247
|
+
for (const artifact of projectArtifacts) {
|
|
248
|
+
const context: DeploymentContext = {
|
|
249
|
+
artifactType: artifact.sys_class_name || artifact.type,
|
|
250
|
+
artifactData: artifact
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
const decision = await this.makeScopeDecision(context);
|
|
254
|
+
decisions.push(decision);
|
|
255
|
+
|
|
256
|
+
if (decision.selectedScope === ScopeType.GLOBAL) {
|
|
257
|
+
recommendations.artifactBreakdown.global++;
|
|
258
|
+
} else if (decision.selectedScope === ScopeType.APPLICATION) {
|
|
259
|
+
recommendations.artifactBreakdown.application++;
|
|
260
|
+
} else {
|
|
261
|
+
recommendations.artifactBreakdown.mixed++;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// Calculate overall recommendation
|
|
266
|
+
const globalRatio = recommendations.artifactBreakdown.global / projectArtifacts.length;
|
|
267
|
+
const applicationRatio = recommendations.artifactBreakdown.application / projectArtifacts.length;
|
|
268
|
+
|
|
269
|
+
if (globalRatio > 0.6) {
|
|
270
|
+
recommendations.overallScope = ScopeType.GLOBAL;
|
|
271
|
+
recommendations.confidence = globalRatio;
|
|
272
|
+
recommendations.recommendations.push('Deploy entire project to global scope for consistency');
|
|
273
|
+
recommendations.benefits.push('Simplified deployment and maintenance');
|
|
274
|
+
recommendations.benefits.push('Better cross-application integration');
|
|
275
|
+
} else if (applicationRatio > 0.6) {
|
|
276
|
+
recommendations.overallScope = ScopeType.APPLICATION;
|
|
277
|
+
recommendations.confidence = applicationRatio;
|
|
278
|
+
recommendations.recommendations.push('Deploy project to dedicated application scope');
|
|
279
|
+
recommendations.benefits.push('Better isolation and security');
|
|
280
|
+
recommendations.benefits.push('Easier application lifecycle management');
|
|
281
|
+
} else {
|
|
282
|
+
recommendations.overallScope = ScopeType.AUTO;
|
|
283
|
+
recommendations.confidence = 0.5;
|
|
284
|
+
recommendations.recommendations.push('Use mixed scope strategy - deploy artifacts to optimal individual scopes');
|
|
285
|
+
recommendations.risks.push('Mixed scope may complicate maintenance');
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// Add specific recommendations
|
|
289
|
+
if (recommendations.artifactBreakdown.global > 0) {
|
|
290
|
+
recommendations.recommendations.push('Ensure global scope permissions are available');
|
|
291
|
+
}
|
|
292
|
+
if (recommendations.artifactBreakdown.application > 0) {
|
|
293
|
+
recommendations.recommendations.push('Consider creating dedicated application scope');
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
return recommendations;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Validate scope configuration
|
|
301
|
+
*/
|
|
302
|
+
async validateScopeConfiguration(config: ScopeConfiguration): Promise<any> {
|
|
303
|
+
this.logger.info('Validating scope configuration', { type: config.type });
|
|
304
|
+
|
|
305
|
+
const validation = {
|
|
306
|
+
isValid: true,
|
|
307
|
+
issues: [] as string[],
|
|
308
|
+
warnings: [] as string[],
|
|
309
|
+
recommendations: [] as string[]
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
// Validate scope type
|
|
313
|
+
if (!Object.values(ScopeType).includes(config.type)) {
|
|
314
|
+
validation.isValid = false;
|
|
315
|
+
validation.issues.push(`Invalid scope type: ${config.type}`);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// Validate application scope requirements
|
|
319
|
+
if (config.type === ScopeType.APPLICATION) {
|
|
320
|
+
if (!config.applicationId && !config.applicationName) {
|
|
321
|
+
validation.warnings.push('Application scope specified but no application ID or name provided');
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
// Validate permissions
|
|
326
|
+
if (config.permissions && config.permissions.length > 0) {
|
|
327
|
+
const permissionValidation = await this.validatePermissions(config.permissions);
|
|
328
|
+
if (!permissionValidation.isValid) {
|
|
329
|
+
validation.isValid = false;
|
|
330
|
+
validation.issues.push(...permissionValidation.issues);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
// Validate global domain
|
|
335
|
+
if (config.type === ScopeType.GLOBAL && config.globalDomain !== 'global') {
|
|
336
|
+
validation.warnings.push('Global scope should use "global" domain');
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
return validation;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Clear scope cache
|
|
344
|
+
*/
|
|
345
|
+
clearScopeCache(): void {
|
|
346
|
+
this.scopeCache.clear();
|
|
347
|
+
this.logger.info('Scope cache cleared');
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Get scope statistics
|
|
352
|
+
*/
|
|
353
|
+
getScopeStatistics(): any {
|
|
354
|
+
const stats = {
|
|
355
|
+
cacheSize: this.scopeCache.size,
|
|
356
|
+
scopeDistribution: {
|
|
357
|
+
global: 0,
|
|
358
|
+
application: 0,
|
|
359
|
+
auto: 0
|
|
360
|
+
},
|
|
361
|
+
averageConfidence: 0
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
let totalConfidence = 0;
|
|
365
|
+
for (const decision of this.scopeCache.values()) {
|
|
366
|
+
totalConfidence += decision.confidence;
|
|
367
|
+
|
|
368
|
+
if (decision.selectedScope === ScopeType.GLOBAL) {
|
|
369
|
+
stats.scopeDistribution.global++;
|
|
370
|
+
} else if (decision.selectedScope === ScopeType.APPLICATION) {
|
|
371
|
+
stats.scopeDistribution.application++;
|
|
372
|
+
} else {
|
|
373
|
+
stats.scopeDistribution.auto++;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
stats.averageConfidence = this.scopeCache.size > 0 ? totalConfidence / this.scopeCache.size : 0;
|
|
378
|
+
|
|
379
|
+
return stats;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Private helper methods
|
|
384
|
+
*/
|
|
385
|
+
|
|
386
|
+
private generateCacheKey(context: DeploymentContext): string {
|
|
387
|
+
return `${context.artifactType}:${context.artifactData.name}:${context.environmentType || 'default'}`;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
private applyUserPreferences(config: ScopeConfiguration, context: DeploymentContext): ScopeConfiguration {
|
|
391
|
+
if (!context.userPreferences) {
|
|
392
|
+
return config;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
// Override with user preferences
|
|
396
|
+
return {
|
|
397
|
+
...config,
|
|
398
|
+
...context.userPreferences
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
private makeFinalDecision(
|
|
403
|
+
config: ScopeConfiguration,
|
|
404
|
+
validation: any,
|
|
405
|
+
context: DeploymentContext
|
|
406
|
+
): ScopeDecision {
|
|
407
|
+
let selectedScope = config.type;
|
|
408
|
+
let confidence = 0.8;
|
|
409
|
+
let rationale = 'Based on artifact _analysis';
|
|
410
|
+
let fallbackScope: ScopeType | undefined;
|
|
411
|
+
|
|
412
|
+
// Apply validation results
|
|
413
|
+
if (!validation.isValid) {
|
|
414
|
+
if (validation.canCreateGlobal && config.type === ScopeType.APPLICATION) {
|
|
415
|
+
selectedScope = ScopeType.GLOBAL;
|
|
416
|
+
fallbackScope = ScopeType.APPLICATION;
|
|
417
|
+
confidence = 0.6;
|
|
418
|
+
rationale = 'Fallback to global scope due to permission issues';
|
|
419
|
+
} else if (validation.canCreateScoped && config.type === ScopeType.GLOBAL) {
|
|
420
|
+
selectedScope = ScopeType.APPLICATION;
|
|
421
|
+
fallbackScope = ScopeType.GLOBAL;
|
|
422
|
+
confidence = 0.6;
|
|
423
|
+
rationale = 'Fallback to application scope due to permission issues';
|
|
424
|
+
} else {
|
|
425
|
+
confidence = 0.3;
|
|
426
|
+
rationale = 'Limited options due to permission constraints';
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
// Apply environment-specific rules
|
|
431
|
+
if (context.environmentType === 'production') {
|
|
432
|
+
// Production deployments prefer global scope for stability
|
|
433
|
+
if (selectedScope === ScopeType.APPLICATION && validation.canCreateGlobal) {
|
|
434
|
+
selectedScope = ScopeType.GLOBAL;
|
|
435
|
+
confidence = Math.max(confidence, 0.7);
|
|
436
|
+
rationale += ' (production environment preference)';
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
// Apply project scope preferences
|
|
441
|
+
if (context.projectScope) {
|
|
442
|
+
if (context.projectScope === ScopeType.GLOBAL && validation.canCreateGlobal) {
|
|
443
|
+
selectedScope = ScopeType.GLOBAL;
|
|
444
|
+
confidence = Math.max(confidence, 0.8);
|
|
445
|
+
rationale += ' (project scope preference)';
|
|
446
|
+
} else if (context.projectScope === ScopeType.APPLICATION && validation.canCreateScoped) {
|
|
447
|
+
selectedScope = ScopeType.APPLICATION;
|
|
448
|
+
confidence = Math.max(confidence, 0.8);
|
|
449
|
+
rationale += ' (project scope preference)';
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
const recommendations: string[] = [];
|
|
454
|
+
|
|
455
|
+
// Generate recommendations
|
|
456
|
+
if (confidence < 0.5) {
|
|
457
|
+
recommendations.push('Consider reviewing permissions or scope configuration');
|
|
458
|
+
}
|
|
459
|
+
if (fallbackScope) {
|
|
460
|
+
recommendations.push(`Consider ${fallbackScope} scope as alternative`);
|
|
461
|
+
}
|
|
462
|
+
if (validation.warnings && validation.warnings.length > 0) {
|
|
463
|
+
recommendations.push(...validation.warnings);
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
return {
|
|
467
|
+
selectedScope,
|
|
468
|
+
confidence,
|
|
469
|
+
rationale,
|
|
470
|
+
fallbackScope,
|
|
471
|
+
validationResult: validation,
|
|
472
|
+
recommendations
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
private shouldMigrateArtifact(artifact: any, decision: ScopeDecision): boolean {
|
|
477
|
+
const currentScope = artifact.sys_scope;
|
|
478
|
+
const recommendedScope = decision.selectedScope;
|
|
479
|
+
|
|
480
|
+
// Don't migrate if confidence is too low
|
|
481
|
+
if (decision.confidence < 0.7) {
|
|
482
|
+
return false;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
// Don't migrate if already in optimal scope
|
|
486
|
+
if (currentScope === 'global' && recommendedScope === ScopeType.GLOBAL) {
|
|
487
|
+
return false;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
if (currentScope !== 'global' && recommendedScope === ScopeType.APPLICATION) {
|
|
491
|
+
return false;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
return true;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
private async migrateArtifact(artifact: any, decision: ScopeDecision): Promise<any> {
|
|
498
|
+
// This is a simplified migration - in practice, this would involve
|
|
499
|
+
// complex operations like dependency checking, data migration, etc.
|
|
500
|
+
|
|
501
|
+
const migrationResult = {
|
|
502
|
+
artifactId: artifact.sys_id,
|
|
503
|
+
name: artifact.name,
|
|
504
|
+
currentScope: artifact.sys_scope,
|
|
505
|
+
targetScope: decision.selectedScope,
|
|
506
|
+
success: false,
|
|
507
|
+
action: 'migrate',
|
|
508
|
+
details: {}
|
|
509
|
+
};
|
|
510
|
+
|
|
511
|
+
try {
|
|
512
|
+
// Create new artifact in target scope
|
|
513
|
+
const newArtifactData = {
|
|
514
|
+
...artifact,
|
|
515
|
+
sys_scope: decision.selectedScope === ScopeType.GLOBAL ? 'global' : decision.selectedScope,
|
|
516
|
+
name: `${artifact.name}_migrated`
|
|
517
|
+
// 🔧 TEST-001 FIX: Remove sys_id property instead of setting to undefined
|
|
518
|
+
// This prevents "sys_id undefined" errors in testing tools
|
|
519
|
+
};
|
|
520
|
+
|
|
521
|
+
// 🔧 TEST-001 FIX: Explicitly delete sys_id so ServiceNow generates a new one
|
|
522
|
+
delete newArtifactData.sys_id;
|
|
523
|
+
|
|
524
|
+
const deploymentResult = await this.strategy.deployWithGlobalScope(
|
|
525
|
+
artifact.sys_class_name || artifact.type,
|
|
526
|
+
newArtifactData,
|
|
527
|
+
{ type: decision.selectedScope }
|
|
528
|
+
);
|
|
529
|
+
|
|
530
|
+
migrationResult.success = deploymentResult.success;
|
|
531
|
+
migrationResult.details = deploymentResult;
|
|
532
|
+
|
|
533
|
+
// In a real implementation, you would also:
|
|
534
|
+
// 1. Update references to the old artifact
|
|
535
|
+
// 2. Deactivate or delete the old artifact
|
|
536
|
+
// 3. Verify the migration worked correctly
|
|
537
|
+
|
|
538
|
+
} catch (error) {
|
|
539
|
+
migrationResult.success = false;
|
|
540
|
+
migrationResult.details = { error: error instanceof Error ? error.message : String(error) };
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
return migrationResult;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
private async validatePermissions(permissions: string[]): Promise<any> {
|
|
547
|
+
// Simplified permission validation
|
|
548
|
+
// In practice, this would check actual ServiceNow permissions
|
|
549
|
+
return {
|
|
550
|
+
isValid: true,
|
|
551
|
+
issues: [],
|
|
552
|
+
warnings: []
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
}
|