atabey 0.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/ATABEY.md +258 -0
- package/LICENSE +21 -0
- package/README.md +190 -0
- package/bin/cli.js +26 -0
- package/bin/validate-agent-army.js +145 -0
- package/dist/framework-mcp/src/constants.d.ts +47 -0
- package/dist/framework-mcp/src/constants.js +65 -0
- package/dist/framework-mcp/src/constants.js.map +1 -0
- package/dist/framework-mcp/src/index.d.ts +1 -0
- package/dist/framework-mcp/src/index.js +120 -0
- package/dist/framework-mcp/src/index.js.map +1 -0
- package/dist/framework-mcp/src/tools/control_plane/locking.d.ts +9 -0
- package/dist/framework-mcp/src/tools/control_plane/locking.js +83 -0
- package/dist/framework-mcp/src/tools/control_plane/locking.js.map +1 -0
- package/dist/framework-mcp/src/tools/control_plane/registry.d.ts +6 -0
- package/dist/framework-mcp/src/tools/control_plane/registry.js +35 -0
- package/dist/framework-mcp/src/tools/control_plane/registry.js.map +1 -0
- package/dist/framework-mcp/src/tools/definitions.d.ts +2 -0
- package/dist/framework-mcp/src/tools/definitions.js +291 -0
- package/dist/framework-mcp/src/tools/definitions.js.map +1 -0
- package/dist/framework-mcp/src/tools/file_system/batch_surgical_edit.d.ts +5 -0
- package/dist/framework-mcp/src/tools/file_system/batch_surgical_edit.js +60 -0
- package/dist/framework-mcp/src/tools/file_system/batch_surgical_edit.js.map +1 -0
- package/dist/framework-mcp/src/tools/file_system/patch_file.d.ts +2 -0
- package/dist/framework-mcp/src/tools/file_system/patch_file.js +26 -0
- package/dist/framework-mcp/src/tools/file_system/patch_file.js.map +1 -0
- package/dist/framework-mcp/src/tools/file_system/read_file.d.ts +2 -0
- package/dist/framework-mcp/src/tools/file_system/read_file.js +52 -0
- package/dist/framework-mcp/src/tools/file_system/read_file.js.map +1 -0
- package/dist/framework-mcp/src/tools/file_system/replace_text.d.ts +2 -0
- package/dist/framework-mcp/src/tools/file_system/replace_text.js +46 -0
- package/dist/framework-mcp/src/tools/file_system/replace_text.js.map +1 -0
- package/dist/framework-mcp/src/tools/file_system/write_file.d.ts +2 -0
- package/dist/framework-mcp/src/tools/file_system/write_file.js +39 -0
- package/dist/framework-mcp/src/tools/file_system/write_file.js.map +1 -0
- package/dist/framework-mcp/src/tools/framework/audit_deps.d.ts +6 -0
- package/dist/framework-mcp/src/tools/framework/audit_deps.js +42 -0
- package/dist/framework-mcp/src/tools/framework/audit_deps.js.map +1 -0
- package/dist/framework-mcp/src/tools/framework/get_status.d.ts +2 -0
- package/dist/framework-mcp/src/tools/framework/get_status.js +6 -0
- package/dist/framework-mcp/src/tools/framework/get_status.js.map +1 -0
- package/dist/framework-mcp/src/tools/framework/orchestrate.d.ts +2 -0
- package/dist/framework-mcp/src/tools/framework/orchestrate.js +6 -0
- package/dist/framework-mcp/src/tools/framework/orchestrate.js.map +1 -0
- package/dist/framework-mcp/src/tools/framework/run_tests.d.ts +5 -0
- package/dist/framework-mcp/src/tools/framework/run_tests.js +26 -0
- package/dist/framework-mcp/src/tools/framework/run_tests.js.map +1 -0
- package/dist/framework-mcp/src/tools/framework/update_contract_hash.d.ts +2 -0
- package/dist/framework-mcp/src/tools/framework/update_contract_hash.js +6 -0
- package/dist/framework-mcp/src/tools/framework/update_contract_hash.js.map +1 -0
- package/dist/framework-mcp/src/tools/framework/update_memory.d.ts +2 -0
- package/dist/framework-mcp/src/tools/framework/update_memory.js +9 -0
- package/dist/framework-mcp/src/tools/framework/update_memory.js.map +1 -0
- package/dist/framework-mcp/src/tools/index.d.ts +4 -0
- package/dist/framework-mcp/src/tools/index.js +61 -0
- package/dist/framework-mcp/src/tools/index.js.map +1 -0
- package/dist/framework-mcp/src/tools/memory/get_insights.d.ts +6 -0
- package/dist/framework-mcp/src/tools/memory/get_insights.js +35 -0
- package/dist/framework-mcp/src/tools/memory/get_insights.js.map +1 -0
- package/dist/framework-mcp/src/tools/memory/read_memory.d.ts +6 -0
- package/dist/framework-mcp/src/tools/memory/read_memory.js +29 -0
- package/dist/framework-mcp/src/tools/memory/read_memory.js.map +1 -0
- package/dist/framework-mcp/src/tools/messaging/log_action.d.ts +2 -0
- package/dist/framework-mcp/src/tools/messaging/log_action.js +23 -0
- package/dist/framework-mcp/src/tools/messaging/log_action.js.map +1 -0
- package/dist/framework-mcp/src/tools/messaging/send_message.d.ts +2 -0
- package/dist/framework-mcp/src/tools/messaging/send_message.js +95 -0
- package/dist/framework-mcp/src/tools/messaging/send_message.js.map +1 -0
- package/dist/framework-mcp/src/tools/observability/check_ports.d.ts +5 -0
- package/dist/framework-mcp/src/tools/observability/check_ports.js +27 -0
- package/dist/framework-mcp/src/tools/observability/check_ports.js.map +1 -0
- package/dist/framework-mcp/src/tools/observability/get_health.d.ts +5 -0
- package/dist/framework-mcp/src/tools/observability/get_health.js +20 -0
- package/dist/framework-mcp/src/tools/observability/get_health.js.map +1 -0
- package/dist/framework-mcp/src/tools/quality/check_lint.d.ts +5 -0
- package/dist/framework-mcp/src/tools/quality/check_lint.js +29 -0
- package/dist/framework-mcp/src/tools/quality/check_lint.js.map +1 -0
- package/dist/framework-mcp/src/tools/search/get_gaps.d.ts +6 -0
- package/dist/framework-mcp/src/tools/search/get_gaps.js +49 -0
- package/dist/framework-mcp/src/tools/search/get_gaps.js.map +1 -0
- package/dist/framework-mcp/src/tools/search/get_map.d.ts +6 -0
- package/dist/framework-mcp/src/tools/search/get_map.js +44 -0
- package/dist/framework-mcp/src/tools/search/get_map.js.map +1 -0
- package/dist/framework-mcp/src/tools/search/grep_search.d.ts +5 -0
- package/dist/framework-mcp/src/tools/search/grep_search.js +76 -0
- package/dist/framework-mcp/src/tools/search/grep_search.js.map +1 -0
- package/dist/framework-mcp/src/tools/search/list_dir.d.ts +5 -0
- package/dist/framework-mcp/src/tools/search/list_dir.js +29 -0
- package/dist/framework-mcp/src/tools/search/list_dir.js.map +1 -0
- package/dist/framework-mcp/src/tools/shell/run_command.d.ts +2 -0
- package/dist/framework-mcp/src/tools/shell/run_command.js +47 -0
- package/dist/framework-mcp/src/tools/shell/run_command.js.map +1 -0
- package/dist/framework-mcp/src/tools/types.d.ts +120 -0
- package/dist/framework-mcp/src/tools/types.js +2 -0
- package/dist/framework-mcp/src/tools/types.js.map +1 -0
- package/dist/framework-mcp/src/utils/cli.d.ts +5 -0
- package/dist/framework-mcp/src/utils/cli.js +21 -0
- package/dist/framework-mcp/src/utils/cli.js.map +1 -0
- package/dist/framework-mcp/src/utils/compliance.d.ts +5 -0
- package/dist/framework-mcp/src/utils/compliance.js +79 -0
- package/dist/framework-mcp/src/utils/compliance.js.map +1 -0
- package/dist/framework-mcp/src/utils/fs.d.ts +16 -0
- package/dist/framework-mcp/src/utils/fs.js +45 -0
- package/dist/framework-mcp/src/utils/fs.js.map +1 -0
- package/dist/framework-mcp/src/utils/metrics.d.ts +30 -0
- package/dist/framework-mcp/src/utils/metrics.js +57 -0
- package/dist/framework-mcp/src/utils/metrics.js.map +1 -0
- package/dist/framework-mcp/src/utils/security.d.ts +10 -0
- package/dist/framework-mcp/src/utils/security.js +61 -0
- package/dist/framework-mcp/src/utils/security.js.map +1 -0
- package/dist/framework-mcp/tests/tools/file_system/file_system_tools.test.d.ts +1 -0
- package/dist/framework-mcp/tests/tools/file_system/file_system_tools.test.js +192 -0
- package/dist/framework-mcp/tests/tools/file_system/file_system_tools.test.js.map +1 -0
- package/dist/framework-mcp/tests/tools/messaging/send_message.test.d.ts +1 -0
- package/dist/framework-mcp/tests/tools/messaging/send_message.test.js +115 -0
- package/dist/framework-mcp/tests/tools/messaging/send_message.test.js.map +1 -0
- package/dist/framework-mcp/tests/tools/quality/check_lint.test.d.ts +1 -0
- package/dist/framework-mcp/tests/tools/quality/check_lint.test.js +36 -0
- package/dist/framework-mcp/tests/tools/quality/check_lint.test.js.map +1 -0
- package/dist/framework-mcp/tests/tools/shell/run_command.test.d.ts +1 -0
- package/dist/framework-mcp/tests/tools/shell/run_command.test.js +43 -0
- package/dist/framework-mcp/tests/tools/shell/run_command.test.js.map +1 -0
- package/dist/src/cli/adapters/core.d.ts +12 -0
- package/dist/src/cli/adapters/core.js +55 -0
- package/dist/src/cli/adapters/core.js.map +1 -0
- package/dist/src/cli/adapters/index.d.ts +5 -0
- package/dist/src/cli/adapters/index.js +6 -0
- package/dist/src/cli/adapters/index.js.map +1 -0
- package/dist/src/cli/adapters/paths.d.ts +15 -0
- package/dist/src/cli/adapters/paths.js +102 -0
- package/dist/src/cli/adapters/paths.js.map +1 -0
- package/dist/src/cli/adapters/scaffold.d.ts +2 -0
- package/dist/src/cli/adapters/scaffold.js +72 -0
- package/dist/src/cli/adapters/scaffold.js.map +1 -0
- package/dist/src/cli/adapters/utils.d.ts +4 -0
- package/dist/src/cli/adapters/utils.js +76 -0
- package/dist/src/cli/adapters/utils.js.map +1 -0
- package/dist/src/cli/commands/approve.d.ts +1 -0
- package/dist/src/cli/commands/approve.js +64 -0
- package/dist/src/cli/commands/approve.js.map +1 -0
- package/dist/src/cli/commands/check.d.ts +1 -0
- package/dist/src/cli/commands/check.js +180 -0
- package/dist/src/cli/commands/check.js.map +1 -0
- package/dist/src/cli/commands/compliance.d.ts +1 -0
- package/dist/src/cli/commands/compliance.js +51 -0
- package/dist/src/cli/commands/compliance.js.map +1 -0
- package/dist/src/cli/commands/contract.d.ts +10 -0
- package/dist/src/cli/commands/contract.js +51 -0
- package/dist/src/cli/commands/contract.js.map +1 -0
- package/dist/src/cli/commands/explorer.d.ts +2 -0
- package/dist/src/cli/commands/explorer.js +43 -0
- package/dist/src/cli/commands/explorer.js.map +1 -0
- package/dist/src/cli/commands/git.d.ts +2 -0
- package/dist/src/cli/commands/git.js +41 -0
- package/dist/src/cli/commands/git.js.map +1 -0
- package/dist/src/cli/commands/init/scaffold-core.d.ts +7 -0
- package/dist/src/cli/commands/init/scaffold-core.js +102 -0
- package/dist/src/cli/commands/init/scaffold-core.js.map +1 -0
- package/dist/src/cli/commands/init/scaffold-ops.d.ts +1 -0
- package/dist/src/cli/commands/init/scaffold-ops.js +81 -0
- package/dist/src/cli/commands/init/scaffold-ops.js.map +1 -0
- package/dist/src/cli/commands/init/scaffold-standards.d.ts +2 -0
- package/dist/src/cli/commands/init/scaffold-standards.js +66 -0
- package/dist/src/cli/commands/init/scaffold-standards.js.map +1 -0
- package/dist/src/cli/commands/init.d.ts +5 -0
- package/dist/src/cli/commands/init.js +128 -0
- package/dist/src/cli/commands/init.js.map +1 -0
- package/dist/src/cli/commands/knowledge.d.ts +2 -0
- package/dist/src/cli/commands/knowledge.js +43 -0
- package/dist/src/cli/commands/knowledge.js.map +1 -0
- package/dist/src/cli/commands/lint.d.ts +4 -0
- package/dist/src/cli/commands/lint.js +23 -0
- package/dist/src/cli/commands/lint.js.map +1 -0
- package/dist/src/cli/commands/log.d.ts +10 -0
- package/dist/src/cli/commands/log.js +33 -0
- package/dist/src/cli/commands/log.js.map +1 -0
- package/dist/src/cli/commands/memory.d.ts +1 -0
- package/dist/src/cli/commands/memory.js +5 -0
- package/dist/src/cli/commands/memory.js.map +1 -0
- package/dist/src/cli/commands/orchestrate.d.ts +67 -0
- package/dist/src/cli/commands/orchestrate.js +414 -0
- package/dist/src/cli/commands/orchestrate.js.map +1 -0
- package/dist/src/cli/commands/plan.d.ts +6 -0
- package/dist/src/cli/commands/plan.js +97 -0
- package/dist/src/cli/commands/plan.js.map +1 -0
- package/dist/src/cli/commands/script.d.ts +1 -0
- package/dist/src/cli/commands/script.js +20 -0
- package/dist/src/cli/commands/script.js.map +1 -0
- package/dist/src/cli/commands/security.d.ts +1 -0
- package/dist/src/cli/commands/security.js +37 -0
- package/dist/src/cli/commands/security.js.map +1 -0
- package/dist/src/cli/commands/status.d.ts +4 -0
- package/dist/src/cli/commands/status.js +41 -0
- package/dist/src/cli/commands/status.js.map +1 -0
- package/dist/src/cli/commands/trace.d.ts +4 -0
- package/dist/src/cli/commands/trace.js +29 -0
- package/dist/src/cli/commands/trace.js.map +1 -0
- package/dist/src/cli/index.d.ts +2 -0
- package/dist/src/cli/index.js +289 -0
- package/dist/src/cli/index.js.map +1 -0
- package/dist/src/cli/shims.d.ts +1 -0
- package/dist/src/cli/shims.js +67 -0
- package/dist/src/cli/shims.js.map +1 -0
- package/dist/src/cli/utils/claude.d.ts +8 -0
- package/dist/src/cli/utils/claude.js +57 -0
- package/dist/src/cli/utils/claude.js.map +1 -0
- package/dist/src/cli/utils/compliance.d.ts +11 -0
- package/dist/src/cli/utils/compliance.js +168 -0
- package/dist/src/cli/utils/compliance.js.map +1 -0
- package/dist/src/cli/utils/config-schema.d.ts +139 -0
- package/dist/src/cli/utils/config-schema.js +43 -0
- package/dist/src/cli/utils/config-schema.js.map +1 -0
- package/dist/src/cli/utils/fs.d.ts +10 -0
- package/dist/src/cli/utils/fs.js +138 -0
- package/dist/src/cli/utils/fs.js.map +1 -0
- package/dist/src/cli/utils/memory.d.ts +30 -0
- package/dist/src/cli/utils/memory.js +269 -0
- package/dist/src/cli/utils/memory.js.map +1 -0
- package/dist/src/cli/utils/pkg.d.ts +43 -0
- package/dist/src/cli/utils/pkg.js +283 -0
- package/dist/src/cli/utils/pkg.js.map +1 -0
- package/dist/src/cli/utils/schemas.d.ts +49 -0
- package/dist/src/cli/utils/schemas.js +20 -0
- package/dist/src/cli/utils/schemas.js.map +1 -0
- package/dist/src/cli/utils/string.d.ts +7 -0
- package/dist/src/cli/utils/string.js +50 -0
- package/dist/src/cli/utils/string.js.map +1 -0
- package/dist/src/cli/utils/time.d.ts +2 -0
- package/dist/src/cli/utils/time.js +28 -0
- package/dist/src/cli/utils/time.js.map +1 -0
- package/dist/src/cli/utils/ui.d.ts +30 -0
- package/dist/src/cli/utils/ui.js +59 -0
- package/dist/src/cli/utils/ui.js.map +1 -0
- package/dist/src/contracts/index.d.ts +1 -0
- package/dist/src/contracts/index.js +2 -0
- package/dist/src/contracts/index.js.map +1 -0
- package/dist/src/contracts/tasks.d.ts +44 -0
- package/dist/src/contracts/tasks.js +21 -0
- package/dist/src/contracts/tasks.js.map +1 -0
- package/dist/src/modules/adapters/definitions.d.ts +9 -0
- package/dist/src/modules/adapters/definitions.js +141 -0
- package/dist/src/modules/adapters/definitions.js.map +1 -0
- package/dist/src/modules/adapters/registry.d.ts +12 -0
- package/dist/src/modules/adapters/registry.js +19 -0
- package/dist/src/modules/adapters/registry.js.map +1 -0
- package/dist/src/modules/adapters/shared.d.ts +1 -0
- package/dist/src/modules/adapters/shared.js +105 -0
- package/dist/src/modules/adapters/shared.js.map +1 -0
- package/dist/src/modules/adapters/types.d.ts +14 -0
- package/dist/src/modules/adapters/types.js +2 -0
- package/dist/src/modules/adapters/types.js.map +1 -0
- package/dist/src/modules/agents/definitions.d.ts +15 -0
- package/dist/src/modules/agents/definitions.js +401 -0
- package/dist/src/modules/agents/definitions.js.map +1 -0
- package/dist/src/modules/agents/registry/analyst.d.ts +2 -0
- package/dist/src/modules/agents/registry/analyst.js +40 -0
- package/dist/src/modules/agents/registry/analyst.js.map +1 -0
- package/dist/src/modules/agents/registry/architect.d.ts +2 -0
- package/dist/src/modules/agents/registry/architect.js +43 -0
- package/dist/src/modules/agents/registry/architect.js.map +1 -0
- package/dist/src/modules/agents/registry/backend.d.ts +2 -0
- package/dist/src/modules/agents/registry/backend.js +43 -0
- package/dist/src/modules/agents/registry/backend.js.map +1 -0
- package/dist/src/modules/agents/registry/database.d.ts +2 -0
- package/dist/src/modules/agents/registry/database.js +39 -0
- package/dist/src/modules/agents/registry/database.js.map +1 -0
- package/dist/src/modules/agents/registry/devops.d.ts +2 -0
- package/dist/src/modules/agents/registry/devops.js +40 -0
- package/dist/src/modules/agents/registry/devops.js.map +1 -0
- package/dist/src/modules/agents/registry/explorer.d.ts +2 -0
- package/dist/src/modules/agents/registry/explorer.js +37 -0
- package/dist/src/modules/agents/registry/explorer.js.map +1 -0
- package/dist/src/modules/agents/registry/frontend.d.ts +2 -0
- package/dist/src/modules/agents/registry/frontend.js +44 -0
- package/dist/src/modules/agents/registry/frontend.js.map +1 -0
- package/dist/src/modules/agents/registry/git.d.ts +2 -0
- package/dist/src/modules/agents/registry/git.js +37 -0
- package/dist/src/modules/agents/registry/git.js.map +1 -0
- package/dist/src/modules/agents/registry/manager.d.ts +2 -0
- package/dist/src/modules/agents/registry/manager.js +54 -0
- package/dist/src/modules/agents/registry/manager.js.map +1 -0
- package/dist/src/modules/agents/registry/mobile.d.ts +2 -0
- package/dist/src/modules/agents/registry/mobile.js +40 -0
- package/dist/src/modules/agents/registry/mobile.js.map +1 -0
- package/dist/src/modules/agents/registry/native.d.ts +2 -0
- package/dist/src/modules/agents/registry/native.js +40 -0
- package/dist/src/modules/agents/registry/native.js.map +1 -0
- package/dist/src/modules/agents/registry/quality.d.ts +2 -0
- package/dist/src/modules/agents/registry/quality.js +42 -0
- package/dist/src/modules/agents/registry/quality.js.map +1 -0
- package/dist/src/modules/agents/registry/security.d.ts +2 -0
- package/dist/src/modules/agents/registry/security.js +38 -0
- package/dist/src/modules/agents/registry/security.js.map +1 -0
- package/dist/src/modules/agents/types.d.ts +31 -0
- package/dist/src/modules/agents/types.js +2 -0
- package/dist/src/modules/agents/types.js.map +1 -0
- package/dist/src/modules/skills/definitions.d.ts +48 -0
- package/dist/src/modules/skills/definitions.js +71 -0
- package/dist/src/modules/skills/definitions.js.map +1 -0
- package/dist/src/shared/constants.d.ts +116 -0
- package/dist/src/shared/constants.js +184 -0
- package/dist/src/shared/constants.js.map +1 -0
- package/dist/src/shared/errors.d.ts +46 -0
- package/dist/src/shared/errors.js +69 -0
- package/dist/src/shared/errors.js.map +1 -0
- package/dist/src/shared/fs.d.ts +8 -0
- package/dist/src/shared/fs.js +48 -0
- package/dist/src/shared/fs.js.map +1 -0
- package/dist/src/shared/logger.d.ts +28 -0
- package/dist/src/shared/logger.js +117 -0
- package/dist/src/shared/logger.js.map +1 -0
- package/dist/src/shared/types.d.ts +19 -0
- package/dist/src/shared/types.js +13 -0
- package/dist/src/shared/types.js.map +1 -0
- package/dist/tests/adapter.test.d.ts +1 -0
- package/dist/tests/adapter.test.js +128 -0
- package/dist/tests/adapter.test.js.map +1 -0
- package/dist/tests/adapters/paths.test.d.ts +1 -0
- package/dist/tests/adapters/paths.test.js +63 -0
- package/dist/tests/adapters/paths.test.js.map +1 -0
- package/dist/tests/agents-definitions.test.d.ts +1 -0
- package/dist/tests/agents-definitions.test.js +61 -0
- package/dist/tests/agents-definitions.test.js.map +1 -0
- package/dist/tests/approve.test.d.ts +1 -0
- package/dist/tests/approve.test.js +52 -0
- package/dist/tests/approve.test.js.map +1 -0
- package/dist/tests/cli/init/adapter_init.test.d.ts +1 -0
- package/dist/tests/cli/init/adapter_init.test.js +50 -0
- package/dist/tests/cli/init/adapter_init.test.js.map +1 -0
- package/dist/tests/cli/init/unified_init.test.d.ts +1 -0
- package/dist/tests/cli/init/unified_init.test.js +58 -0
- package/dist/tests/cli/init/unified_init.test.js.map +1 -0
- package/dist/tests/errors.test.d.ts +1 -0
- package/dist/tests/errors.test.js +64 -0
- package/dist/tests/errors.test.js.map +1 -0
- package/dist/tests/fs-utils.test.d.ts +1 -0
- package/dist/tests/fs-utils.test.js +101 -0
- package/dist/tests/fs-utils.test.js.map +1 -0
- package/dist/tests/integration/agent_flow.test.d.ts +1 -0
- package/dist/tests/integration/agent_flow.test.js +55 -0
- package/dist/tests/integration/agent_flow.test.js.map +1 -0
- package/dist/tests/integration/hermes_locking.test.d.ts +1 -0
- package/dist/tests/integration/hermes_locking.test.js +64 -0
- package/dist/tests/integration/hermes_locking.test.js.map +1 -0
- package/dist/tests/logger.test.d.ts +1 -0
- package/dist/tests/logger.test.js +81 -0
- package/dist/tests/logger.test.js.map +1 -0
- package/dist/tests/memory-utils.test.d.ts +1 -0
- package/dist/tests/memory-utils.test.js +59 -0
- package/dist/tests/memory-utils.test.js.map +1 -0
- package/dist/tests/modules/adapters/adapters.test.d.ts +1 -0
- package/dist/tests/modules/adapters/adapters.test.js +30 -0
- package/dist/tests/modules/adapters/adapters.test.js.map +1 -0
- package/dist/tests/orchestrate.test.d.ts +1 -0
- package/dist/tests/orchestrate.test.js +67 -0
- package/dist/tests/orchestrate.test.js.map +1 -0
- package/dist/tests/shared/constants.test.d.ts +1 -0
- package/dist/tests/shared/constants.test.js +17 -0
- package/dist/tests/shared/constants.test.js.map +1 -0
- package/dist/tests/skills-definitions.test.d.ts +1 -0
- package/dist/tests/skills-definitions.test.js +34 -0
- package/dist/tests/skills-definitions.test.js.map +1 -0
- package/dist/tests/status.test.d.ts +1 -0
- package/dist/tests/status.test.js +49 -0
- package/dist/tests/status.test.js.map +1 -0
- package/dist/tests/string.test.d.ts +1 -0
- package/dist/tests/string.test.js +89 -0
- package/dist/tests/string.test.js.map +1 -0
- package/dist/tests/time.test.d.ts +1 -0
- package/dist/tests/time.test.js +48 -0
- package/dist/tests/time.test.js.map +1 -0
- package/dist/tests/trace.test.d.ts +1 -0
- package/dist/tests/trace.test.js +28 -0
- package/dist/tests/trace.test.js.map +1 -0
- package/dist/vitest.config.d.ts +2 -0
- package/dist/vitest.config.js +20 -0
- package/dist/vitest.config.js.map +1 -0
- package/framework-mcp/dist/constants.js +64 -0
- package/framework-mcp/dist/index.js +119 -0
- package/framework-mcp/dist/tools/control_plane/locking.js +82 -0
- package/framework-mcp/dist/tools/control_plane/registry.js +34 -0
- package/framework-mcp/dist/tools/definitions.js +290 -0
- package/framework-mcp/dist/tools/file_system/batch_surgical_edit.js +59 -0
- package/framework-mcp/dist/tools/file_system/patch_file.js +25 -0
- package/framework-mcp/dist/tools/file_system/read_file.js +51 -0
- package/framework-mcp/dist/tools/file_system/replace_text.js +45 -0
- package/framework-mcp/dist/tools/file_system/write_file.js +38 -0
- package/framework-mcp/dist/tools/framework/audit_deps.js +41 -0
- package/framework-mcp/dist/tools/framework/get_status.js +5 -0
- package/framework-mcp/dist/tools/framework/orchestrate.js +5 -0
- package/framework-mcp/dist/tools/framework/run_tests.js +25 -0
- package/framework-mcp/dist/tools/framework/update_contract_hash.js +5 -0
- package/framework-mcp/dist/tools/framework/update_memory.js +8 -0
- package/framework-mcp/dist/tools/index.js +60 -0
- package/framework-mcp/dist/tools/memory/get_insights.js +34 -0
- package/framework-mcp/dist/tools/memory/read_memory.js +28 -0
- package/framework-mcp/dist/tools/messaging/log_action.js +22 -0
- package/framework-mcp/dist/tools/messaging/send_message.js +94 -0
- package/framework-mcp/dist/tools/observability/check_ports.js +26 -0
- package/framework-mcp/dist/tools/observability/get_health.js +19 -0
- package/framework-mcp/dist/tools/quality/check_lint.js +28 -0
- package/framework-mcp/dist/tools/search/get_gaps.js +48 -0
- package/framework-mcp/dist/tools/search/get_map.js +43 -0
- package/framework-mcp/dist/tools/search/grep_search.js +75 -0
- package/framework-mcp/dist/tools/search/list_dir.js +28 -0
- package/framework-mcp/dist/tools/shell/run_command.js +46 -0
- package/framework-mcp/dist/tools/types.js +1 -0
- package/framework-mcp/dist/utils/cli.js +20 -0
- package/framework-mcp/dist/utils/compliance.js +78 -0
- package/framework-mcp/dist/utils/fs.js +44 -0
- package/framework-mcp/dist/utils/metrics.js +56 -0
- package/framework-mcp/dist/utils/security.js +60 -0
- package/framework-mcp/package-lock.json +1191 -0
- package/framework-mcp/package.json +26 -0
- package/framework-mcp/src/constants.ts +78 -0
- package/framework-mcp/src/declarations.d.ts +17 -0
- package/framework-mcp/src/index.ts +144 -0
- package/framework-mcp/src/tools/control_plane/locking.ts +89 -0
- package/framework-mcp/src/tools/control_plane/registry.ts +38 -0
- package/framework-mcp/src/tools/definitions.ts +292 -0
- package/framework-mcp/src/tools/file_system/batch_surgical_edit.ts +79 -0
- package/framework-mcp/src/tools/file_system/patch_file.ts +33 -0
- package/framework-mcp/src/tools/file_system/read_file.ts +58 -0
- package/framework-mcp/src/tools/file_system/replace_text.ts +54 -0
- package/framework-mcp/src/tools/file_system/write_file.ts +45 -0
- package/framework-mcp/src/tools/framework/audit_deps.ts +49 -0
- package/framework-mcp/src/tools/framework/get_status.ts +7 -0
- package/framework-mcp/src/tools/framework/orchestrate.ts +7 -0
- package/framework-mcp/src/tools/framework/run_tests.ts +28 -0
- package/framework-mcp/src/tools/framework/update_contract_hash.ts +7 -0
- package/framework-mcp/src/tools/framework/update_memory.ts +10 -0
- package/framework-mcp/src/tools/index.ts +64 -0
- package/framework-mcp/src/tools/memory/get_insights.ts +41 -0
- package/framework-mcp/src/tools/memory/read_memory.ts +31 -0
- package/framework-mcp/src/tools/messaging/log_action.ts +28 -0
- package/framework-mcp/src/tools/messaging/send_message.ts +97 -0
- package/framework-mcp/src/tools/observability/check_ports.ts +30 -0
- package/framework-mcp/src/tools/observability/get_health.ts +24 -0
- package/framework-mcp/src/tools/quality/check_lint.ts +33 -0
- package/framework-mcp/src/tools/search/get_gaps.ts +54 -0
- package/framework-mcp/src/tools/search/get_map.ts +48 -0
- package/framework-mcp/src/tools/search/grep_search.ts +75 -0
- package/framework-mcp/src/tools/search/list_dir.ts +34 -0
- package/framework-mcp/src/tools/shell/run_command.ts +56 -0
- package/framework-mcp/src/tools/types.ts +89 -0
- package/framework-mcp/src/utils/cli.ts +20 -0
- package/framework-mcp/src/utils/compliance.ts +95 -0
- package/framework-mcp/src/utils/fs.ts +45 -0
- package/framework-mcp/src/utils/metrics.ts +73 -0
- package/framework-mcp/src/utils/security.ts +66 -0
- package/framework-mcp/tests/tools/file_system/file_system_tools.test.ts +212 -0
- package/framework-mcp/tests/tools/messaging/send_message.test.ts +136 -0
- package/framework-mcp/tests/tools/quality/check_lint.test.ts +46 -0
- package/framework-mcp/tests/tools/shell/run_command.test.ts +55 -0
- package/framework-mcp/tsconfig.json +14 -0
- package/mcp.json +13 -0
- package/package.json +89 -0
- package/src/cli/adapters/core.ts +67 -0
- package/src/cli/adapters/index.ts +5 -0
- package/src/cli/adapters/paths.ts +135 -0
- package/src/cli/adapters/scaffold.ts +93 -0
- package/src/cli/adapters/utils.ts +87 -0
- package/src/cli/commands/approve.ts +73 -0
- package/src/cli/commands/check.ts +188 -0
- package/src/cli/commands/compliance.ts +55 -0
- package/src/cli/commands/contract.ts +68 -0
- package/src/cli/commands/explorer.ts +45 -0
- package/src/cli/commands/git.ts +39 -0
- package/src/cli/commands/init/scaffold-core.ts +128 -0
- package/src/cli/commands/init/scaffold-ops.ts +83 -0
- package/src/cli/commands/init/scaffold-standards.ts +67 -0
- package/src/cli/commands/init.ts +163 -0
- package/src/cli/commands/knowledge.ts +44 -0
- package/src/cli/commands/lint.ts +23 -0
- package/src/cli/commands/log.ts +37 -0
- package/src/cli/commands/memory.ts +6 -0
- package/src/cli/commands/orchestrate.ts +456 -0
- package/src/cli/commands/plan.ts +113 -0
- package/src/cli/commands/script.ts +20 -0
- package/src/cli/commands/security.ts +38 -0
- package/src/cli/commands/status.ts +44 -0
- package/src/cli/commands/trace.ts +31 -0
- package/src/cli/index.ts +322 -0
- package/src/cli/shims.ts +66 -0
- package/src/cli/utils/claude.ts +63 -0
- package/src/cli/utils/compliance.ts +191 -0
- package/src/cli/utils/config-schema.ts +48 -0
- package/src/cli/utils/fs.ts +170 -0
- package/src/cli/utils/memory.ts +303 -0
- package/src/cli/utils/pkg.ts +317 -0
- package/src/cli/utils/schemas.ts +22 -0
- package/src/cli/utils/string.ts +55 -0
- package/src/cli/utils/time.ts +27 -0
- package/src/cli/utils/ui.ts +66 -0
- package/src/contracts/index.ts +1 -0
- package/src/contracts/tasks.ts +26 -0
- package/src/modules/adapters/definitions.ts +171 -0
- package/src/modules/adapters/registry.ts +27 -0
- package/src/modules/adapters/shared.ts +120 -0
- package/src/modules/adapters/types.ts +16 -0
- package/src/modules/agents/definitions.ts +454 -0
- package/src/modules/agents/registry/analyst.ts +44 -0
- package/src/modules/agents/registry/architect.ts +47 -0
- package/src/modules/agents/registry/backend.ts +47 -0
- package/src/modules/agents/registry/database.ts +43 -0
- package/src/modules/agents/registry/devops.ts +44 -0
- package/src/modules/agents/registry/explorer.ts +41 -0
- package/src/modules/agents/registry/frontend.ts +48 -0
- package/src/modules/agents/registry/git.ts +41 -0
- package/src/modules/agents/registry/manager.ts +58 -0
- package/src/modules/agents/registry/mobile.ts +44 -0
- package/src/modules/agents/registry/native.ts +44 -0
- package/src/modules/agents/registry/quality.ts +46 -0
- package/src/modules/agents/registry/security.ts +42 -0
- package/src/modules/agents/types.ts +37 -0
- package/src/modules/skills/definitions.ts +71 -0
- package/src/schema/agent-lifecycle-schema.json +59 -0
- package/src/shared/constants.ts +218 -0
- package/src/shared/errors.ts +75 -0
- package/src/shared/fs.ts +50 -0
- package/src/shared/logger.ts +139 -0
- package/src/shared/types.ts +20 -0
- package/templates/prompts/bug-fix-recipe.md +20 -0
- package/templates/prompts/contract-design-recipe.md +21 -0
- package/templates/prompts/db-management-recipe.md +25 -0
- package/templates/prompts/deployment-recipe.md +23 -0
- package/templates/prompts/new-feature-recipe.md +19 -0
- package/templates/prompts/performance-optimization-recipe.md +23 -0
- package/templates/prompts/pull-request-template.md +21 -0
- package/templates/prompts/refactoring-recipe.md +21 -0
- package/templates/prompts/security-audit-recipe.md +20 -0
- package/templates/standards/architecture-standards.md +23 -0
- package/templates/standards/auth-standards.md +125 -0
- package/templates/standards/crud-governance.md +21 -0
- package/templates/standards/deployment-standards.md +21 -0
- package/templates/standards/frontend-standards.md +42 -0
- package/templates/standards/github-actions-standards.md +43 -0
- package/templates/standards/governance-standards.md +147 -0
- package/templates/standards/i18n-standards.md +29 -0
- package/templates/standards/kysely-standards.md +47 -0
- package/templates/standards/llm-governance.md +29 -0
- package/templates/standards/logging-and-secrets.md +34 -0
- package/templates/standards/mobile-standards.md +23 -0
- package/templates/standards/observability-standards.md +29 -0
- package/templates/standards/performance-standards.md +29 -0
- package/templates/standards/pino-standards.md +46 -0
- package/templates/standards/playwright-standards.md +54 -0
- package/templates/standards/quality-standards.md +32 -0
- package/templates/standards/react-query-standards.md +72 -0
- package/templates/standards/react-router-standards.md +62 -0
- package/templates/standards/security-audit-standards.md +33 -0
- package/templates/standards/security-standards.md +21 -0
- package/templates/standards/swagger-standards.md +50 -0
- package/templates/standards/tailwind-standards.md +29 -0
- package/templates/standards/testing-standards.md +31 -0
- package/templates/standards/token-economy.md +27 -0
- package/templates/standards/typeorm-standards.md +49 -0
- package/templates/standards/vitest-standards.md +110 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atabey/mcp",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Agent Atabey Model Context Protocol (MCP) Server",
|
|
5
|
+
"author": "Yusuf BEKAR",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/ysf-bkr/atabey.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/ysf-bkr/atabey#readme",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "npx tsc",
|
|
15
|
+
"start": "node dist/index.js",
|
|
16
|
+
"dev": "tsx src/index.ts"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
20
|
+
"zod": "^3.24.2"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@types/node": "^25.9.1",
|
|
24
|
+
"typescript": "^5.9.3"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Agent Atabey — Single Source of Truth for framework constants.
|
|
5
|
+
* Import from here instead of hardcoding paths, phases, or directory names.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// ─── Framework identity ───────────────────────────────────────────────────
|
|
9
|
+
|
|
10
|
+
export const FRAMEWORK = {
|
|
11
|
+
NAME: "Agent Atabey",
|
|
12
|
+
CORE_DIR: ".atabey",
|
|
13
|
+
// This is the hub for unified adapter layouts (e.g. .agents/gemini, .agents/claude)
|
|
14
|
+
UNIFIED_HUB_DIR: ".agents",
|
|
15
|
+
// This is the default directory to scaffold new apps into
|
|
16
|
+
APPS_DIR: "apps",
|
|
17
|
+
// This is where all skills are stored
|
|
18
|
+
SKILLS_DIR: "skills",
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const FRAMEWORK_SUBDIRS = {
|
|
22
|
+
AGENTS: "agents",
|
|
23
|
+
SKILLS: "skills",
|
|
24
|
+
KNOWLEDGE: "knowledge",
|
|
25
|
+
MESSAGES: "messages",
|
|
26
|
+
MEMORY: "memory",
|
|
27
|
+
MEMORY_GRAPH: "memory-graph",
|
|
28
|
+
LOGS: "logs",
|
|
29
|
+
CONFIG: "config",
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const ROOT_CONFIG_FILES = {
|
|
33
|
+
MCP: "mcp.json",
|
|
34
|
+
NATIVE_MODULES: "native-modules.json",
|
|
35
|
+
TSCONFIG: "tsconfig.json",
|
|
36
|
+
ESLINT: "eslint.config.js",
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const MCP = {
|
|
40
|
+
// Environment variable used by MCP to identify project root
|
|
41
|
+
PROJECT_ROOT_ENV: "ATABEY_PROJECT_ROOT",
|
|
42
|
+
// Environment variable for test mode
|
|
43
|
+
TEST_DIR_ENV: "ATABEY_TEST_DIR",
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const MEMORY_FILES = {
|
|
47
|
+
STATE: "state.json",
|
|
48
|
+
SHARED_FACTS: "shared_facts.json",
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const NATIVE_AGENT_PATHS = {
|
|
52
|
+
gemini: ".gemini/agents",
|
|
53
|
+
claude: ".claude/agents",
|
|
54
|
+
cursor: ".cursor/rules",
|
|
55
|
+
codex: ".agents/instructions",
|
|
56
|
+
grok: ".grok",
|
|
57
|
+
"antigravity-cli": ".antigravity/agents",
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// ─── Backward-compatible aliases ──────────────────────────────────────────
|
|
61
|
+
|
|
62
|
+
export const CORE_FRAMEWORK_DIR = FRAMEWORK.CORE_DIR;
|
|
63
|
+
export const UNIFIED_HUB_DIR = FRAMEWORK.UNIFIED_HUB_DIR;
|
|
64
|
+
export const SKILLS_HUB_PATH = pathJoin(UNIFIED_HUB_DIR, FRAMEWORK_SUBDIRS.SKILLS);
|
|
65
|
+
|
|
66
|
+
// ─── Path Helpers ─────────────────────────────────────────────────────────
|
|
67
|
+
|
|
68
|
+
function pathJoin(...args: string[]): string {
|
|
69
|
+
return path.join(...args);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function corePath(subdir: string, filename: string): string {
|
|
73
|
+
return pathJoin(FRAMEWORK.CORE_DIR, subdir, filename);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function knowledgePath(filename: string): string {
|
|
77
|
+
return corePath(FRAMEWORK_SUBDIRS.KNOWLEDGE, filename);
|
|
78
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare module "@modelcontextprotocol/sdk/server/index.js" {
|
|
2
|
+
export class Server {
|
|
3
|
+
constructor(info: { name: string; version: string }, options: { capabilities: { tools: Record<string, never> } });
|
|
4
|
+
setRequestHandler(schema: unknown, handler: (request: unknown) => Promise<unknown>): void;
|
|
5
|
+
connect(transport: unknown): Promise<void>;
|
|
6
|
+
close(): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
declare module "@modelcontextprotocol/sdk/server/stdio.js" {
|
|
11
|
+
export class StdioServerTransport {}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
declare module "@modelcontextprotocol/sdk/types.js" {
|
|
15
|
+
export const ListToolsRequestSchema: unknown;
|
|
16
|
+
export const CallToolRequestSchema: unknown;
|
|
17
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
5
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
6
|
+
import {
|
|
7
|
+
CallToolRequestSchema,
|
|
8
|
+
ListToolsRequestSchema,
|
|
9
|
+
} from "@modelcontextprotocol/sdk/types.js";
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
import { TOOLS, toolHandlers } from "./tools/index.js";
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
// ─── Server Setup ─────────────────────────────────────────────────
|
|
16
|
+
|
|
17
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
18
|
+
|
|
19
|
+
// Robustly find package.json by walking up from __dirname
|
|
20
|
+
function findPackageJson(startDir: string): string {
|
|
21
|
+
let currentDir = startDir;
|
|
22
|
+
while (currentDir !== path.parse(currentDir).root) {
|
|
23
|
+
const pkgPath = path.join(currentDir, "package.json");
|
|
24
|
+
if (fs.existsSync(pkgPath)) return pkgPath;
|
|
25
|
+
currentDir = path.dirname(currentDir);
|
|
26
|
+
}
|
|
27
|
+
throw new Error("Could not find package.json for @atabey/mcp");
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const pkgPath = findPackageJson(__dirname);
|
|
31
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
|
|
32
|
+
const serverVersion = pkg.version;
|
|
33
|
+
|
|
34
|
+
const server = new Server(
|
|
35
|
+
{
|
|
36
|
+
name: "@atabey/mcp",
|
|
37
|
+
version: serverVersion,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
capabilities: {
|
|
41
|
+
tools: {},
|
|
42
|
+
},
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
// Basic Schema Validator for Required Fields
|
|
47
|
+
function validateArgs(toolName: string, args: Record<string, unknown>): string | null {
|
|
48
|
+
const definition = TOOLS.find(t => t.name === toolName);
|
|
49
|
+
if (!definition) return `Unknown tool: ${toolName}`;
|
|
50
|
+
|
|
51
|
+
const required = definition.inputSchema.required || [];
|
|
52
|
+
for (const field of required) {
|
|
53
|
+
if (args[field] === undefined || args[field] === null || args[field] === "") {
|
|
54
|
+
return `Missing required argument: '${field}' for tool '${toolName}'`;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
server.setRequestHandler(ListToolsRequestSchema, async (request) => {
|
|
61
|
+
// 2026 Stateless Spec: Log client info from metadata if available
|
|
62
|
+
const meta = (request as { _meta?: { client?: { name?: string; version?: string } } })._meta;
|
|
63
|
+
if (meta) {
|
|
64
|
+
process.stderr.write(`[MCP] Stateless ListTools from ${meta.client?.name || "unknown"} v${meta.client?.version || "?.?"}\n`);
|
|
65
|
+
}
|
|
66
|
+
return { tools: TOOLS };
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
70
|
+
const req = request as { params: { name: string, arguments?: Record<string, unknown> } };
|
|
71
|
+
const { name, arguments: args } = req.params;
|
|
72
|
+
const meta = (request as { _meta?: { client?: { name?: string; version?: string } } })._meta;
|
|
73
|
+
|
|
74
|
+
// 2026 Stateless Spec: Prioritize metadata-driven context
|
|
75
|
+
if (meta) {
|
|
76
|
+
process.stderr.write(`[MCP] Stateless CallTool: ${name} (Client: ${meta.client?.name || "unknown"})\n`);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const projectRoot = process.env.ATABEY_PROJECT_ROOT || process.cwd();
|
|
80
|
+
|
|
81
|
+
try {
|
|
82
|
+
const handler = toolHandlers[name];
|
|
83
|
+
if (!handler) {
|
|
84
|
+
return {
|
|
85
|
+
isError: true,
|
|
86
|
+
content: [{ type: "text" as const, text: `❌ Unknown tool: ${name}` }],
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// 🛡️ Runtime Validation
|
|
91
|
+
const validationError = validateArgs(name, args || {});
|
|
92
|
+
if (validationError) {
|
|
93
|
+
return {
|
|
94
|
+
isError: true,
|
|
95
|
+
content: [{ type: "text" as const, text: `❌ Validation Error: ${validationError}` }],
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return await handler(projectRoot, args || {});
|
|
100
|
+
} catch (error: unknown) {
|
|
101
|
+
const message = error instanceof Error ? error.message : "Unknown error occurred";
|
|
102
|
+
return {
|
|
103
|
+
isError: true,
|
|
104
|
+
content: [{ type: "text" as const, text: `❌ Execution failed: ${message}` }],
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
// ─── Graceful Startup & Shutdown ──────────────────────────────────
|
|
110
|
+
|
|
111
|
+
async function run() {
|
|
112
|
+
const transport = new StdioServerTransport();
|
|
113
|
+
|
|
114
|
+
// Prevent unhandled errors from crashing the MCP stream
|
|
115
|
+
process.on("uncaughtException", (error: Error) => {
|
|
116
|
+
process.stderr.write(`[atabey-mcp] Uncaught exception: ${error.message}
|
|
117
|
+
`);
|
|
118
|
+
});
|
|
119
|
+
process.on("unhandledRejection", (reason: unknown) => {
|
|
120
|
+
const message = reason instanceof Error ? reason.message : String(reason);
|
|
121
|
+
process.stderr.write(`[atabey-mcp] Unhandled rejection: ${message}
|
|
122
|
+
`);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
// Graceful shutdown on SIGINT/SIGTERM
|
|
126
|
+
const shutdown = async () => {
|
|
127
|
+
try {
|
|
128
|
+
await server.close();
|
|
129
|
+
} catch {
|
|
130
|
+
// Already closed or failed — safe to ignore
|
|
131
|
+
}
|
|
132
|
+
process.exit(0);
|
|
133
|
+
};
|
|
134
|
+
process.on("SIGINT", shutdown);
|
|
135
|
+
process.on("SIGTERM", shutdown);
|
|
136
|
+
|
|
137
|
+
await server.connect(transport);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
run().catch((error: Error) => {
|
|
141
|
+
process.stderr.write(`[atabey-mcp] Fatal startup error: ${error.message}
|
|
142
|
+
`);
|
|
143
|
+
process.exit(1);
|
|
144
|
+
});
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { ToolResult, AcquireLockArgs, ReleaseLockArgs } from "../types.js";
|
|
4
|
+
import { resolveFrameworkDir } from "../../utils/security.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Handles acquiring a stateful lock on a resource.
|
|
8
|
+
*/
|
|
9
|
+
export async function handleAcquireLock(projectRoot: string, args: AcquireLockArgs): Promise<ToolResult> {
|
|
10
|
+
const { resource, agent, ttl = 60 } = args;
|
|
11
|
+
const frameworkDir = resolveFrameworkDir(projectRoot);
|
|
12
|
+
const lockDir = path.join(projectRoot, frameworkDir, "locks");
|
|
13
|
+
const lockPath = path.join(lockDir, `${resource}.lock`);
|
|
14
|
+
|
|
15
|
+
try {
|
|
16
|
+
if (!fs.existsSync(lockDir)) fs.mkdirSync(lockDir, { recursive: true });
|
|
17
|
+
|
|
18
|
+
// Check for stale lock first
|
|
19
|
+
if (fs.existsSync(lockPath)) {
|
|
20
|
+
const stat = fs.statSync(lockPath);
|
|
21
|
+
const now = new Date().getTime();
|
|
22
|
+
const age = (now - stat.mtimeMs) / 1000;
|
|
23
|
+
|
|
24
|
+
if (age < ttl) {
|
|
25
|
+
return {
|
|
26
|
+
isError: true,
|
|
27
|
+
content: [{ type: "text", text: `Resource '${resource}' is currently locked by another agent.` }]
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
// Lock expired, safe to override by renaming first (POSIX atomic operation)
|
|
31
|
+
const tempLockPath = `${lockPath}.${Math.random().toString(36).substring(2)}.old`;
|
|
32
|
+
try {
|
|
33
|
+
fs.renameSync(lockPath, tempLockPath);
|
|
34
|
+
fs.unlinkSync(tempLockPath);
|
|
35
|
+
} catch {
|
|
36
|
+
// If rename failed, it means another agent already evicting/deleting it.
|
|
37
|
+
// Do not delete anything else; proceed and let writeFileSync (wx flag) fail if a new lock exists.
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Use 'wx' flag for atomic file creation
|
|
42
|
+
const lockData = JSON.stringify({ agent, timestamp: new Date().toISOString() });
|
|
43
|
+
fs.writeFileSync(lockPath, lockData, { flag: "wx" });
|
|
44
|
+
|
|
45
|
+
return {
|
|
46
|
+
content: [{ type: "text", text: `✅ Lock acquired for resource '${resource}' by ${agent}.` }]
|
|
47
|
+
};
|
|
48
|
+
} catch (e) {
|
|
49
|
+
const error = e as { code?: string };
|
|
50
|
+
if (error.code === "EEXIST") {
|
|
51
|
+
return {
|
|
52
|
+
isError: true,
|
|
53
|
+
content: [{ type: "text", text: `Resource '${resource}' was just acquired by another agent.` }]
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
isError: true,
|
|
58
|
+
content: [{ type: "text", text: `Failed to acquire lock: ${String(e)}` }]
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Handles releasing a lock.
|
|
65
|
+
*/
|
|
66
|
+
export async function handleReleaseLock(projectRoot: string, args: ReleaseLockArgs): Promise<ToolResult> {
|
|
67
|
+
const { resource, agent } = args;
|
|
68
|
+
const frameworkDir = resolveFrameworkDir(projectRoot);
|
|
69
|
+
const lockPath = path.join(projectRoot, frameworkDir, "locks", `${resource}.lock`);
|
|
70
|
+
|
|
71
|
+
try {
|
|
72
|
+
if (!fs.existsSync(lockPath)) {
|
|
73
|
+
return { content: [{ type: "text", text: `ℹ️ No lock found for resource '${resource}'.` }] };
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const lockData = JSON.parse(fs.readFileSync(lockPath, "utf8"));
|
|
77
|
+
if (lockData.agent !== agent) {
|
|
78
|
+
return {
|
|
79
|
+
isError: true,
|
|
80
|
+
content: [{ type: "text", text: `❌ Denied: You do not own the lock for '${resource}'. Owned by ${lockData.agent}.` }]
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
fs.unlinkSync(lockPath);
|
|
85
|
+
return { content: [{ type: "text", text: `✅ Lock released for resource '${resource}' by ${agent}.` }] };
|
|
86
|
+
} catch (e) {
|
|
87
|
+
return { isError: true, content: [{ type: "text", text: `Failed to release lock: ${String(e)}` }] };
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { ToolResult, RegisterAgentArgs } from "../types.js";
|
|
4
|
+
import { resolveFrameworkDir } from "../../utils/security.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Handles agent registration with the Control Plane.
|
|
8
|
+
* This can be used to validate permissions and active status.
|
|
9
|
+
*/
|
|
10
|
+
export async function handleRegisterAgent(projectRoot: string, args: RegisterAgentArgs): Promise<ToolResult> {
|
|
11
|
+
const { agent, role, capability = 5 } = args;
|
|
12
|
+
const frameworkDir = resolveFrameworkDir(projectRoot);
|
|
13
|
+
const registryDir = path.join(projectRoot, frameworkDir, "registry");
|
|
14
|
+
const agentFile = path.join(registryDir, `${agent.replace("@", "")}_active.json`);
|
|
15
|
+
|
|
16
|
+
try {
|
|
17
|
+
if (!fs.existsSync(registryDir)) fs.mkdirSync(registryDir, { recursive: true });
|
|
18
|
+
|
|
19
|
+
const agentData = {
|
|
20
|
+
agent,
|
|
21
|
+
role,
|
|
22
|
+
capability,
|
|
23
|
+
last_seen: new Date().toISOString(),
|
|
24
|
+
status: "ACTIVE"
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
fs.writeFileSync(agentFile, JSON.stringify(agentData, null, 2));
|
|
28
|
+
|
|
29
|
+
return {
|
|
30
|
+
content: [{ type: "text", text: `🎖️ Agent ${agent} (${role}) registered successfully in the Atabey Control Plane.` }]
|
|
31
|
+
};
|
|
32
|
+
} catch (e) {
|
|
33
|
+
return {
|
|
34
|
+
isError: true,
|
|
35
|
+
content: [{ type: "text", text: `Failed to register agent: ${String(e)}` }]
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|