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 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { execFileSync } from "child_process";
|
|
2
|
+
/**
|
|
3
|
+
* Executes a CLI command safely using execFileSync (no shell injection risk).
|
|
4
|
+
* Captures stderr gracefully to prevent stream crashes.
|
|
5
|
+
*/
|
|
6
|
+
export function safeExec(command, args, cwd, timeout) {
|
|
7
|
+
try {
|
|
8
|
+
return execFileSync(command, args, {
|
|
9
|
+
cwd,
|
|
10
|
+
encoding: "utf8",
|
|
11
|
+
timeout: timeout || 30000,
|
|
12
|
+
maxBuffer: 1024 * 1024,
|
|
13
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
const err = error;
|
|
18
|
+
throw new Error(err.stderr || err.message || "Command execution failed", { cause: error });
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
/**
|
|
3
|
+
* Enterprise Compliance Guardrail
|
|
4
|
+
* Checks content against corporate standards using AST analysis before allowing file mutations.
|
|
5
|
+
*/
|
|
6
|
+
export function verifyCorporateCompliance(content, filePath) {
|
|
7
|
+
// Skip compliance checks for non-source files or specific ignored files
|
|
8
|
+
if (filePath.endsWith(".json") || filePath.endsWith(".md") || filePath.endsWith(".env.example")) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const sourceFile = ts.createSourceFile(filePath, content, ts.ScriptTarget.Latest, true);
|
|
12
|
+
const errors = [];
|
|
13
|
+
/**
|
|
14
|
+
* Recursive AST Visitor
|
|
15
|
+
*/
|
|
16
|
+
function visit(node) {
|
|
17
|
+
// 1. Zero Console Policy
|
|
18
|
+
if (ts.isPropertyAccessExpression(node)) {
|
|
19
|
+
const expression = node.expression;
|
|
20
|
+
const name = node.name.text;
|
|
21
|
+
if (ts.isIdentifier(expression) && expression.text === "console") {
|
|
22
|
+
if (["log", "warn", "error"].includes(name)) {
|
|
23
|
+
// Check if file is exempt
|
|
24
|
+
if (!filePath.includes("logger.ts") && !filePath.includes("check.ts") && !filePath.includes("cli.ts")) {
|
|
25
|
+
errors.push(`❌ Corporate Compliance Breach: 'console.${name}' usage is forbidden at line ${sourceFile.getLineAndCharacterOfPosition(node.getStart()).line + 1}.`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
// 2. No Explicit Any Policy
|
|
31
|
+
if (ts.isTypeReferenceNode(node)) {
|
|
32
|
+
if (ts.isIdentifier(node.typeName) && node.typeName.text === "any") {
|
|
33
|
+
if (!filePath.includes("definitions.ts") && !filePath.includes("types.ts")) {
|
|
34
|
+
errors.push(`❌ Corporate Compliance Breach: 'any' type is forbidden at line ${sourceFile.getLineAndCharacterOfPosition(node.getStart()).line + 1}.`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
// 3. Zero UI Library Policy (No @chakra-ui, mui, @shadcn)
|
|
39
|
+
if (ts.isImportDeclaration(node)) {
|
|
40
|
+
const moduleSpecifier = node.moduleSpecifier;
|
|
41
|
+
if (ts.isStringLiteral(moduleSpecifier)) {
|
|
42
|
+
const forbiddenLibs = ["@chakra-ui", "mui", "@shadcn", "antd", "bootstrap"];
|
|
43
|
+
const lib = forbiddenLibs.find(l => moduleSpecifier.text.includes(l));
|
|
44
|
+
if (lib) {
|
|
45
|
+
errors.push(`❌ Corporate Compliance Breach: External UI library '${lib}' usage is FORBIDDEN at line ${sourceFile.getLineAndCharacterOfPosition(node.getStart()).line + 1}. Build atomic components manually instead.`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
// Handle 'any' as a keyword type (e.g., parameter: any)
|
|
50
|
+
if (node.kind === ts.SyntaxKind.AnyKeyword) {
|
|
51
|
+
if (!filePath.includes("definitions.ts") && !filePath.includes("types.ts")) {
|
|
52
|
+
errors.push(`❌ Corporate Compliance Breach: 'any' keyword is forbidden at line ${sourceFile.getLineAndCharacterOfPosition(node.getStart()).line + 1}.`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
ts.forEachChild(node, visit);
|
|
56
|
+
}
|
|
57
|
+
visit(sourceFile);
|
|
58
|
+
// 3. Hardcoded Secrets & PII Guard
|
|
59
|
+
const piiKeywords = [
|
|
60
|
+
{ regex: /API_KEY\s*=\s*['"][^'"]+['"]/i, msg: "Hardcoded API Key" },
|
|
61
|
+
{ regex: /SECRET\s*=\s*['"][^'"]+['"]/i, msg: "Hardcoded Secret" },
|
|
62
|
+
{ regex: /PASSWORD\s*=\s*['"][^'"]+['"]/i, msg: "Hardcoded Password" },
|
|
63
|
+
{ regex: /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/, msg: "PII Detected: Email Address" },
|
|
64
|
+
{ regex: /\b\d{4}[- ]?\d{4}[- ]?\d{4}[- ]?\d{4}\b/, msg: "PII Detected: Credit Card Pattern" }
|
|
65
|
+
];
|
|
66
|
+
for (const { regex, msg } of piiKeywords) {
|
|
67
|
+
if (regex.test(content)) {
|
|
68
|
+
// Allow emails in specific files like README or package.json
|
|
69
|
+
if (msg.includes("Email") && (filePath.endsWith("README.md") || filePath.endsWith("package.json") || filePath.includes("CONTRIBUTING"))) {
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
errors.push(`❌ Corporate Compliance Breach: ${msg} detected.`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (errors.length > 0) {
|
|
76
|
+
throw new Error(errors.join("\n"));
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
/**
|
|
4
|
+
* Ensures directory existence.
|
|
5
|
+
*/
|
|
6
|
+
export function ensureDir(dirPath) {
|
|
7
|
+
if (!fs.existsSync(dirPath)) {
|
|
8
|
+
fs.mkdirSync(dirPath, { recursive: true });
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Atomically writes a text file.
|
|
13
|
+
*/
|
|
14
|
+
export function writeTextFileAtomic(filePath, content) {
|
|
15
|
+
const dir = path.dirname(filePath);
|
|
16
|
+
ensureDir(dir);
|
|
17
|
+
const tempPath = `${filePath}.${Math.random().toString(36).slice(2, 9)}.tmp`;
|
|
18
|
+
const finalContent = content.endsWith("\n") ? content : `${content}\n`;
|
|
19
|
+
try {
|
|
20
|
+
fs.writeFileSync(tempPath, finalContent, "utf8");
|
|
21
|
+
fs.renameSync(tempPath, filePath);
|
|
22
|
+
}
|
|
23
|
+
catch (err) {
|
|
24
|
+
if (fs.existsSync(tempPath)) {
|
|
25
|
+
try {
|
|
26
|
+
fs.unlinkSync(tempPath);
|
|
27
|
+
}
|
|
28
|
+
catch { /* ignore */ }
|
|
29
|
+
}
|
|
30
|
+
throw err;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Atomically appends to a file (if supported by OS) or simulates it.
|
|
35
|
+
* Note: Real atomic append on POSIX is a single write() call with O_APPEND.
|
|
36
|
+
* For simplicity and robustness across platforms, we use a simple append here
|
|
37
|
+
* as the risk of corruption is lower than a full rewrite, but for logs
|
|
38
|
+
* it's acceptable.
|
|
39
|
+
*/
|
|
40
|
+
export function appendFileSafe(filePath, content) {
|
|
41
|
+
const dir = path.dirname(filePath);
|
|
42
|
+
ensureDir(dir);
|
|
43
|
+
fs.appendFileSync(filePath, content, "utf8");
|
|
44
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { resolveFrameworkDir } from "./security.js";
|
|
4
|
+
export const Metrics = {
|
|
5
|
+
/**
|
|
6
|
+
* Estimates tokens based on character count (rough heuristic: 1 token ~= 4 chars).
|
|
7
|
+
*/
|
|
8
|
+
estimateTokens: (text) => {
|
|
9
|
+
return Math.ceil(text.length / 4);
|
|
10
|
+
},
|
|
11
|
+
/**
|
|
12
|
+
* Logs the token usage and action to the observability metrics file.
|
|
13
|
+
*/
|
|
14
|
+
logUsage: (projectRoot, agent, action, tokens) => {
|
|
15
|
+
Metrics.saveMetric(projectRoot, {
|
|
16
|
+
timestamp: new Date().toISOString(),
|
|
17
|
+
agent,
|
|
18
|
+
action,
|
|
19
|
+
estimatedTokens: tokens
|
|
20
|
+
});
|
|
21
|
+
},
|
|
22
|
+
/**
|
|
23
|
+
* Logs an error occurrence to the observability metrics file.
|
|
24
|
+
*/
|
|
25
|
+
logError: (projectRoot, agent, action, error) => {
|
|
26
|
+
Metrics.saveMetric(projectRoot, {
|
|
27
|
+
timestamp: new Date().toISOString(),
|
|
28
|
+
agent,
|
|
29
|
+
action: `ERROR: ${action}`,
|
|
30
|
+
estimatedTokens: 0,
|
|
31
|
+
error
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
/**
|
|
35
|
+
* Internal helper to save metric entries.
|
|
36
|
+
*/
|
|
37
|
+
saveMetric: (projectRoot, entry) => {
|
|
38
|
+
const frameworkDir = resolveFrameworkDir(projectRoot);
|
|
39
|
+
const metricsPath = path.join(projectRoot, frameworkDir, "observability/metrics.json");
|
|
40
|
+
try {
|
|
41
|
+
const metricsDir = path.dirname(metricsPath);
|
|
42
|
+
if (!fs.existsSync(metricsDir))
|
|
43
|
+
fs.mkdirSync(metricsDir, { recursive: true });
|
|
44
|
+
let currentMetrics = [];
|
|
45
|
+
if (fs.existsSync(metricsPath)) {
|
|
46
|
+
currentMetrics = JSON.parse(fs.readFileSync(metricsPath, "utf8"));
|
|
47
|
+
}
|
|
48
|
+
currentMetrics.push(entry);
|
|
49
|
+
// Keep only last 100 entries to save space
|
|
50
|
+
if (currentMetrics.length > 100)
|
|
51
|
+
currentMetrics.shift();
|
|
52
|
+
fs.writeFileSync(metricsPath, JSON.stringify(currentMetrics, null, 2));
|
|
53
|
+
}
|
|
54
|
+
catch { /* ignore: metrics should not block the main process */ }
|
|
55
|
+
}
|
|
56
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import { FRAMEWORK, MCP, UNIFIED_HUB_DIR } from "../constants.js"; // New import
|
|
4
|
+
import os from "os"; // Need os.homedir()
|
|
5
|
+
/**
|
|
6
|
+
* Validates and resolves a user-provided path to prevent path traversal attacks.
|
|
7
|
+
* Ensures the resolved path stays within the project root boundary.
|
|
8
|
+
*/
|
|
9
|
+
export function safePath(projectRoot, userPath) {
|
|
10
|
+
const resolved = path.resolve(projectRoot, userPath);
|
|
11
|
+
const normalizedRoot = path.resolve(projectRoot);
|
|
12
|
+
if (!resolved.startsWith(normalizedRoot + path.sep) && resolved !== normalizedRoot) {
|
|
13
|
+
throw new Error(`Access denied: path "${userPath}" escapes project root.`);
|
|
14
|
+
}
|
|
15
|
+
return resolved;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Resolves the active framework directory.
|
|
19
|
+
* Priority: ATABEY_TEST_DIR (env) -> package.json `atabey.frameworkDir` -> `.atabey` -> other adapter dirs -> global HOME.
|
|
20
|
+
*/
|
|
21
|
+
export function resolveFrameworkDir(projectRoot) {
|
|
22
|
+
// For test environments, use the explicitly set test directory.
|
|
23
|
+
const testDir = process.env[MCP.TEST_DIR_ENV];
|
|
24
|
+
if (testDir)
|
|
25
|
+
return testDir;
|
|
26
|
+
// 1. Authoritative source: read from package.json if present
|
|
27
|
+
try {
|
|
28
|
+
const pkgPath = path.join(projectRoot, "package.json");
|
|
29
|
+
if (fs.existsSync(pkgPath)) {
|
|
30
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
|
|
31
|
+
const atabeyConfig = pkg["atabey"];
|
|
32
|
+
if (atabeyConfig && typeof atabeyConfig["frameworkDir"] === "string") {
|
|
33
|
+
// Ensure the path is relative if it's within the project, otherwise use as-is.
|
|
34
|
+
const resolvedDir = path.resolve(projectRoot, atabeyConfig["frameworkDir"]);
|
|
35
|
+
if (resolvedDir.startsWith(path.resolve(projectRoot))) {
|
|
36
|
+
return path.relative(projectRoot, resolvedDir);
|
|
37
|
+
}
|
|
38
|
+
return atabeyConfig["frameworkDir"];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
// ignore — fall through to filesystem scan
|
|
44
|
+
}
|
|
45
|
+
// 2. Filesystem scan in projectRoot for common framework directories
|
|
46
|
+
const localCandidates = [
|
|
47
|
+
FRAMEWORK.CORE_DIR, // .atabey
|
|
48
|
+
UNIFIED_HUB_DIR, // .agents
|
|
49
|
+
// Add other adapter specific directories if needed, or remove if unified is strictly enforced
|
|
50
|
+
];
|
|
51
|
+
for (const candidate of localCandidates) {
|
|
52
|
+
const candidatePath = path.join(projectRoot, candidate);
|
|
53
|
+
if (fs.existsSync(candidatePath)) {
|
|
54
|
+
return candidate;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
// 3. Fallback to global home directory.
|
|
58
|
+
const homeDir = os.homedir();
|
|
59
|
+
return path.join(homeDir, FRAMEWORK.CORE_DIR);
|
|
60
|
+
}
|