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,48 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Standard Color Palette Schema
|
|
5
|
+
*/
|
|
6
|
+
export const ColorPaletteSchema = z.object({
|
|
7
|
+
primary: z.string().regex(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/),
|
|
8
|
+
secondary: z.string().regex(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/),
|
|
9
|
+
accent: z.string().regex(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Agent Atabey config.json Schema
|
|
14
|
+
*/
|
|
15
|
+
export const ConfigSchema = z.object({
|
|
16
|
+
name: z.string().default("Agent Atabey"),
|
|
17
|
+
version: z.string(),
|
|
18
|
+
frameworkDir: z.string().optional(),
|
|
19
|
+
theme: z.object({
|
|
20
|
+
palette: z.string(),
|
|
21
|
+
colors: ColorPaletteSchema
|
|
22
|
+
}).optional(),
|
|
23
|
+
paths: z.object({
|
|
24
|
+
backend: z.string(),
|
|
25
|
+
frontend: z.string(),
|
|
26
|
+
docs: z.string(),
|
|
27
|
+
tests: z.string(),
|
|
28
|
+
}).default({
|
|
29
|
+
backend: "apps/backend",
|
|
30
|
+
frontend: "apps/web",
|
|
31
|
+
docs: "docs",
|
|
32
|
+
tests: "tests"
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* MCP mcp.json Schema
|
|
38
|
+
*/
|
|
39
|
+
export const McpConfigSchema = z.object({
|
|
40
|
+
mcpServers: z.record(z.object({
|
|
41
|
+
command: z.string(),
|
|
42
|
+
args: z.array(z.string()),
|
|
43
|
+
env: z.record(z.string()).optional()
|
|
44
|
+
}))
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export type AtabeyConfig = z.infer<typeof ConfigSchema>;
|
|
48
|
+
export type McpConfig = z.infer<typeof McpConfigSchema>;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import crypto from "crypto";
|
|
4
|
+
|
|
5
|
+
import { remapFrameworkContent } from "../adapters/index.js"; // Import from the new adapters.js
|
|
6
|
+
import type { AdapterId } from "../adapters/index.js";
|
|
7
|
+
import { ensureDir, writeTextFile, writeJsonFile, appendFile } from "../../shared/fs.js";
|
|
8
|
+
|
|
9
|
+
export { ensureDir, writeTextFile, writeJsonFile, appendFile };
|
|
10
|
+
|
|
11
|
+
export function updateGitIgnore(targetPath: string, frameworkDir = ".atabey", dryRun = false): void {
|
|
12
|
+
const IGNORE_LINES = [
|
|
13
|
+
"# Agent Atabey",
|
|
14
|
+
`${frameworkDir}/logs/*.json`,
|
|
15
|
+
`${frameworkDir}/*.lock`,
|
|
16
|
+
`${frameworkDir}/memory/`,
|
|
17
|
+
".env",
|
|
18
|
+
".DS_Store",
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
let content = "";
|
|
22
|
+
if (fs.existsSync(targetPath)) {
|
|
23
|
+
content = fs.readFileSync(targetPath, "utf8");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const lines = content.split("\n").map((l) => l.trim());
|
|
27
|
+
let added = false;
|
|
28
|
+
|
|
29
|
+
for (const line of IGNORE_LINES) {
|
|
30
|
+
if (!lines.includes(line)) {
|
|
31
|
+
content += (content.endsWith("\n") || content === "" ? "" : "\n") + line + "\n";
|
|
32
|
+
added = true;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (added) {
|
|
37
|
+
if (dryRun) {
|
|
38
|
+
console.warn(`[DRY RUN] Would update .gitignore at ${targetPath}`);
|
|
39
|
+
} else {
|
|
40
|
+
writeTextFile(targetPath, content);
|
|
41
|
+
console.warn("✅ .gitignore updated.");
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
interface SanitizeJsonFunction {
|
|
48
|
+
(obj: unknown, targetScope?: string): unknown;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function copyDir(
|
|
52
|
+
src: string,
|
|
53
|
+
dest: string,
|
|
54
|
+
skipSet = new Set<string>(),
|
|
55
|
+
nonDestructive = false,
|
|
56
|
+
frameworkDir = ".gemini",
|
|
57
|
+
targetScope = "",
|
|
58
|
+
sanitizeJson: SanitizeJsonFunction,
|
|
59
|
+
adapterId: AdapterId = "gemini",
|
|
60
|
+
dryRun = false,
|
|
61
|
+
): void {
|
|
62
|
+
const DEFAULT_SKIP = new Set(["node_modules", ".git", ".DS_Store", "package-lock.json"]);
|
|
63
|
+
const actualSkip = new Set([...DEFAULT_SKIP, ...skipSet]);
|
|
64
|
+
|
|
65
|
+
if (!fs.existsSync(dest) && !dryRun) {
|
|
66
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
fs.readdirSync(src, { withFileTypes: true }).forEach((entry) => {
|
|
70
|
+
if (actualSkip.has(entry.name)) return;
|
|
71
|
+
|
|
72
|
+
const srcPath = path.join(src, entry.name);
|
|
73
|
+
|
|
74
|
+
// Physical folder remapping during copy.
|
|
75
|
+
// In unified mode (frameworkDir === ".atabey") folder names are always standard —
|
|
76
|
+
// agents/ stays agents/, knowledge/ stays knowledge/.
|
|
77
|
+
// Only remap when using a legacy non-unified adapter directory.
|
|
78
|
+
let effectiveEntryName = entry.name;
|
|
79
|
+
if (entry.isDirectory() && frameworkDir !== ".atabey") {
|
|
80
|
+
if (entry.name === "agents") {
|
|
81
|
+
if (adapterId === "antigravity-cli") effectiveEntryName = "skills";
|
|
82
|
+
else if (adapterId === "grok") effectiveEntryName = "plugins";
|
|
83
|
+
} else if (entry.name === "knowledge") {
|
|
84
|
+
if (adapterId === "antigravity-cli") effectiveEntryName = "rules";
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const destPath = path.join(dest, effectiveEntryName);
|
|
89
|
+
|
|
90
|
+
if (entry.isDirectory()) {
|
|
91
|
+
copyDir(
|
|
92
|
+
srcPath,
|
|
93
|
+
destPath,
|
|
94
|
+
skipSet,
|
|
95
|
+
nonDestructive,
|
|
96
|
+
frameworkDir,
|
|
97
|
+
targetScope,
|
|
98
|
+
sanitizeJson,
|
|
99
|
+
adapterId,
|
|
100
|
+
dryRun,
|
|
101
|
+
);
|
|
102
|
+
} else {
|
|
103
|
+
if (nonDestructive && fs.existsSync(destPath)) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const ext = path.extname(entry.name);
|
|
108
|
+
const textExtensions = [".md", ".json", ".js", ".ts", ".txt", ""];
|
|
109
|
+
|
|
110
|
+
if (textExtensions.includes(ext)) {
|
|
111
|
+
let content = fs.readFileSync(srcPath, "utf8");
|
|
112
|
+
content = remapFrameworkContent(content, frameworkDir, adapterId); // Use the new remap function
|
|
113
|
+
|
|
114
|
+
if (ext === ".json") {
|
|
115
|
+
try {
|
|
116
|
+
const json = JSON.parse(content);
|
|
117
|
+
writeJsonFile(destPath, sanitizeJson(json, targetScope), dryRun);
|
|
118
|
+
} catch {
|
|
119
|
+
const fallback = content.replace(/workspace:[^"'\s]*/g, "*");
|
|
120
|
+
writeTextFile(destPath, fallback, dryRun);
|
|
121
|
+
}
|
|
122
|
+
} else {
|
|
123
|
+
content = content.replace(/workspace:[^"'\s]*/g, "*");
|
|
124
|
+
content = remapFrameworkContent(content, frameworkDir, adapterId); // Apply remap once to the final content
|
|
125
|
+
writeTextFile(destPath, content, dryRun);
|
|
126
|
+
}
|
|
127
|
+
} else {
|
|
128
|
+
if (dryRun) {
|
|
129
|
+
console.warn(`[DRY RUN] Would copy binary file: ${destPath}`);
|
|
130
|
+
} else {
|
|
131
|
+
fs.copyFileSync(srcPath, destPath);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export function collectFiles(dir: string, extensions: string[]): string[] {
|
|
139
|
+
let results: string[] = [];
|
|
140
|
+
if (!fs.existsSync(dir)) return results;
|
|
141
|
+
const list = fs.readdirSync(dir);
|
|
142
|
+
list.forEach((file) => {
|
|
143
|
+
file = path.join(dir, file);
|
|
144
|
+
const stat = fs.statSync(file);
|
|
145
|
+
if (stat && stat.isDirectory()) {
|
|
146
|
+
if (!file.includes("node_modules") && !file.includes(".git")) {
|
|
147
|
+
results = results.concat(collectFiles(file, extensions));
|
|
148
|
+
}
|
|
149
|
+
} else if (extensions.includes(path.extname(file))) {
|
|
150
|
+
results.push(file);
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
return results;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export function computeTypesHash(projectRoot: string, sharedDir: string): string {
|
|
157
|
+
const walk = (d: string): string[] => fs.readdirSync(d, { withFileTypes: true }).flatMap((e) => {
|
|
158
|
+
const fullPath = path.join(d, e.name);
|
|
159
|
+
return e.isDirectory() ? walk(fullPath) : (e.name.endsWith(".ts") ? [fullPath] : []);
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
const hash = crypto.createHash("sha256");
|
|
163
|
+
for (const filePath of walk(sharedDir).sort()) {
|
|
164
|
+
hash.update(path.relative(projectRoot, filePath));
|
|
165
|
+
hash.update("\0");
|
|
166
|
+
hash.update(fs.readFileSync(filePath));
|
|
167
|
+
hash.update("\0");
|
|
168
|
+
}
|
|
169
|
+
return hash.digest("hex");
|
|
170
|
+
}
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import os from "os";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import { logger } from "../../shared/logger.js";
|
|
5
|
+
import { ensureDir, writeTextFile, writeJsonFile } from "../../shared/fs.js";
|
|
6
|
+
import { StateSchema, AgentStatusSchema, TaskSchema } from "./schemas.js";
|
|
7
|
+
import type { TraceID } from "../../shared/types.js";
|
|
8
|
+
import {
|
|
9
|
+
FRAMEWORK,
|
|
10
|
+
FRAMEWORK_DIR_CANDIDATES,
|
|
11
|
+
MCP,
|
|
12
|
+
} from "../../shared/constants.js";
|
|
13
|
+
|
|
14
|
+
export { generateULID } from "./time.js";
|
|
15
|
+
|
|
16
|
+
const CWD = process.cwd();
|
|
17
|
+
const HOME = os.homedir();
|
|
18
|
+
|
|
19
|
+
function findFrameworkDir(basePath: string): string | null {
|
|
20
|
+
try {
|
|
21
|
+
const pkgPath = path.join(basePath, "package.json");
|
|
22
|
+
if (fs.existsSync(pkgPath)) {
|
|
23
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
|
|
24
|
+
if (pkg.atabey && typeof pkg.atabey.frameworkDir === "string") {
|
|
25
|
+
const customDir = path.join(basePath, pkg.atabey.frameworkDir);
|
|
26
|
+
if (fs.existsSync(customDir)) return customDir;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
} catch (err) {
|
|
30
|
+
logger.debug("Failed to read package.json in findFrameworkDir", err);
|
|
31
|
+
}
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function isFrameworkDevelopmentRepo(): boolean {
|
|
36
|
+
try {
|
|
37
|
+
const pkgPath = path.join(CWD, "package.json");
|
|
38
|
+
if (fs.existsSync(pkgPath)) {
|
|
39
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
|
|
40
|
+
if (pkg.name === "atabey") {
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
} catch (err) {
|
|
45
|
+
logger.debug("Failed to read package.json in isFrameworkDevelopmentRepo", err);
|
|
46
|
+
}
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function getLocalFrameworkDir(): string {
|
|
51
|
+
const localDir = findFrameworkDir(CWD);
|
|
52
|
+
return localDir || path.join(CWD, FRAMEWORK.CORE_DIR);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function getConfigDir(): string {
|
|
56
|
+
const localDir = findFrameworkDir(CWD);
|
|
57
|
+
if (localDir) return localDir;
|
|
58
|
+
|
|
59
|
+
// Check for standard local directories if package.json doesn't specify
|
|
60
|
+
const localCandidates = [...FRAMEWORK_DIR_CANDIDATES, ".agent"] as string[];
|
|
61
|
+
for (const cand of localCandidates) {
|
|
62
|
+
const p = path.join(CWD, cand);
|
|
63
|
+
if (fs.existsSync(p)) return p;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// In dev repo, don't fall back to global dir. Point to local default.
|
|
67
|
+
if (isFrameworkDevelopmentRepo()) {
|
|
68
|
+
return path.join(CWD, FRAMEWORK.CORE_DIR);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return path.join(HOME, FRAMEWORK.CORE_DIR);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function getFrameworkDir(): string {
|
|
75
|
+
const testDir = process.env[MCP.TEST_DIR_ENV];
|
|
76
|
+
if (testDir) return testDir;
|
|
77
|
+
return getConfigDir();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function getDocumentStorePath() {
|
|
81
|
+
const frameworkDir = getFrameworkDir();
|
|
82
|
+
return path.join(frameworkDir, "memory");
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function initDocumentStore(frameworkDir?: string) {
|
|
86
|
+
const storePath = frameworkDir ? path.join(frameworkDir, "memory") : getDocumentStorePath();
|
|
87
|
+
ensureDir(storePath);
|
|
88
|
+
ensureDir(path.join(storePath, "tasks"));
|
|
89
|
+
ensureDir(path.join(storePath, "history"));
|
|
90
|
+
|
|
91
|
+
const stateFile = path.join(storePath, "state.json");
|
|
92
|
+
if (!fs.existsSync(stateFile)) {
|
|
93
|
+
writeJsonFile(stateFile, { phase: "PHASE_0", traceId: "T-000", managerState: "ACTIVE" });
|
|
94
|
+
}
|
|
95
|
+
const statusFile = path.join(storePath, "status.json");
|
|
96
|
+
if (!fs.existsSync(statusFile)) {
|
|
97
|
+
writeJsonFile(statusFile, {});
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Ensure the initial Markdown view is created
|
|
101
|
+
syncMarkdownMemory(frameworkDir);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export function readState() {
|
|
105
|
+
const statePath = path.join(getDocumentStorePath(), "state.json");
|
|
106
|
+
if (!fs.existsSync(statePath)) return null;
|
|
107
|
+
return JSON.parse(fs.readFileSync(statePath, "utf8"));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export function readStatus() {
|
|
111
|
+
const statusPath = path.join(getDocumentStorePath(), "status.json");
|
|
112
|
+
if (!fs.existsSync(statusPath)) return {};
|
|
113
|
+
return JSON.parse(fs.readFileSync(statusPath, "utf8"));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export function listTasks() {
|
|
117
|
+
const tasksPath = path.join(getDocumentStorePath(), "tasks");
|
|
118
|
+
if (!fs.existsSync(tasksPath)) return [];
|
|
119
|
+
|
|
120
|
+
return fs.readdirSync(tasksPath)
|
|
121
|
+
.filter(f => f.endsWith(".json"))
|
|
122
|
+
.map(f => JSON.parse(fs.readFileSync(path.join(tasksPath, f), "utf8")));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export function getMemoryPath(): string {
|
|
126
|
+
return path.join(getDocumentStorePath(), "state.json");
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export function readActiveTraceId(memoryContent: string): string | null {
|
|
130
|
+
try {
|
|
131
|
+
const state = JSON.parse(memoryContent);
|
|
132
|
+
return state.traceId || null;
|
|
133
|
+
} catch (_e) { /* ignore */
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export function updateProjectMemory(section: string, content: string) {
|
|
139
|
+
if (section === "HISTORY") {
|
|
140
|
+
updateDocumentStore("history", { content }, new Date().toISOString().replace(/[:.]/g, "-"));
|
|
141
|
+
} else {
|
|
142
|
+
const state = readState() || {};
|
|
143
|
+
state[section] = content;
|
|
144
|
+
updateDocumentStore("state", state);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export function initializeMemory(memoryPathOrBase: string, targetBaseOrDryRun?: string | boolean): void {
|
|
149
|
+
const targetBase = typeof targetBaseOrDryRun === "string" ? targetBaseOrDryRun : memoryPathOrBase;
|
|
150
|
+
initDocumentStore(targetBase);
|
|
151
|
+
logger.info("✅ Document store initialized.");
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export function getConfiguredPaths(): { backend: string; frontend: string; mobile: string; docs: string; tests: string } {
|
|
155
|
+
const defaultPaths = { backend: "apps/backend", frontend: "apps/web", mobile: "apps/mobile", docs: "docs", tests: "tests" };
|
|
156
|
+
try {
|
|
157
|
+
const frameworkDir = getConfigDir();
|
|
158
|
+
const configPath = path.join(frameworkDir, "config.json");
|
|
159
|
+
if (fs.existsSync(configPath)) {
|
|
160
|
+
const rawConfig = JSON.parse(fs.readFileSync(configPath, "utf8"));
|
|
161
|
+
return rawConfig.paths || defaultPaths;
|
|
162
|
+
}
|
|
163
|
+
} catch (err) {
|
|
164
|
+
logger.debug("Critical config read failure", err);
|
|
165
|
+
}
|
|
166
|
+
return defaultPaths;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export function updateDocumentStore(type: "state" | "task" | "history" | "status", data: unknown, id?: string | TraceID, frameworkDir?: string) {
|
|
170
|
+
const storePath = frameworkDir ? path.join(frameworkDir, "memory") : getDocumentStorePath();
|
|
171
|
+
ensureDir(storePath);
|
|
172
|
+
|
|
173
|
+
switch (type) {
|
|
174
|
+
case "state":
|
|
175
|
+
StateSchema.parse(data);
|
|
176
|
+
writeJsonFile(path.join(storePath, "state.json"), data);
|
|
177
|
+
break;
|
|
178
|
+
case "status":
|
|
179
|
+
AgentStatusSchema.parse(data);
|
|
180
|
+
writeJsonFile(path.join(storePath, "status.json"), data);
|
|
181
|
+
break;
|
|
182
|
+
case "task":
|
|
183
|
+
TaskSchema.parse(data);
|
|
184
|
+
ensureDir(path.join(storePath, "tasks"));
|
|
185
|
+
writeJsonFile(path.join(storePath, "tasks", `${id}.json`), data);
|
|
186
|
+
break;
|
|
187
|
+
case "history":
|
|
188
|
+
ensureDir(path.join(storePath, "history"));
|
|
189
|
+
writeJsonFile(path.join(storePath, "history", `${id}.json`), data);
|
|
190
|
+
break;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// Auto-sync Markdown view after any change
|
|
194
|
+
syncMarkdownMemory(frameworkDir);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Single Source of Truth Bridge: JSON -> Markdown
|
|
199
|
+
* Regenerates PROJECT_MEMORY.md from structured state.
|
|
200
|
+
*/
|
|
201
|
+
export function syncMarkdownMemory(fDir?: string) {
|
|
202
|
+
const frameworkDir = fDir || getFrameworkDir();
|
|
203
|
+
const storePath = path.join(frameworkDir, "memory");
|
|
204
|
+
const mdPath = path.join(storePath, "PROJECT_MEMORY.md");
|
|
205
|
+
|
|
206
|
+
try {
|
|
207
|
+
const state = readState();
|
|
208
|
+
const status = readStatus();
|
|
209
|
+
const tasks = listTasks();
|
|
210
|
+
|
|
211
|
+
if (!state) return;
|
|
212
|
+
|
|
213
|
+
const lines = [
|
|
214
|
+
"# 🧠 Agent Atabey — Project Memory",
|
|
215
|
+
"",
|
|
216
|
+
"## 📍 Current State",
|
|
217
|
+
`- **Phase:** ${state.phase || "PHASE_0"}`,
|
|
218
|
+
`- **Trace ID:** ${state.traceId || "N/A"}`,
|
|
219
|
+
`- **@manager state:** ${state.managerState || "ACTIVE"}`,
|
|
220
|
+
];
|
|
221
|
+
|
|
222
|
+
// Add custom sections from state
|
|
223
|
+
const internalFields = ["phase", "traceId", "managerState"];
|
|
224
|
+
Object.entries(state).forEach(([key, value]) => {
|
|
225
|
+
if (!internalFields.includes(key) && value) {
|
|
226
|
+
lines.push("", `## 📌 ${key}`, String(value));
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
lines.push(
|
|
231
|
+
"",
|
|
232
|
+
"## 📋 Active Tasks",
|
|
233
|
+
"| Trace ID | Task | Agent | Priority | Status |",
|
|
234
|
+
"| :--- | :--- | :--- | :--- | :--- |",
|
|
235
|
+
);
|
|
236
|
+
|
|
237
|
+
tasks.forEach(t => {
|
|
238
|
+
if (t.status !== "COMPLETED") {
|
|
239
|
+
lines.push(`| ${t.traceId} | ${t.description} | ${t.agent} | ${t.priority} | ${t.status} |`);
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
lines.push("", "## 🤖 Agent Statuses");
|
|
244
|
+
lines.push("| Agent | State | Active Task | Last Updated |");
|
|
245
|
+
lines.push("| :--- | :--- | :--- | :--- |");
|
|
246
|
+
|
|
247
|
+
for (const [agent, info] of Object.entries(status)) {
|
|
248
|
+
const data = info as { state: string; task: string; lastUpdated?: string };
|
|
249
|
+
lines.push(`| @${agent} | ${data.state} | ${data.task} | ${data.lastUpdated || "-"} |`);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
lines.push("", "## 📜 HISTORY");
|
|
253
|
+
|
|
254
|
+
// Add last 5 history items
|
|
255
|
+
const historyDir = path.join(storePath, "history");
|
|
256
|
+
if (fs.existsSync(historyDir)) {
|
|
257
|
+
const histFiles = fs.readdirSync(historyDir)
|
|
258
|
+
.filter(f => f.endsWith(".json"))
|
|
259
|
+
.sort()
|
|
260
|
+
.reverse()
|
|
261
|
+
.slice(0, 10);
|
|
262
|
+
|
|
263
|
+
histFiles.forEach(f => {
|
|
264
|
+
const hist = JSON.parse(fs.readFileSync(path.join(historyDir, f), "utf8"));
|
|
265
|
+
lines.push(`### ${f.replace(".json", "")}`);
|
|
266
|
+
lines.push(hist.content);
|
|
267
|
+
lines.push("");
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
writeTextFile(mdPath, lines.join("\n"));
|
|
272
|
+
logger.debug("Markdown memory synchronized.");
|
|
273
|
+
} catch (err) {
|
|
274
|
+
logger.debug("Markdown memory sync failed", err);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
export function acquireMemoryLock(lockPath: string): boolean {
|
|
280
|
+
try {
|
|
281
|
+
fs.writeFileSync(lockPath, String(Date.now()), { flag: "wx" });
|
|
282
|
+
return true;
|
|
283
|
+
} catch (err: unknown) {
|
|
284
|
+
const error = err as { code?: string };
|
|
285
|
+
if (error.code === "EEXIST") {
|
|
286
|
+
try {
|
|
287
|
+
const stat = fs.statSync(lockPath);
|
|
288
|
+
if (Date.now() - stat.mtimeMs > 10000) {
|
|
289
|
+
fs.unlinkSync(lockPath);
|
|
290
|
+
fs.writeFileSync(lockPath, String(Date.now()), { flag: "wx" });
|
|
291
|
+
return true;
|
|
292
|
+
}
|
|
293
|
+
} catch (_e) { /* ignore */
|
|
294
|
+
// Ignore
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
return false;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
export function releaseMemoryLock(lockPath: string): void {
|
|
302
|
+
if (fs.existsSync(lockPath)) fs.unlinkSync(lockPath);
|
|
303
|
+
}
|