atabey 0.0.12 → 0.0.14
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/ATABEY.md +45 -499
- package/PRIVACY.md +161 -0
- package/README.md +553 -88
- package/bin/validate-al-registry.js +4 -4
- package/dist/framework-mcp/src/index.js +914 -62
- package/dist/framework-mcp/src/index.js.map +1 -1
- package/dist/framework-mcp/src/tools/compliance/mask_pii.d.ts +17 -0
- package/dist/framework-mcp/src/tools/compliance/mask_pii.js +56 -0
- package/dist/framework-mcp/src/tools/compliance/mask_pii.js.map +1 -0
- package/dist/framework-mcp/src/tools/definitions.js +24 -1
- package/dist/framework-mcp/src/tools/definitions.js.map +1 -1
- package/dist/framework-mcp/src/tools/framework/run_tests.js +25 -0
- package/dist/framework-mcp/src/tools/framework/run_tests.js.map +1 -1
- package/dist/framework-mcp/src/tools/gateway/llm_gateway_query.d.ts +19 -0
- package/dist/framework-mcp/src/tools/gateway/llm_gateway_query.js +138 -0
- package/dist/framework-mcp/src/tools/gateway/llm_gateway_query.js.map +1 -0
- package/dist/framework-mcp/src/tools/gateway/llm_gateway_status.d.ts +8 -0
- package/dist/framework-mcp/src/tools/gateway/llm_gateway_status.js +91 -0
- package/dist/framework-mcp/src/tools/gateway/llm_gateway_status.js.map +1 -0
- package/dist/framework-mcp/src/tools/index.d.ts +1 -1
- package/dist/framework-mcp/src/tools/index.js +34 -20
- package/dist/framework-mcp/src/tools/index.js.map +1 -1
- package/dist/framework-mcp/src/tools/messaging/approve_operation.d.ts +22 -0
- package/dist/framework-mcp/src/tools/messaging/approve_operation.js +81 -0
- package/dist/framework-mcp/src/tools/messaging/approve_operation.js.map +1 -0
- package/dist/framework-mcp/src/tools/messaging/ask_human.d.ts +15 -0
- package/dist/framework-mcp/src/tools/messaging/ask_human.js +89 -20
- package/dist/framework-mcp/src/tools/messaging/ask_human.js.map +1 -1
- package/dist/framework-mcp/src/tools/observability/check_ports.js +3 -1
- package/dist/framework-mcp/src/tools/observability/check_ports.js.map +1 -1
- package/dist/framework-mcp/src/tools/quality/analyze_code_quality.d.ts +11 -0
- package/dist/framework-mcp/src/tools/quality/analyze_code_quality.js +115 -0
- package/dist/framework-mcp/src/tools/quality/analyze_code_quality.js.map +1 -0
- package/dist/framework-mcp/src/tools/quality/check_architecture_compliance.d.ts +11 -0
- package/dist/framework-mcp/src/tools/quality/check_architecture_compliance.js +135 -0
- package/dist/framework-mcp/src/tools/quality/check_architecture_compliance.js.map +1 -0
- package/dist/framework-mcp/src/tools/schemas.d.ts +90 -15
- package/dist/framework-mcp/src/tools/schemas.js +32 -7
- package/dist/framework-mcp/src/tools/schemas.js.map +1 -1
- package/dist/framework-mcp/src/tools/shell/run_command.js +12 -2
- package/dist/framework-mcp/src/tools/shell/run_command.js.map +1 -1
- package/dist/framework-mcp/src/tools/types.d.ts +11 -105
- package/dist/framework-mcp/src/tools/types.js +1 -0
- package/dist/framework-mcp/src/tools/types.js.map +1 -1
- package/dist/framework-mcp/src/utils/auth.d.ts +36 -0
- package/dist/framework-mcp/src/utils/auth.js +79 -0
- package/dist/framework-mcp/src/utils/auth.js.map +1 -0
- package/dist/framework-mcp/src/utils/auto-rollback.d.ts +71 -0
- package/dist/framework-mcp/src/utils/auto-rollback.js +266 -0
- package/dist/framework-mcp/src/utils/auto-rollback.js.map +1 -0
- package/dist/framework-mcp/src/utils/compliance.js +12 -4
- package/dist/framework-mcp/src/utils/compliance.js.map +1 -1
- package/dist/framework-mcp/src/utils/context-optimizer.d.ts +69 -0
- package/dist/framework-mcp/src/utils/context-optimizer.js +157 -0
- package/dist/framework-mcp/src/utils/context-optimizer.js.map +1 -0
- package/dist/framework-mcp/src/utils/discipline.d.ts +68 -0
- package/dist/framework-mcp/src/utils/discipline.js +218 -0
- package/dist/framework-mcp/src/utils/discipline.js.map +1 -0
- package/dist/framework-mcp/src/utils/finops.d.ts +143 -0
- package/dist/framework-mcp/src/utils/finops.js +326 -0
- package/dist/framework-mcp/src/utils/finops.js.map +1 -0
- package/dist/framework-mcp/src/utils/human-in-loop.d.ts +95 -0
- package/dist/framework-mcp/src/utils/human-in-loop.js +216 -0
- package/dist/framework-mcp/src/utils/human-in-loop.js.map +1 -0
- package/dist/framework-mcp/src/utils/license-scanner.d.ts +71 -0
- package/dist/framework-mcp/src/utils/license-scanner.js +284 -0
- package/dist/framework-mcp/src/utils/license-scanner.js.map +1 -0
- package/dist/framework-mcp/src/utils/loop-detector.d.ts +105 -0
- package/dist/framework-mcp/src/utils/loop-detector.js +362 -0
- package/dist/framework-mcp/src/utils/loop-detector.js.map +1 -0
- package/dist/framework-mcp/src/utils/quality.d.ts +19 -0
- package/dist/framework-mcp/src/utils/quality.js +124 -0
- package/dist/framework-mcp/src/utils/quality.js.map +1 -0
- package/dist/framework-mcp/src/utils/rules-engine.d.ts +78 -0
- package/dist/framework-mcp/src/utils/rules-engine.js +232 -0
- package/dist/framework-mcp/src/utils/rules-engine.js.map +1 -0
- package/dist/framework-mcp/src/utils/silent-router.d.ts +47 -0
- package/dist/framework-mcp/src/utils/silent-router.js +129 -0
- package/dist/framework-mcp/src/utils/silent-router.js.map +1 -0
- package/dist/framework-mcp/src/utils/storage.d.ts +1 -0
- package/dist/framework-mcp/src/utils/storage.js +2 -2
- package/dist/framework-mcp/src/utils/storage.js.map +1 -1
- package/dist/framework-mcp/src/utils/telemetry-streamer.d.ts +133 -0
- package/dist/framework-mcp/src/utils/telemetry-streamer.js +397 -0
- package/dist/framework-mcp/src/utils/telemetry-streamer.js.map +1 -0
- package/dist/framework-mcp/tests/tools/file_system/file_system_tools.test.js +2 -2
- package/dist/framework-mcp/tests/tools/file_system/file_system_tools.test.js.map +1 -1
- package/dist/framework-mcp/tests/tools/framework/run_tests.test.d.ts +1 -0
- package/dist/framework-mcp/tests/tools/framework/run_tests.test.js +49 -0
- package/dist/framework-mcp/tests/tools/framework/run_tests.test.js.map +1 -0
- package/dist/framework-mcp/tests/tools/messaging/send_message.test.js +14 -5
- package/dist/framework-mcp/tests/tools/messaging/send_message.test.js.map +1 -1
- package/dist/framework-mcp/tests/tools/observability/check_ports.test.d.ts +1 -0
- package/dist/framework-mcp/tests/tools/observability/check_ports.test.js +30 -0
- package/dist/framework-mcp/tests/tools/observability/check_ports.test.js.map +1 -0
- package/dist/framework-mcp/tests/tools/shell/run_command.test.js +7 -0
- package/dist/framework-mcp/tests/tools/shell/run_command.test.js.map +1 -1
- package/dist/framework-mcp/tests/utils/auto-rollback.test.d.ts +7 -0
- package/dist/framework-mcp/tests/utils/auto-rollback.test.js +178 -0
- package/dist/framework-mcp/tests/utils/auto-rollback.test.js.map +1 -0
- package/dist/framework-mcp/tests/utils/context-optimizer.test.d.ts +1 -0
- package/dist/framework-mcp/tests/utils/context-optimizer.test.js +62 -0
- package/dist/framework-mcp/tests/utils/context-optimizer.test.js.map +1 -0
- package/dist/framework-mcp/tests/utils/finops.test.d.ts +7 -0
- package/dist/framework-mcp/tests/utils/finops.test.js +157 -0
- package/dist/framework-mcp/tests/utils/finops.test.js.map +1 -0
- package/dist/framework-mcp/tests/utils/human-in-loop.test.d.ts +1 -0
- package/dist/framework-mcp/tests/utils/human-in-loop.test.js +59 -0
- package/dist/framework-mcp/tests/utils/human-in-loop.test.js.map +1 -0
- package/dist/framework-mcp/tests/utils/license-scanner.test.d.ts +7 -0
- package/dist/framework-mcp/tests/utils/license-scanner.test.js +131 -0
- package/dist/framework-mcp/tests/utils/license-scanner.test.js.map +1 -0
- package/dist/framework-mcp/tests/utils/loop-detector.test.d.ts +7 -0
- package/dist/framework-mcp/tests/utils/loop-detector.test.js +204 -0
- package/dist/framework-mcp/tests/utils/loop-detector.test.js.map +1 -0
- package/dist/framework-mcp/tests/utils/rules-engine.test.d.ts +1 -0
- package/dist/framework-mcp/tests/utils/rules-engine.test.js +106 -0
- package/dist/framework-mcp/tests/utils/rules-engine.test.js.map +1 -0
- package/dist/framework-mcp/tests/utils/telemetry-streamer.test.d.ts +7 -0
- package/dist/framework-mcp/tests/utils/telemetry-streamer.test.js +201 -0
- package/dist/framework-mcp/tests/utils/telemetry-streamer.test.js.map +1 -0
- package/dist/src/cli/commands/check.js +18 -3
- package/dist/src/cli/commands/check.js.map +1 -1
- package/dist/src/cli/commands/dashboard.d.ts +1 -1
- package/dist/src/cli/commands/dashboard.js +343 -96
- package/dist/src/cli/commands/dashboard.js.map +1 -1
- package/dist/src/cli/commands/gateway.d.ts +1 -0
- package/dist/src/cli/commands/gateway.js +172 -0
- package/dist/src/cli/commands/gateway.js.map +1 -0
- package/dist/src/cli/commands/init/create-agent.js +3 -3
- package/dist/src/cli/commands/init/create-agent.js.map +1 -1
- package/dist/src/cli/commands/init/scaffold-core.d.ts +3 -1
- package/dist/src/cli/commands/init/scaffold-core.js +17 -2
- package/dist/src/cli/commands/init/scaffold-core.js.map +1 -1
- package/dist/src/cli/commands/init/scaffold-ops.js +2 -2
- package/dist/src/cli/commands/init/scaffold-ops.js.map +1 -1
- package/dist/src/cli/commands/init/scaffold-standards.js +13 -1
- package/dist/src/cli/commands/init/scaffold-standards.js.map +1 -1
- package/dist/src/cli/commands/init.d.ts +6 -0
- package/dist/src/cli/commands/init.js +163 -25
- package/dist/src/cli/commands/init.js.map +1 -1
- package/dist/src/cli/commands/mcp.d.ts +7 -0
- package/dist/src/cli/commands/mcp.js +45 -22
- package/dist/src/cli/commands/mcp.js.map +1 -1
- package/dist/src/cli/commands/orchestrate.d.ts +8 -7
- package/dist/src/cli/commands/orchestrate.js +2 -1
- package/dist/src/cli/commands/orchestrate.js.map +1 -1
- package/dist/src/cli/commands/quickstart.d.ts +5 -5
- package/dist/src/cli/commands/quickstart.js +30 -42
- package/dist/src/cli/commands/quickstart.js.map +1 -1
- package/dist/src/cli/index.js +228 -317
- package/dist/src/cli/index.js.map +1 -1
- package/dist/src/cli/platforms/core.d.ts +12 -0
- package/dist/src/cli/platforms/core.js +73 -0
- package/dist/src/cli/platforms/core.js.map +1 -0
- package/dist/src/cli/platforms/index.d.ts +5 -0
- package/dist/src/cli/platforms/index.js +6 -0
- package/dist/src/cli/platforms/index.js.map +1 -0
- package/dist/src/cli/platforms/paths.d.ts +15 -0
- package/dist/src/cli/platforms/paths.js +102 -0
- package/dist/src/cli/platforms/paths.js.map +1 -0
- package/dist/src/cli/platforms/scaffold.d.ts +2 -0
- package/dist/src/cli/platforms/scaffold.js +73 -0
- package/dist/src/cli/platforms/scaffold.js.map +1 -0
- package/dist/src/cli/platforms/utils.d.ts +4 -0
- package/dist/src/cli/platforms/utils.js +76 -0
- package/dist/src/cli/platforms/utils.js.map +1 -0
- package/dist/src/cli/shims.js +11 -11
- package/dist/src/cli/utils/fs.d.ts +1 -1
- package/dist/src/cli/utils/fs.js +1 -1
- package/dist/src/cli/utils/fs.js.map +1 -1
- package/dist/src/cli/utils/pkg.js +2 -3
- package/dist/src/cli/utils/pkg.js.map +1 -1
- package/dist/src/cli/utils/quality.d.ts +10 -0
- package/dist/src/cli/utils/quality.js +10 -0
- package/dist/src/cli/utils/quality.js.map +1 -0
- package/dist/src/modules/agents/definitions.d.ts +2 -2
- package/dist/src/modules/agents/definitions.js +104 -63
- package/dist/src/modules/agents/definitions.js.map +1 -1
- package/dist/src/modules/agents/registry/manager.js +6 -1
- package/dist/src/modules/agents/registry/manager.js.map +1 -1
- package/dist/src/modules/contracts/api.d.ts +178 -0
- package/dist/src/modules/contracts/api.js +56 -0
- package/dist/src/modules/contracts/api.js.map +1 -0
- package/dist/src/modules/contracts/index.d.ts +5 -0
- package/dist/src/modules/contracts/index.js +6 -0
- package/dist/src/modules/contracts/index.js.map +1 -0
- package/dist/src/modules/engines/agent-executor.d.ts +25 -30
- package/dist/src/modules/engines/agent-executor.js +133 -73
- package/dist/src/modules/engines/agent-executor.js.map +1 -1
- package/dist/src/modules/engines/agent-loop.d.ts +34 -0
- package/dist/src/modules/engines/agent-loop.js +102 -0
- package/dist/src/modules/engines/agent-loop.js.map +1 -0
- package/dist/src/modules/engines/evaluation-engine.js +2 -2
- package/dist/src/modules/engines/evaluation-engine.js.map +1 -1
- package/dist/src/modules/engines/quality-gate.d.ts +16 -8
- package/dist/src/modules/engines/quality-gate.js +42 -34
- package/dist/src/modules/engines/quality-gate.js.map +1 -1
- package/dist/src/modules/engines/routing-engine.d.ts +21 -28
- package/dist/src/modules/engines/routing-engine.js +83 -50
- package/dist/src/modules/engines/routing-engine.js.map +1 -1
- package/dist/src/modules/gateway/circuit-breaker.d.ts +40 -0
- package/dist/src/modules/gateway/circuit-breaker.js +163 -0
- package/dist/src/modules/gateway/circuit-breaker.js.map +1 -0
- package/dist/src/modules/gateway/cost-tracker.d.ts +60 -0
- package/dist/src/modules/gateway/cost-tracker.js +198 -0
- package/dist/src/modules/gateway/cost-tracker.js.map +1 -0
- package/dist/src/modules/gateway/gateway.d.ts +72 -0
- package/dist/src/modules/gateway/gateway.js +243 -0
- package/dist/src/modules/gateway/gateway.js.map +1 -0
- package/dist/src/modules/gateway/index.d.ts +19 -0
- package/dist/src/modules/gateway/index.js +19 -0
- package/dist/src/modules/gateway/index.js.map +1 -0
- package/dist/src/modules/gateway/load-balancer.d.ts +86 -0
- package/dist/src/modules/gateway/load-balancer.js +230 -0
- package/dist/src/modules/gateway/load-balancer.js.map +1 -0
- package/dist/src/modules/gateway/providers/anthropic.d.ts +14 -0
- package/dist/src/modules/gateway/providers/anthropic.js +169 -0
- package/dist/src/modules/gateway/providers/anthropic.js.map +1 -0
- package/dist/src/modules/gateway/providers/base.d.ts +38 -0
- package/dist/src/modules/gateway/providers/base.js +42 -0
- package/dist/src/modules/gateway/providers/base.js.map +1 -0
- package/dist/src/modules/gateway/providers/google.d.ts +18 -0
- package/dist/src/modules/gateway/providers/google.js +176 -0
- package/dist/src/modules/gateway/providers/google.js.map +1 -0
- package/dist/src/modules/gateway/providers/grok.d.ts +14 -0
- package/dist/src/modules/gateway/providers/grok.js +166 -0
- package/dist/src/modules/gateway/providers/grok.js.map +1 -0
- package/dist/src/modules/gateway/providers/index.d.ts +21 -0
- package/dist/src/modules/gateway/providers/index.js +38 -0
- package/dist/src/modules/gateway/providers/index.js.map +1 -0
- package/dist/src/modules/gateway/providers/ollama.d.ts +23 -0
- package/dist/src/modules/gateway/providers/ollama.js +187 -0
- package/dist/src/modules/gateway/providers/ollama.js.map +1 -0
- package/dist/src/modules/gateway/providers/openai.d.ts +14 -0
- package/dist/src/modules/gateway/providers/openai.js +170 -0
- package/dist/src/modules/gateway/providers/openai.js.map +1 -0
- package/dist/src/modules/gateway/rate-limiter.d.ts +41 -0
- package/dist/src/modules/gateway/rate-limiter.js +119 -0
- package/dist/src/modules/gateway/rate-limiter.js.map +1 -0
- package/dist/src/modules/gateway/types.d.ts +114 -0
- package/dist/src/modules/gateway/types.js +8 -0
- package/dist/src/modules/gateway/types.js.map +1 -0
- package/dist/src/modules/memory/core.d.ts +4 -12
- package/dist/src/modules/memory/core.js +10 -17
- package/dist/src/modules/memory/core.js.map +1 -1
- package/dist/src/modules/memory/embedding.d.ts +28 -0
- package/dist/src/modules/memory/embedding.js +131 -0
- package/dist/src/modules/memory/embedding.js.map +1 -0
- package/dist/src/modules/providers/definitions.d.ts +9 -0
- package/dist/src/modules/providers/definitions.js +141 -0
- package/dist/src/modules/providers/definitions.js.map +1 -0
- package/dist/src/modules/providers/registry.d.ts +12 -0
- package/dist/src/modules/providers/registry.js +19 -0
- package/dist/src/modules/providers/registry.js.map +1 -0
- package/dist/src/modules/providers/shared.d.ts +1 -0
- package/dist/src/modules/providers/shared.js +105 -0
- package/dist/src/modules/providers/shared.js.map +1 -0
- package/dist/src/modules/providers/types.d.ts +14 -0
- package/dist/src/modules/providers/types.js +2 -0
- package/dist/src/modules/providers/types.js.map +1 -0
- package/dist/src/modules/skills/adapter-skills.d.ts +68 -0
- package/dist/src/modules/skills/adapter-skills.js +450 -0
- package/dist/src/modules/skills/adapter-skills.js.map +1 -0
- package/dist/src/shared/audit.d.ts +105 -0
- package/dist/src/shared/audit.js +221 -0
- package/dist/src/shared/audit.js.map +1 -0
- package/dist/src/shared/fs.js +4 -2
- package/dist/src/shared/fs.js.map +1 -1
- package/dist/src/shared/lock.d.ts +82 -0
- package/dist/src/shared/lock.js +160 -0
- package/dist/src/shared/lock.js.map +1 -0
- package/dist/src/shared/logger.d.ts +2 -0
- package/dist/src/shared/logger.js +15 -5
- package/dist/src/shared/logger.js.map +1 -1
- package/dist/src/shared/pii.d.ts +69 -0
- package/dist/src/shared/pii.js +213 -0
- package/dist/src/shared/pii.js.map +1 -0
- package/dist/src/shared/retention.d.ts +63 -0
- package/dist/src/shared/retention.js +171 -0
- package/dist/src/shared/retention.js.map +1 -0
- package/dist/src/shared/storage.d.ts +22 -1
- package/dist/src/shared/storage.js +49 -7
- package/dist/src/shared/storage.js.map +1 -1
- package/dist/tests/adapter.test.js +1 -1
- package/dist/tests/adapter.test.js.map +1 -1
- package/dist/tests/adapters/paths.test.js +4 -4
- package/dist/tests/adapters/paths.test.js.map +1 -1
- package/dist/tests/cli/commands/dashboard-coverage.test.d.ts +1 -0
- package/dist/tests/cli/commands/dashboard-coverage.test.js +88 -0
- package/dist/tests/cli/commands/dashboard-coverage.test.js.map +1 -0
- package/dist/tests/cli/init/adapter_init.test.js +4 -5
- package/dist/tests/cli/init/adapter_init.test.js.map +1 -1
- package/dist/tests/cli/init/unified_init.test.js +5 -7
- package/dist/tests/cli/init/unified_init.test.js.map +1 -1
- package/dist/tests/embedding.test.d.ts +1 -0
- package/dist/tests/embedding.test.js +82 -0
- package/dist/tests/embedding.test.js.map +1 -0
- package/dist/tests/engines/evaluation-engine.test.d.ts +1 -0
- package/dist/tests/engines/evaluation-engine.test.js +71 -0
- package/dist/tests/engines/evaluation-engine.test.js.map +1 -0
- package/dist/tests/engines/planning-engine.test.d.ts +1 -0
- package/dist/tests/engines/planning-engine.test.js +100 -0
- package/dist/tests/engines/planning-engine.test.js.map +1 -0
- package/dist/tests/engines/quality-gate.test.d.ts +1 -0
- package/dist/tests/engines/quality-gate.test.js +59 -0
- package/dist/tests/engines/quality-gate.test.js.map +1 -0
- package/dist/tests/engines/risk-engine.test.d.ts +1 -0
- package/dist/tests/engines/risk-engine.test.js +80 -0
- package/dist/tests/engines/risk-engine.test.js.map +1 -0
- package/dist/tests/engines/routing-engine.test.d.ts +1 -0
- package/dist/tests/engines/routing-engine.test.js +78 -0
- package/dist/tests/engines/routing-engine.test.js.map +1 -0
- package/dist/tests/integration/agent_flow.test.js +14 -8
- package/dist/tests/integration/agent_flow.test.js.map +1 -1
- package/dist/tests/integration/hermes_locking.test.js +1 -0
- package/dist/tests/integration/hermes_locking.test.js.map +1 -1
- package/dist/tests/modules/adapters/adapters.test.js +2 -2
- package/dist/tests/modules/adapters/adapters.test.js.map +1 -1
- package/dist/tests/modules/contracts/contracts.test.d.ts +1 -0
- package/dist/tests/modules/contracts/contracts.test.js +73 -0
- package/dist/tests/modules/contracts/contracts.test.js.map +1 -0
- package/dist/tests/modules/engines/agent-executor.test.js +30 -23
- package/dist/tests/modules/engines/agent-executor.test.js.map +1 -1
- package/dist/tests/modules/gateway/circuit-breaker.test.d.ts +1 -0
- package/dist/tests/modules/gateway/circuit-breaker.test.js +124 -0
- package/dist/tests/modules/gateway/circuit-breaker.test.js.map +1 -0
- package/dist/tests/modules/gateway/cost-tracker.test.d.ts +1 -0
- package/dist/tests/modules/gateway/cost-tracker.test.js +93 -0
- package/dist/tests/modules/gateway/cost-tracker.test.js.map +1 -0
- package/dist/tests/modules/gateway/load-balancer.test.d.ts +1 -0
- package/dist/tests/modules/gateway/load-balancer.test.js +70 -0
- package/dist/tests/modules/gateway/load-balancer.test.js.map +1 -0
- package/dist/tests/modules/gateway/rate-limiter.test.d.ts +1 -0
- package/dist/tests/modules/gateway/rate-limiter.test.js +62 -0
- package/dist/tests/modules/gateway/rate-limiter.test.js.map +1 -0
- package/dist/tests/orchestrator-dependencies.test.js +23 -6
- package/dist/tests/orchestrator-dependencies.test.js.map +1 -1
- package/dist/tests/shared/audit.test.d.ts +1 -0
- package/dist/tests/shared/audit.test.js +53 -0
- package/dist/tests/shared/audit.test.js.map +1 -0
- package/dist/tests/shared/lock.test.d.ts +1 -0
- package/dist/tests/shared/lock.test.js +95 -0
- package/dist/tests/shared/lock.test.js.map +1 -0
- package/dist/tests/shared/pii.test.d.ts +1 -0
- package/dist/tests/shared/pii.test.js +183 -0
- package/dist/tests/shared/pii.test.js.map +1 -0
- package/dist/tests/storage-operations.test.d.ts +1 -0
- package/dist/tests/storage-operations.test.js +116 -0
- package/dist/tests/storage-operations.test.js.map +1 -0
- package/framework-mcp/README.md +596 -77
- package/framework-mcp/dist/dashboard/assets/index-B2mYld0c.js +1221 -0
- package/framework-mcp/dist/dashboard/index.html +15 -0
- package/framework-mcp/dist/framework-mcp/src/index.js +914 -62
- package/framework-mcp/dist/framework-mcp/src/tools/compliance/mask_pii.js +55 -0
- package/framework-mcp/dist/framework-mcp/src/tools/definitions.js +24 -1
- package/framework-mcp/dist/framework-mcp/src/tools/framework/run_tests.js +25 -0
- package/framework-mcp/dist/framework-mcp/src/tools/gateway/llm_gateway_query.js +137 -0
- package/framework-mcp/dist/framework-mcp/src/tools/gateway/llm_gateway_status.js +90 -0
- package/framework-mcp/dist/framework-mcp/src/tools/index.js +34 -20
- package/framework-mcp/dist/framework-mcp/src/tools/messaging/approve_operation.js +80 -0
- package/framework-mcp/dist/framework-mcp/src/tools/messaging/ask_human.js +89 -20
- package/framework-mcp/dist/framework-mcp/src/tools/observability/check_ports.js +3 -1
- package/framework-mcp/dist/framework-mcp/src/tools/quality/analyze_code_quality.js +114 -0
- package/framework-mcp/dist/framework-mcp/src/tools/quality/check_architecture_compliance.js +134 -0
- package/framework-mcp/dist/framework-mcp/src/tools/schemas.js +32 -7
- package/framework-mcp/dist/framework-mcp/src/tools/shell/run_command.js +12 -2
- package/framework-mcp/dist/framework-mcp/src/tools/types.js +1 -0
- package/framework-mcp/dist/framework-mcp/src/utils/auth.js +78 -0
- package/framework-mcp/dist/framework-mcp/src/utils/auto-rollback.js +265 -0
- package/framework-mcp/dist/framework-mcp/src/utils/compliance.js +12 -4
- package/framework-mcp/dist/framework-mcp/src/utils/context-optimizer.js +156 -0
- package/framework-mcp/dist/framework-mcp/src/utils/discipline.js +217 -0
- package/framework-mcp/dist/framework-mcp/src/utils/finops.js +325 -0
- package/framework-mcp/dist/framework-mcp/src/utils/human-in-loop.js +215 -0
- package/framework-mcp/dist/framework-mcp/src/utils/license-scanner.js +283 -0
- package/framework-mcp/dist/framework-mcp/src/utils/loop-detector.js +361 -0
- package/framework-mcp/dist/framework-mcp/src/utils/quality.js +123 -0
- package/framework-mcp/dist/framework-mcp/src/utils/rules-engine.js +231 -0
- package/framework-mcp/dist/framework-mcp/src/utils/silent-router.js +128 -0
- package/framework-mcp/dist/framework-mcp/src/utils/storage.js +2 -2
- package/framework-mcp/dist/framework-mcp/src/utils/telemetry-streamer.js +396 -0
- package/framework-mcp/dist/src/cli/platforms/core.js +72 -0
- package/framework-mcp/dist/src/cli/platforms/index.js +5 -0
- package/framework-mcp/dist/src/cli/platforms/paths.js +101 -0
- package/framework-mcp/dist/src/cli/platforms/scaffold.js +72 -0
- package/framework-mcp/dist/src/cli/platforms/utils.js +75 -0
- package/framework-mcp/dist/src/cli/utils/claude.js +57 -0
- package/framework-mcp/dist/src/cli/utils/compliance.js +12 -0
- package/framework-mcp/dist/src/cli/utils/fs.js +138 -0
- package/framework-mcp/dist/src/cli/utils/pkg.js +282 -0
- package/framework-mcp/dist/src/cli/utils/quality.js +9 -0
- package/framework-mcp/dist/src/modules/agents/definitions.js +563 -0
- package/framework-mcp/dist/src/modules/agents/registry/analyst.js +39 -0
- package/framework-mcp/dist/src/modules/agents/registry/architect.js +42 -0
- package/framework-mcp/dist/src/modules/agents/registry/backend.js +50 -0
- package/framework-mcp/dist/src/modules/agents/registry/database.js +45 -0
- package/framework-mcp/dist/src/modules/agents/registry/devops.js +45 -0
- package/framework-mcp/dist/src/modules/agents/registry/explorer.js +37 -0
- package/framework-mcp/dist/src/modules/agents/registry/frontend.js +52 -0
- package/framework-mcp/dist/src/modules/agents/registry/git.js +36 -0
- package/framework-mcp/dist/src/modules/agents/registry/manager.js +64 -0
- package/framework-mcp/dist/src/modules/agents/registry/mobile.js +41 -0
- package/framework-mcp/dist/src/modules/agents/registry/native.js +41 -0
- package/framework-mcp/dist/src/modules/agents/registry/quality.js +43 -0
- package/framework-mcp/dist/src/modules/agents/registry/security.js +42 -0
- package/framework-mcp/dist/src/modules/agents/types.js +1 -0
- package/framework-mcp/dist/src/modules/engines/quality-gate.js +92 -0
- package/framework-mcp/dist/src/modules/engines/risk-engine.js +105 -0
- package/framework-mcp/dist/src/modules/engines/routing-engine.js +408 -0
- package/framework-mcp/dist/src/modules/engines/types.js +1 -0
- package/framework-mcp/dist/src/modules/memory/core.js +10 -17
- package/framework-mcp/dist/src/modules/memory/embedding.js +130 -0
- package/framework-mcp/dist/src/modules/providers/definitions.js +140 -0
- package/framework-mcp/dist/src/modules/providers/registry.js +18 -0
- package/framework-mcp/dist/src/modules/providers/shared.js +104 -0
- package/framework-mcp/dist/src/modules/providers/types.js +1 -0
- package/framework-mcp/dist/src/modules/skills/adapter-skills.js +449 -0
- package/framework-mcp/dist/src/modules/skills/definitions.js +70 -0
- package/framework-mcp/dist/src/shared/audit.js +220 -0
- package/framework-mcp/dist/src/shared/errors.js +68 -0
- package/framework-mcp/dist/src/shared/fs.js +4 -2
- package/framework-mcp/dist/src/shared/lock.js +159 -0
- package/framework-mcp/dist/src/shared/logger.js +15 -5
- package/framework-mcp/dist/src/shared/pii.js +212 -0
- package/framework-mcp/dist/src/shared/retention.js +170 -0
- package/framework-mcp/dist/src/shared/storage.js +49 -7
- package/framework-mcp/dist/src/shared/string.js +29 -0
- package/framework-mcp/package.json +8 -2
- package/mcp.json +11 -6
- package/package.json +22 -9
- package/templates/full/ATABEY_FULL.md +515 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { execSync } from "child_process";
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import { analyzePathQuality } from "../../utils/quality.js";
|
|
5
|
+
/**
|
|
6
|
+
* Code quality analysis tool for Atabey MCP.
|
|
7
|
+
*
|
|
8
|
+
* Performs three checks on the provided source code:
|
|
9
|
+
* - TypeScript type checking (checkTypes)
|
|
10
|
+
* - Lint checking (checkLint)
|
|
11
|
+
* - Code complexity analysis (checkComplexity)
|
|
12
|
+
*/
|
|
13
|
+
export function handleAnalyzeCodeQuality(projectRoot, args) {
|
|
14
|
+
// Validate path parameter to prevent command injection
|
|
15
|
+
if (!/^[a-zA-Z0-9_./-]+$/.test(args.path)) {
|
|
16
|
+
return {
|
|
17
|
+
isError: true,
|
|
18
|
+
content: [{ type: "text", text: `[ERROR] Invalid path characters detected: ${args.path}` }]
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const targetPath = path.resolve(projectRoot, args.path);
|
|
22
|
+
if (!fs.existsSync(targetPath)) {
|
|
23
|
+
return {
|
|
24
|
+
isError: true,
|
|
25
|
+
content: [{ type: "text", text: `[ERROR] Path does not exist: ${args.path}` }]
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
const results = ["# Code Quality Analysis Report", "", `**Target:** ${args.path}`, `**Timestamp:** ${new Date().toISOString()}`, ""];
|
|
29
|
+
let hasErrors = false;
|
|
30
|
+
// 1. TypeScript Type Check
|
|
31
|
+
if (args.checkTypes !== false) {
|
|
32
|
+
try {
|
|
33
|
+
execSync("npx tsc --noEmit", {
|
|
34
|
+
cwd: projectRoot,
|
|
35
|
+
stdio: "pipe",
|
|
36
|
+
timeout: 30000,
|
|
37
|
+
encoding: "utf8"
|
|
38
|
+
});
|
|
39
|
+
results.push("## ✅ TypeScript Check: PASSED");
|
|
40
|
+
results.push("No type errors found.");
|
|
41
|
+
}
|
|
42
|
+
catch (err) {
|
|
43
|
+
hasErrors = true;
|
|
44
|
+
const error = err;
|
|
45
|
+
const stderr = error.stderr || error.stdout || error.message || "Unknown error";
|
|
46
|
+
results.push("## ❌ TypeScript Check: FAILED");
|
|
47
|
+
results.push("```");
|
|
48
|
+
results.push(stderr.substring(0, 2000));
|
|
49
|
+
results.push("```");
|
|
50
|
+
}
|
|
51
|
+
results.push("");
|
|
52
|
+
}
|
|
53
|
+
// 2. Lint Check
|
|
54
|
+
if (args.checkLint !== false) {
|
|
55
|
+
try {
|
|
56
|
+
const lintOutput = execSync("npx eslint --format compact " + args.path, {
|
|
57
|
+
cwd: projectRoot,
|
|
58
|
+
stdio: "pipe",
|
|
59
|
+
timeout: 30000,
|
|
60
|
+
encoding: "utf8"
|
|
61
|
+
});
|
|
62
|
+
const lintStr = lintOutput.trim();
|
|
63
|
+
if (lintStr) {
|
|
64
|
+
results.push("## ⚠️ Lint Check: ISSUES FOUND");
|
|
65
|
+
results.push("```");
|
|
66
|
+
results.push(lintStr.substring(0, 2000));
|
|
67
|
+
results.push("```");
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
results.push("## ✅ Lint Check: PASSED");
|
|
71
|
+
results.push("No lint issues found.");
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
catch (err) {
|
|
75
|
+
const error = err;
|
|
76
|
+
const stderr = error.stderr || error.stdout || error.message || "Unknown error";
|
|
77
|
+
// ESLint returns non-zero exit code when issues are found
|
|
78
|
+
if (stderr.includes("ESLint")) {
|
|
79
|
+
results.push("## ❌ Lint Check: FAILED");
|
|
80
|
+
results.push("```");
|
|
81
|
+
results.push(stderr.substring(0, 2000));
|
|
82
|
+
results.push("```");
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
results.push("## ✅ Lint Check: PASSED (no ESLint config)");
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
results.push("");
|
|
89
|
+
}
|
|
90
|
+
// 3. Code Complexity Check (basic heuristic)
|
|
91
|
+
if (args.checkComplexity !== false) {
|
|
92
|
+
const qualityResult = analyzePathQuality(projectRoot, args.path);
|
|
93
|
+
const complexityIssues = qualityResult.issues.filter(issue => issue.type === "complexity");
|
|
94
|
+
if (complexityIssues.length > 0) {
|
|
95
|
+
hasErrors = true;
|
|
96
|
+
results.push(`## ⚠️ Code Complexity Issues (${complexityIssues.length})`);
|
|
97
|
+
complexityIssues.forEach(issue => {
|
|
98
|
+
results.push(`- ${issue.file}:${issue.line} — ${issue.message}`);
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
results.push("## ✅ Code Complexity: OK");
|
|
103
|
+
results.push("No complexity issues found.");
|
|
104
|
+
}
|
|
105
|
+
results.push("");
|
|
106
|
+
}
|
|
107
|
+
// Summary
|
|
108
|
+
results.push("---");
|
|
109
|
+
results.push(`**Overall Status:** ${hasErrors ? "⚠️ Issues Found" : "✅ All Checks Passed"}`);
|
|
110
|
+
return {
|
|
111
|
+
content: [{ type: "text", text: results.join("\n") }],
|
|
112
|
+
isError: hasErrors
|
|
113
|
+
};
|
|
114
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
/**
|
|
4
|
+
* [TOOL] check_architecture_compliance
|
|
5
|
+
*
|
|
6
|
+
* Checks architectural compliance for code at the specified path:
|
|
7
|
+
* - Controller/Service/Repository layer separation
|
|
8
|
+
* - Import rules (controller → service → repository)
|
|
9
|
+
* - Circular dependencies
|
|
10
|
+
*/
|
|
11
|
+
export function handleCheckArchitectureCompliance(projectRoot, args) {
|
|
12
|
+
const targetPath = path.resolve(projectRoot, args.path);
|
|
13
|
+
if (!fs.existsSync(targetPath)) {
|
|
14
|
+
return {
|
|
15
|
+
isError: true,
|
|
16
|
+
content: [{ type: "text", text: `[ERROR] Path does not exist: ${args.path}` }]
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
const results = [
|
|
20
|
+
"# Architecture Compliance Report",
|
|
21
|
+
"",
|
|
22
|
+
`**Target:** ${args.path}`,
|
|
23
|
+
`**Timestamp:** ${new Date().toISOString()}`,
|
|
24
|
+
""
|
|
25
|
+
];
|
|
26
|
+
const violations = [];
|
|
27
|
+
const allFiles = [];
|
|
28
|
+
// Collect all relevant files
|
|
29
|
+
function collectFiles(dir) {
|
|
30
|
+
if (!fs.existsSync(dir))
|
|
31
|
+
return;
|
|
32
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
33
|
+
for (const entry of entries) {
|
|
34
|
+
const fullPath = path.join(dir, entry.name);
|
|
35
|
+
if (entry.isDirectory() && !entry.name.startsWith("node_modules") && !entry.name.startsWith(".")) {
|
|
36
|
+
collectFiles(fullPath);
|
|
37
|
+
}
|
|
38
|
+
else if (entry.isFile() && (entry.name.endsWith(".ts") || entry.name.endsWith(".tsx"))) {
|
|
39
|
+
allFiles.push(fullPath);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
collectFiles(targetPath);
|
|
44
|
+
// Analyze each file for architectural violations
|
|
45
|
+
for (const file of allFiles) {
|
|
46
|
+
const relativePath = path.relative(projectRoot, file);
|
|
47
|
+
const content = fs.readFileSync(file, "utf8");
|
|
48
|
+
const lines = content.split("\n");
|
|
49
|
+
const fileName = path.basename(file, path.extname(file));
|
|
50
|
+
const fileDir = path.dirname(file);
|
|
51
|
+
// 1. Layer naming convention check
|
|
52
|
+
const isController = fileName.endsWith(".controller") || fileName.endsWith("Controller");
|
|
53
|
+
const isService = fileName.endsWith(".service") || fileName.endsWith("Service");
|
|
54
|
+
const isRepository = fileName.endsWith(".repository") || fileName.endsWith("Repository");
|
|
55
|
+
const isModel = fileName.endsWith(".model") || fileName.endsWith("Model");
|
|
56
|
+
// 2. Controller → Service → Repository dependency direction
|
|
57
|
+
for (const line of lines) {
|
|
58
|
+
const importMatch = line.match(/import\s+.*\s+from\s+['"](.+)['"]/);
|
|
59
|
+
if (!importMatch)
|
|
60
|
+
continue;
|
|
61
|
+
const importPath = importMatch[1];
|
|
62
|
+
const importedFileName = path.basename(importPath, path.extname(importPath));
|
|
63
|
+
// Controller importing Repository directly (should go through Service)
|
|
64
|
+
if (isController && (importedFileName.endsWith(".repository") || importedFileName.endsWith("Repository"))) {
|
|
65
|
+
violations.push(`- ${relativePath}: Controller \`${fileName}\` directly imports Repository \`${importedFileName}\`. ` +
|
|
66
|
+
"Use Service layer instead.");
|
|
67
|
+
}
|
|
68
|
+
// Repository importing Controller
|
|
69
|
+
if (isRepository && (importedFileName.endsWith(".controller") || importedFileName.endsWith("Controller"))) {
|
|
70
|
+
violations.push(`- ${relativePath}: Repository \`${fileName}\` imports Controller \`${importedFileName}\`. ` +
|
|
71
|
+
"Reverse dependency detected.");
|
|
72
|
+
}
|
|
73
|
+
// Service importing Controller
|
|
74
|
+
if (isService && (importedFileName.endsWith(".controller") || importedFileName.endsWith("Controller"))) {
|
|
75
|
+
violations.push(`- ${relativePath}: Service \`${fileName}\` imports Controller \`${importedFileName}\`. ` +
|
|
76
|
+
"Service should not depend on Controller.");
|
|
77
|
+
}
|
|
78
|
+
// Model importing Controller/Service/Repository
|
|
79
|
+
if (isModel && (importedFileName.endsWith("Controller") || importedFileName.endsWith("Service") || importedFileName.endsWith("Repository"))) {
|
|
80
|
+
violations.push(`- ${relativePath}: Model \`${fileName}\` imports \`${importedFileName}\`. ` +
|
|
81
|
+
"Models should not depend on other layers.");
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
// 3. Check for barrel index imports that might cause circular dependencies
|
|
85
|
+
if (fileName === "index" && fileDir.includes("modules")) {
|
|
86
|
+
const indexContent = fs.readFileSync(file, "utf8");
|
|
87
|
+
const exports = indexContent.match(/export\s+\*?\s*from\s+['"].+['"]/g) || [];
|
|
88
|
+
if (exports.length > 10) {
|
|
89
|
+
violations.push(`- ${relativePath}: Barrel file exports ${exports.length} modules. ` +
|
|
90
|
+
"Consider splitting into smaller barrels to prevent circular dependencies.");
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
// 4. Strict mode check
|
|
95
|
+
let hasStrictMode = false;
|
|
96
|
+
const tsConfigPath = path.join(projectRoot, "tsconfig.json");
|
|
97
|
+
if (fs.existsSync(tsConfigPath)) {
|
|
98
|
+
try {
|
|
99
|
+
const tsConfig = JSON.parse(fs.readFileSync(tsConfigPath, "utf8"));
|
|
100
|
+
if (tsConfig.compilerOptions?.strict) {
|
|
101
|
+
hasStrictMode = true;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
// Ignore parse errors
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (!hasStrictMode) {
|
|
109
|
+
violations.push("- tsconfig.json: `strict` mode is not enabled. Atabey requires strict type checking.");
|
|
110
|
+
}
|
|
111
|
+
// Report
|
|
112
|
+
if (violations.length > 0) {
|
|
113
|
+
results.push(`## ❌ Architecture Violations (${violations.length})`);
|
|
114
|
+
results.push("");
|
|
115
|
+
results.push(...violations);
|
|
116
|
+
results.push("");
|
|
117
|
+
results.push("---");
|
|
118
|
+
results.push(`**Status:** ❌ FAILED — ${violations.length} architectural violations found.`);
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
results.push("## ✅ Architecture Compliance: PASSED");
|
|
122
|
+
results.push("");
|
|
123
|
+
results.push("- All layer dependencies are correctly oriented.");
|
|
124
|
+
results.push("- No circular dependencies detected.");
|
|
125
|
+
results.push("- Strict mode is enabled.");
|
|
126
|
+
results.push("");
|
|
127
|
+
results.push("---");
|
|
128
|
+
results.push("**Status:** ✅ All architecture checks passed.");
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
content: [{ type: "text", text: results.join("\n") }],
|
|
132
|
+
isError: violations.length > 0
|
|
133
|
+
};
|
|
134
|
+
}
|
|
@@ -34,7 +34,7 @@ export const ReplaceTextSchema = z.object({
|
|
|
34
34
|
path: z.string().min(1, "Path is required"),
|
|
35
35
|
oldText: z.string().min(1, "oldText is required"),
|
|
36
36
|
newText: z.string(),
|
|
37
|
-
allowMultiple: z.boolean().default(false),
|
|
37
|
+
allowMultiple: z.boolean().optional().default(false),
|
|
38
38
|
}).strict();
|
|
39
39
|
// ─── Search & Exploration
|
|
40
40
|
export const ListDirSchema = z.object({
|
|
@@ -58,7 +58,7 @@ export const BatchSurgicalEditSchema = z.object({
|
|
|
58
58
|
path: z.string().min(1),
|
|
59
59
|
oldText: z.string().min(1),
|
|
60
60
|
newText: z.string(),
|
|
61
|
-
allowMultiple: z.boolean().default(false),
|
|
61
|
+
allowMultiple: z.boolean().optional().default(false),
|
|
62
62
|
})),
|
|
63
63
|
}).strict();
|
|
64
64
|
export const PatchFileSchema = z.object({
|
|
@@ -97,7 +97,7 @@ export const SubmitPlanSchema = z.object({
|
|
|
97
97
|
export const AcquireLockSchema = z.object({
|
|
98
98
|
resource: z.string().min(1),
|
|
99
99
|
agent: AgentIDSchema,
|
|
100
|
-
ttl: z.number().int().positive().default(60),
|
|
100
|
+
ttl: z.number().int().positive().optional().default(60),
|
|
101
101
|
}).strict();
|
|
102
102
|
export const ReleaseLockSchema = z.object({
|
|
103
103
|
resource: z.string().min(1),
|
|
@@ -106,7 +106,7 @@ export const ReleaseLockSchema = z.object({
|
|
|
106
106
|
export const RegisterAgentSchema = z.object({
|
|
107
107
|
agent: AgentIDSchema,
|
|
108
108
|
role: z.string().min(1),
|
|
109
|
-
capability: z.number().int().min(1).max(10).default(5),
|
|
109
|
+
capability: z.number().int().min(1).max(10).optional().default(5),
|
|
110
110
|
specialties: z.record(z.number()).optional(),
|
|
111
111
|
}).strict();
|
|
112
112
|
export const UpdateContractHashSchema = z.object({}).strict();
|
|
@@ -123,7 +123,7 @@ export const StoreKnowledgeSchema = z.object({
|
|
|
123
123
|
export const SearchKnowledgeSchema = z.object({
|
|
124
124
|
query: z.string().min(1, "Query is required"),
|
|
125
125
|
category: z.enum(["ARCHITECTURE", "DECISION", "CODE_SNIPPET", "RULE", "TASK_HISTORY"]).optional(),
|
|
126
|
-
limit: z.number().int().positive().default(5),
|
|
126
|
+
limit: z.number().int().positive().optional().default(5),
|
|
127
127
|
}).strict();
|
|
128
128
|
export const DeleteKnowledgeSchema = z.object({
|
|
129
129
|
id: z.string().optional(),
|
|
@@ -137,8 +137,8 @@ export const SendAgentMessageSchema = z.object({
|
|
|
137
137
|
content: z.string().min(1, "Content cannot be empty"),
|
|
138
138
|
traceId: TraceIDSchema,
|
|
139
139
|
parentId: TaskIDSchema.optional(),
|
|
140
|
-
priority: z.enum(["HIGH", "NORMAL", "LOW"]).default("NORMAL"),
|
|
141
|
-
requiresApproval: z.boolean().default(false),
|
|
140
|
+
priority: z.enum(["HIGH", "NORMAL", "LOW"]).optional().default("NORMAL"),
|
|
141
|
+
requiresApproval: z.boolean().optional().default(false),
|
|
142
142
|
}).strict();
|
|
143
143
|
export const LogAgentActionSchema = z.object({
|
|
144
144
|
agent: AgentIDSchema,
|
|
@@ -150,4 +150,29 @@ export const LogAgentActionSchema = z.object({
|
|
|
150
150
|
}).strict();
|
|
151
151
|
export const AskHumanSchema = z.object({
|
|
152
152
|
question: z.string().min(10, "Question must be clear and detailed."),
|
|
153
|
+
timeoutSeconds: z.number().int().positive().optional().default(120),
|
|
154
|
+
}).strict();
|
|
155
|
+
export const ApproveOperationSchema = z.object({
|
|
156
|
+
action: z.enum(["approve", "reject", "list"]),
|
|
157
|
+
traceId: z.string().optional(),
|
|
158
|
+
reason: z.string().optional(),
|
|
159
|
+
}).strict();
|
|
160
|
+
// ─── Code Quality Analysis ──────────────────────────────────────────
|
|
161
|
+
export const AnalyzeCodeQualitySchema = z.object({
|
|
162
|
+
path: z.string().min(1, "Path to analyze is required"),
|
|
163
|
+
checkTypes: z.boolean().optional().default(true),
|
|
164
|
+
checkLint: z.boolean().optional().default(true),
|
|
165
|
+
checkComplexity: z.boolean().optional().default(true),
|
|
166
|
+
}).strict();
|
|
167
|
+
// ─── Architecture Compliance ────────────────────────────────────────
|
|
168
|
+
export const CheckArchitectureComplianceSchema = z.object({
|
|
169
|
+
path: z.string().min(1, "Path to check is required"),
|
|
170
|
+
rules: z.array(z.string()).optional(),
|
|
171
|
+
}).strict();
|
|
172
|
+
// ─── PII / Compliance ───────────────────────────────────────────────
|
|
173
|
+
export const MaskPIISchema = z.object({
|
|
174
|
+
text: z.string().optional(),
|
|
175
|
+
data: z.record(z.unknown()).optional(),
|
|
176
|
+
mode: z.enum(["text", "object", "auto"]).optional().default("auto"),
|
|
177
|
+
strictMode: z.boolean().optional().default(false),
|
|
153
178
|
}).strict();
|
|
@@ -60,8 +60,8 @@ const COMMAND_ALLOW_LIST = [
|
|
|
60
60
|
"cargo build",
|
|
61
61
|
"cargo check",
|
|
62
62
|
"cargo fmt",
|
|
63
|
-
// File operations (safe) —
|
|
64
|
-
// "
|
|
63
|
+
// File operations (safe) — NOTE: "rm -rf" and "rm -r" intentionally excluded.
|
|
64
|
+
// Only "rmdir" is allowed to prevent dangerous commands like "rm -rf /".
|
|
65
65
|
"mkdir",
|
|
66
66
|
"cp",
|
|
67
67
|
"mv",
|
|
@@ -95,6 +95,16 @@ export function handleRunCommand(projectRoot, args) {
|
|
|
95
95
|
isError: true,
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
|
+
// Harden to prevent shell command injection / chaining
|
|
99
|
+
const hasShellMetacharacters = /[;&|><$`\n\r]/.test(command);
|
|
100
|
+
if (hasShellMetacharacters) {
|
|
101
|
+
const errorMsg = "Command rejected: Shell metacharacters are forbidden to prevent command injection.";
|
|
102
|
+
Metrics.logError(projectRoot, "@mcp", `run_shell_command: ${command} (denied: metacharacters)`, errorMsg);
|
|
103
|
+
return Promise.resolve({
|
|
104
|
+
content: [{ type: "text", text: `ERROR: ${errorMsg}` }],
|
|
105
|
+
isError: true,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
98
108
|
return new Promise((resolve) => {
|
|
99
109
|
exec(command, { cwd: projectRoot, timeout: TIMEOUT }, (error, stdout, stderr) => {
|
|
100
110
|
const output = stdout + stderr;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ─── MCP AUTHENTICATION ──────────────────────────────────────────
|
|
3
|
+
*
|
|
4
|
+
* Simple API key authentication for MCP server.
|
|
5
|
+
* When MCP_AUTH_TOKEN is set, all MCP and API requests require
|
|
6
|
+
* Authorization: Bearer <token> header.
|
|
7
|
+
*
|
|
8
|
+
* Environment Variables:
|
|
9
|
+
* MCP_AUTH_TOKEN - API key for authentication (optional)
|
|
10
|
+
* MCP_AUTH_USERS - Comma-separated list of user:token pairs (optional)
|
|
11
|
+
* Example: "alice:key1,bob:key2"
|
|
12
|
+
*
|
|
13
|
+
* If neither is set, authentication is disabled (open access).
|
|
14
|
+
*/
|
|
15
|
+
let authUsers = [];
|
|
16
|
+
let masterToken = null;
|
|
17
|
+
/**
|
|
18
|
+
* Initialize authentication from environment variables.
|
|
19
|
+
*/
|
|
20
|
+
export function initAuth() {
|
|
21
|
+
masterToken = process.env.MCP_AUTH_TOKEN || null;
|
|
22
|
+
const usersStr = process.env.MCP_AUTH_USERS || "";
|
|
23
|
+
if (usersStr) {
|
|
24
|
+
authUsers = usersStr.split(",").map(pair => {
|
|
25
|
+
const [name, token] = pair.split(":");
|
|
26
|
+
return { name: name?.trim() || "unknown", token: token?.trim() || "" };
|
|
27
|
+
}).filter(u => u.token);
|
|
28
|
+
}
|
|
29
|
+
if (masterToken) {
|
|
30
|
+
console.error(`[AUTH] Master token configured (${masterToken.length} chars)`);
|
|
31
|
+
}
|
|
32
|
+
if (authUsers.length > 0) {
|
|
33
|
+
console.error(`[AUTH] ${authUsers.length} user(s) configured: ${authUsers.map(u => u.name).join(", ")}`);
|
|
34
|
+
}
|
|
35
|
+
if (!masterToken && authUsers.length === 0) {
|
|
36
|
+
console.error("[AUTH] No authentication configured - OPEN ACCESS");
|
|
37
|
+
console.error("[AUTH] Set MCP_AUTH_TOKEN=<key> or MCP_AUTH_USERS=user1:key1,user2:key2 to enable");
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Authenticate a request using the Authorization header.
|
|
42
|
+
* Returns the authenticated user name or null if unauthorized.
|
|
43
|
+
*/
|
|
44
|
+
export function authenticate(req) {
|
|
45
|
+
if (!masterToken && authUsers.length === 0) {
|
|
46
|
+
// Auth disabled - allow all
|
|
47
|
+
return { authenticated: true, user: "anonymous" };
|
|
48
|
+
}
|
|
49
|
+
const authHeader = req.headers["authorization"];
|
|
50
|
+
if (!authHeader) {
|
|
51
|
+
return { authenticated: false, user: "" };
|
|
52
|
+
}
|
|
53
|
+
// Support both "Bearer <key>" and "<key>" formats
|
|
54
|
+
const token = authHeader.startsWith("Bearer ") ? authHeader.slice(7) : authHeader;
|
|
55
|
+
// Check master token first
|
|
56
|
+
if (masterToken && token === masterToken) {
|
|
57
|
+
return { authenticated: true, user: "admin" };
|
|
58
|
+
}
|
|
59
|
+
// Check user tokens
|
|
60
|
+
for (const user of authUsers) {
|
|
61
|
+
if (token === user.token) {
|
|
62
|
+
return { authenticated: true, user: user.name };
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return { authenticated: false, user: "" };
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Generate authentication headers for MCP client configuration.
|
|
69
|
+
*/
|
|
70
|
+
export function getAuthHeader(user, token) {
|
|
71
|
+
return `Bearer ${token}`;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Check if authentication is enabled.
|
|
75
|
+
*/
|
|
76
|
+
export function isAuthEnabled() {
|
|
77
|
+
return !!masterToken || authUsers.length > 0;
|
|
78
|
+
}
|