agent-enderun 1.10.2 → 1.11.0
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/README.md +34 -44
- 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.js +26 -5
- package/dist/framework-mcp/src/index.js.map +1 -1
- package/dist/framework-mcp/src/tools/control_plane/locking.d.ts +3 -9
- package/dist/framework-mcp/src/tools/control_plane/locking.js.map +1 -1
- package/dist/framework-mcp/src/tools/control_plane/registry.d.ts +2 -8
- package/dist/framework-mcp/src/tools/control_plane/registry.js.map +1 -1
- package/dist/framework-mcp/src/tools/dashboard/start_dashboard.d.ts +2 -2
- package/dist/framework-mcp/src/tools/dashboard/start_dashboard.js.map +1 -1
- package/dist/framework-mcp/src/tools/definitions.js +30 -0
- package/dist/framework-mcp/src/tools/definitions.js.map +1 -1
- package/dist/framework-mcp/src/tools/file_system/batch_surgical_edit.d.ts +2 -2
- package/dist/framework-mcp/src/tools/file_system/batch_surgical_edit.js +12 -4
- package/dist/framework-mcp/src/tools/file_system/batch_surgical_edit.js.map +1 -1
- package/dist/framework-mcp/src/tools/file_system/patch_file.d.ts +2 -2
- package/dist/framework-mcp/src/tools/file_system/patch_file.js +6 -2
- package/dist/framework-mcp/src/tools/file_system/patch_file.js.map +1 -1
- package/dist/framework-mcp/src/tools/file_system/read_file.d.ts +2 -2
- package/dist/framework-mcp/src/tools/file_system/read_file.js +43 -26
- package/dist/framework-mcp/src/tools/file_system/read_file.js.map +1 -1
- package/dist/framework-mcp/src/tools/file_system/replace_text.d.ts +2 -2
- package/dist/framework-mcp/src/tools/file_system/replace_text.js +7 -3
- package/dist/framework-mcp/src/tools/file_system/replace_text.js.map +1 -1
- package/dist/framework-mcp/src/tools/file_system/write_file.d.ts +2 -2
- package/dist/framework-mcp/src/tools/file_system/write_file.js +27 -15
- package/dist/framework-mcp/src/tools/file_system/write_file.js.map +1 -1
- package/dist/framework-mcp/src/tools/framework/get_status.d.ts +2 -2
- package/dist/framework-mcp/src/tools/framework/get_status.js.map +1 -1
- package/dist/framework-mcp/src/tools/framework/orchestrate.d.ts +2 -2
- package/dist/framework-mcp/src/tools/framework/orchestrate.js.map +1 -1
- package/dist/framework-mcp/src/tools/framework/run_tests.d.ts +2 -2
- package/dist/framework-mcp/src/tools/framework/run_tests.js.map +1 -1
- package/dist/framework-mcp/src/tools/framework/update_contract_hash.d.ts +2 -2
- package/dist/framework-mcp/src/tools/framework/update_contract_hash.js.map +1 -1
- package/dist/framework-mcp/src/tools/framework/update_memory.d.ts +2 -2
- package/dist/framework-mcp/src/tools/framework/update_memory.js +1 -1
- package/dist/framework-mcp/src/tools/framework/update_memory.js.map +1 -1
- package/dist/framework-mcp/src/tools/index.d.ts +1 -2
- package/dist/framework-mcp/src/tools/index.js +33 -25
- package/dist/framework-mcp/src/tools/index.js.map +1 -1
- package/dist/framework-mcp/src/tools/messaging/log_action.d.ts +2 -2
- package/dist/framework-mcp/src/tools/messaging/log_action.js.map +1 -1
- package/dist/framework-mcp/src/tools/messaging/send_message.d.ts +2 -2
- package/dist/framework-mcp/src/tools/messaging/send_message.js +14 -1
- package/dist/framework-mcp/src/tools/messaging/send_message.js.map +1 -1
- package/dist/framework-mcp/src/tools/observability/check_ports.d.ts +2 -2
- package/dist/framework-mcp/src/tools/observability/check_ports.js.map +1 -1
- 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 +2 -2
- package/dist/framework-mcp/src/tools/search/get_gaps.js.map +1 -1
- package/dist/framework-mcp/src/tools/search/get_map.d.ts +2 -2
- package/dist/framework-mcp/src/tools/search/get_map.js +1 -1
- package/dist/framework-mcp/src/tools/search/get_map.js.map +1 -1
- package/dist/framework-mcp/src/tools/search/grep_search.d.ts +2 -2
- package/dist/framework-mcp/src/tools/search/grep_search.js +45 -28
- package/dist/framework-mcp/src/tools/search/grep_search.js.map +1 -1
- package/dist/framework-mcp/src/tools/search/list_dir.d.ts +2 -2
- package/dist/framework-mcp/src/tools/search/list_dir.js.map +1 -1
- 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 +95 -28
- package/dist/framework-mcp/src/utils/metrics.d.ts +20 -0
- package/dist/framework-mcp/src/utils/metrics.js +24 -6
- package/dist/framework-mcp/src/utils/metrics.js.map +1 -1
- package/dist/framework-mcp/src/utils/security.d.ts +1 -3
- package/dist/framework-mcp/src/utils/security.js +21 -18
- package/dist/framework-mcp/src/utils/security.js.map +1 -1
- package/dist/framework-mcp/tests/tools/file_system/file_system_tools.test.js +19 -14
- package/dist/framework-mcp/tests/tools/file_system/file_system_tools.test.js.map +1 -1
- package/dist/framework-mcp/tests/tools/messaging/send_message.test.js +1 -1
- package/dist/framework-mcp/tests/tools/messaging/send_message.test.js.map +1 -1
- 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 +1 -1
- package/dist/src/cli/adapters/core.js +4 -0
- package/dist/src/cli/adapters/core.js.map +1 -1
- package/dist/src/cli/adapters/index.d.ts +1 -0
- package/dist/src/cli/adapters/index.js +1 -0
- package/dist/src/cli/adapters/index.js.map +1 -1
- package/dist/src/cli/adapters/paths.d.ts +15 -0
- package/dist/src/cli/adapters/paths.js +101 -0
- package/dist/src/cli/adapters/paths.js.map +1 -0
- package/dist/src/cli/adapters/scaffold.d.ts +1 -1
- package/dist/src/cli/adapters/scaffold.js +10 -7
- package/dist/src/cli/adapters/scaffold.js.map +1 -1
- package/dist/src/cli/commands/check.js +15 -36
- package/dist/src/cli/commands/check.js.map +1 -1
- package/dist/src/cli/commands/dashboard/data-service.d.ts +8 -0
- package/dist/src/cli/commands/dashboard/data-service.js +37 -0
- package/dist/src/cli/commands/dashboard/data-service.js.map +1 -1
- package/dist/src/cli/commands/init/scaffold-core.d.ts +5 -2
- package/dist/src/cli/commands/init/scaffold-core.js +28 -6
- package/dist/src/cli/commands/init/scaffold-core.js.map +1 -1
- package/dist/src/cli/commands/init/scaffold-standards.js +6 -1
- package/dist/src/cli/commands/init/scaffold-standards.js.map +1 -1
- package/dist/src/cli/commands/init.js +30 -6
- package/dist/src/cli/commands/init.js.map +1 -1
- package/dist/src/cli/commands/orchestrate.d.ts +11 -6
- package/dist/src/cli/commands/orchestrate.js +148 -128
- package/dist/src/cli/commands/orchestrate.js.map +1 -1
- package/dist/src/cli/commands/plan.d.ts +3 -1
- package/dist/src/cli/commands/plan.js +79 -22
- package/dist/src/cli/commands/plan.js.map +1 -1
- package/dist/src/cli/index.js +11 -15
- package/dist/src/cli/index.js.map +1 -1
- package/dist/src/cli/utils/compliance.js +0 -1
- package/dist/src/cli/utils/compliance.js.map +1 -1
- package/dist/src/cli/utils/config-schema.d.ts +7 -7
- package/dist/src/cli/utils/fs.js +1 -1
- package/dist/src/cli/utils/fs.js.map +1 -1
- package/dist/src/cli/utils/memory.d.ts +1 -1
- package/dist/src/cli/utils/memory.js +28 -8
- package/dist/src/cli/utils/memory.js.map +1 -1
- package/dist/src/cli/utils/pkg.d.ts +19 -0
- package/dist/src/cli/utils/pkg.js +29 -5
- package/dist/src/cli/utils/pkg.js.map +1 -1
- package/dist/src/modules/adapters/definitions.js +3 -3
- package/dist/src/modules/adapters/definitions.js.map +1 -1
- package/dist/src/modules/agents/definitions.js +2 -1
- package/dist/src/modules/agents/definitions.js.map +1 -1
- package/dist/src/modules/agents/registry/analyst.js +1 -1
- package/dist/src/modules/agents/registry/analyst.js.map +1 -1
- package/dist/src/modules/agents/registry/architect.js +1 -0
- package/dist/src/modules/agents/registry/architect.js.map +1 -1
- package/dist/src/modules/agents/registry/backend.js +7 -6
- package/dist/src/modules/agents/registry/backend.js.map +1 -1
- package/dist/src/modules/agents/registry/database.js +4 -3
- package/dist/src/modules/agents/registry/database.js.map +1 -1
- package/dist/src/modules/agents/registry/devops.js +1 -1
- package/dist/src/modules/agents/registry/devops.js.map +1 -1
- package/dist/src/modules/agents/registry/git.js +1 -1
- package/dist/src/modules/agents/registry/git.js.map +1 -1
- package/dist/src/modules/agents/registry/manager.js +3 -2
- package/dist/src/modules/agents/registry/manager.js.map +1 -1
- package/dist/src/modules/agents/registry/native.js +1 -1
- package/dist/src/modules/agents/registry/native.js.map +1 -1
- package/dist/src/modules/agents/registry/quality.js +1 -0
- package/dist/src/modules/agents/registry/quality.js.map +1 -1
- package/dist/src/modules/agents/registry/security.js +1 -0
- package/dist/src/modules/agents/registry/security.js.map +1 -1
- package/dist/src/shared/constants.d.ts +113 -0
- package/dist/src/shared/constants.js +178 -0
- package/dist/src/shared/constants.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/approve.test.js +5 -9
- package/dist/tests/approve.test.js.map +1 -1
- package/dist/tests/cli/init/unified_init.test.d.ts +1 -0
- package/dist/tests/cli/init/unified_init.test.js +47 -0
- package/dist/tests/cli/init/unified_init.test.js.map +1 -0
- package/dist/tests/fs-utils.test.js +1 -1
- package/dist/tests/fs-utils.test.js.map +1 -1
- package/dist/tests/memory-utils.test.js +1 -1
- package/dist/tests/memory-utils.test.js.map +1 -1
- 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/trace.test.js +2 -2
- package/dist/tests/trace.test.js.map +1 -1
- package/framework-mcp/dist/constants.js +64 -0
- package/framework-mcp/dist/index.js +109 -0
- package/framework-mcp/dist/tools/control_plane/locking.js +64 -0
- package/framework-mcp/dist/tools/control_plane/registry.js +34 -0
- package/framework-mcp/dist/tools/dashboard/start_dashboard.js +29 -0
- package/framework-mcp/dist/tools/definitions.js +300 -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 +43 -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 +62 -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 +87 -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 +76 -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 +29 -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.json +19 -0
- package/framework-mcp/src/constants.ts +78 -0
- package/framework-mcp/src/declarations.d.ts +17 -0
- package/framework-mcp/src/index.ts +132 -0
- package/framework-mcp/src/tools/control_plane/locking.ts +71 -0
- package/framework-mcp/src/tools/control_plane/registry.ts +38 -0
- package/framework-mcp/src/tools/dashboard/start_dashboard.ts +33 -0
- package/framework-mcp/src/tools/definitions.ts +302 -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 +52 -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 +66 -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 +89 -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 +76 -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 +37 -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/package.json +9 -7
- package/src/cli/adapters/core.ts +7 -1
- package/src/cli/adapters/index.ts +1 -0
- package/src/cli/adapters/paths.ts +134 -0
- package/src/cli/adapters/scaffold.ts +17 -7
- package/src/cli/commands/check.ts +16 -38
- package/src/cli/commands/dashboard/data-service.ts +48 -0
- package/src/cli/commands/init/scaffold-core.ts +45 -6
- package/src/cli/commands/init/scaffold-standards.ts +6 -1
- package/src/cli/commands/init.ts +32 -6
- package/src/cli/commands/orchestrate.ts +151 -127
- package/src/cli/commands/plan.ts +89 -23
- package/src/cli/index.ts +14 -19
- package/src/cli/utils/compliance.ts +8 -9
- package/src/cli/utils/fs.ts +1 -1
- package/src/cli/utils/memory.ts +32 -7
- package/src/cli/utils/pkg.ts +42 -13
- package/src/modules/adapters/definitions.ts +4 -3
- package/src/modules/agents/definitions.ts +2 -1
- package/src/modules/agents/registry/analyst.ts +1 -1
- package/src/modules/agents/registry/architect.ts +1 -0
- package/src/modules/agents/registry/backend.ts +7 -6
- package/src/modules/agents/registry/database.ts +4 -3
- package/src/modules/agents/registry/devops.ts +1 -1
- package/src/modules/agents/registry/git.ts +1 -1
- package/src/modules/agents/registry/manager.ts +3 -2
- package/src/modules/agents/registry/native.ts +1 -1
- package/src/modules/agents/registry/quality.ts +1 -0
- package/src/modules/agents/registry/security.ts +1 -0
- package/src/shared/constants.ts +212 -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 +37 -0
- package/templates/standards/github-actions-standards.md +43 -0
- package/templates/standards/i18n-standards.md +17 -0
- package/templates/standards/kysely-standards.md +47 -0
- package/templates/standards/llm-governance.md +15 -0
- package/templates/standards/logging-and-secrets.md +34 -0
- package/templates/standards/mobile-standards.md +23 -0
- package/templates/standards/observability-standards.md +15 -0
- package/templates/standards/performance-standards.md +15 -0
- package/templates/standards/pino-standards.md +46 -0
- package/templates/standards/playwright-standards.md +54 -0
- package/templates/standards/quality-standards.md +31 -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 +16 -0
- package/templates/standards/security-standards.md +21 -0
- package/templates/standards/swagger-standards.md +50 -0
- package/templates/standards/tailwind-standards.md +20 -0
- package/templates/standards/testing-standards.md +31 -0
- package/templates/standards/typeorm-standards.md +49 -0
- package/templates/standards/vitest-standards.md +110 -0
- package/bin/validate-agent-army.js +0 -148
- package/src/cli/commands/app.ts +0 -56
- package/src/cli/utils/app-backend.ts +0 -257
- package/src/cli/utils/app-docs.ts +0 -83
- package/src/cli/utils/app-frontend.ts +0 -263
- package/src/cli/utils/app-inferrer.ts +0 -63
- package/src/cli/utils/app-mobile.ts +0 -113
- package/src/cli/utils/app-types.ts +0 -248
- package/src/cli/utils/app.ts +0 -6
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Enderun — Single Source of Truth for framework constants.
|
|
3
|
+
* Import from here instead of hardcoding paths, phases, or directory names.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// ─── Framework identity ───────────────────────────────────────────────────────
|
|
7
|
+
|
|
8
|
+
export const FRAMEWORK = {
|
|
9
|
+
NAME: "Agent Enderun",
|
|
10
|
+
CORE_DIR: ".enderun",
|
|
11
|
+
UNIFIED_HUB_DIR: ".agents",
|
|
12
|
+
CONSTITUTION_FILE: "ENDERUN.md",
|
|
13
|
+
DEFAULT_TRACE_ID: "T-000",
|
|
14
|
+
DEFAULT_PHASE: "PHASE_0",
|
|
15
|
+
DEFAULT_MANAGER_STATE: "ACTIVE",
|
|
16
|
+
} as const;
|
|
17
|
+
|
|
18
|
+
export const PROJECT_PHASES = [
|
|
19
|
+
"PHASE_0",
|
|
20
|
+
"PHASE_1",
|
|
21
|
+
"PHASE_2",
|
|
22
|
+
"PHASE_3",
|
|
23
|
+
"PHASE_4",
|
|
24
|
+
] as const;
|
|
25
|
+
|
|
26
|
+
// ─── Adapter platform directories (native / legacy) ───────────────────────────
|
|
27
|
+
|
|
28
|
+
export const ADAPTER_DIRS = {
|
|
29
|
+
GEMINI: ".gemini",
|
|
30
|
+
CLAUDE: ".claude",
|
|
31
|
+
GROK: ".grok",
|
|
32
|
+
CURSOR: ".cursor",
|
|
33
|
+
CODEX: ".agents",
|
|
34
|
+
ANTIGRAVITY: ".antigravity",
|
|
35
|
+
LEGACY_AGENT: ".agent",
|
|
36
|
+
} as const;
|
|
37
|
+
|
|
38
|
+
/** Priority order for framework directory resolution (CLI + MCP). */
|
|
39
|
+
export const FRAMEWORK_DIR_CANDIDATES = [
|
|
40
|
+
FRAMEWORK.CORE_DIR,
|
|
41
|
+
ADAPTER_DIRS.CODEX,
|
|
42
|
+
ADAPTER_DIRS.CLAUDE,
|
|
43
|
+
ADAPTER_DIRS.GEMINI,
|
|
44
|
+
ADAPTER_DIRS.GROK,
|
|
45
|
+
ADAPTER_DIRS.CURSOR,
|
|
46
|
+
ADAPTER_DIRS.ANTIGRAVITY,
|
|
47
|
+
] as const;
|
|
48
|
+
|
|
49
|
+
/** Slug under `.agents/{slug}/` for each adapter in unified mode. */
|
|
50
|
+
export const UNIFIED_ADAPTER_SLUG = {
|
|
51
|
+
gemini: "gemini",
|
|
52
|
+
claude: "claude",
|
|
53
|
+
grok: "grok",
|
|
54
|
+
cursor: "cursor",
|
|
55
|
+
codex: "codex",
|
|
56
|
+
"antigravity-cli": "antigravity",
|
|
57
|
+
} as const;
|
|
58
|
+
|
|
59
|
+
export type UnifiedAdapterSlug = keyof typeof UNIFIED_ADAPTER_SLUG;
|
|
60
|
+
|
|
61
|
+
// ─── Native agent instruction paths (legacy tool compatibility) ───────────────
|
|
62
|
+
|
|
63
|
+
export const NATIVE_AGENT_PATHS = {
|
|
64
|
+
gemini: pathJoin(ADAPTER_DIRS.GEMINI, "agents"),
|
|
65
|
+
claude: pathJoin(ADAPTER_DIRS.CLAUDE, "agents"),
|
|
66
|
+
grok: pathJoin(ADAPTER_DIRS.GROK, "agents"),
|
|
67
|
+
cursor: pathJoin(ADAPTER_DIRS.CURSOR, "rules"),
|
|
68
|
+
codex: pathJoin(ADAPTER_DIRS.CODEX, "instructions"),
|
|
69
|
+
"antigravity-cli": pathJoin(ADAPTER_DIRS.ANTIGRAVITY, "agents"),
|
|
70
|
+
} as const;
|
|
71
|
+
|
|
72
|
+
/** Legacy layout bases used by `check` and discovery (non-unified installs). */
|
|
73
|
+
export const LEGACY_AGENT_LAYOUT_BASES = [
|
|
74
|
+
NATIVE_AGENT_PATHS.gemini,
|
|
75
|
+
NATIVE_AGENT_PATHS.claude,
|
|
76
|
+
NATIVE_AGENT_PATHS.cursor,
|
|
77
|
+
NATIVE_AGENT_PATHS.grok,
|
|
78
|
+
NATIVE_AGENT_PATHS.codex,
|
|
79
|
+
NATIVE_AGENT_PATHS["antigravity-cli"],
|
|
80
|
+
] as const;
|
|
81
|
+
|
|
82
|
+
// ─── Framework internal subdirectories (under `.enderun/`) ──────────────────
|
|
83
|
+
|
|
84
|
+
export const FRAMEWORK_SUBDIRS = {
|
|
85
|
+
AGENTS: "agents",
|
|
86
|
+
SKILLS: "skills",
|
|
87
|
+
KNOWLEDGE: "knowledge",
|
|
88
|
+
PROMPTS: "prompts",
|
|
89
|
+
MEMORY: "memory",
|
|
90
|
+
ROUTER: "router",
|
|
91
|
+
REGISTRY: "registry",
|
|
92
|
+
OBSERVABILITY: "observability",
|
|
93
|
+
RULES: "rules",
|
|
94
|
+
MESSAGES: "messages",
|
|
95
|
+
LOGS: "logs",
|
|
96
|
+
MEMORY_GRAPH: "memory-graph",
|
|
97
|
+
} as const;
|
|
98
|
+
|
|
99
|
+
export const CORE_SCAFFOLD_SUBDIRS = [
|
|
100
|
+
FRAMEWORK_SUBDIRS.KNOWLEDGE,
|
|
101
|
+
FRAMEWORK_SUBDIRS.PROMPTS,
|
|
102
|
+
FRAMEWORK_SUBDIRS.MEMORY,
|
|
103
|
+
FRAMEWORK_SUBDIRS.ROUTER,
|
|
104
|
+
FRAMEWORK_SUBDIRS.REGISTRY,
|
|
105
|
+
FRAMEWORK_SUBDIRS.OBSERVABILITY,
|
|
106
|
+
FRAMEWORK_SUBDIRS.RULES,
|
|
107
|
+
] as const;
|
|
108
|
+
|
|
109
|
+
export const RUNTIME_SUBDIRS = [
|
|
110
|
+
FRAMEWORK_SUBDIRS.MESSAGES,
|
|
111
|
+
FRAMEWORK_SUBDIRS.LOGS,
|
|
112
|
+
FRAMEWORK_SUBDIRS.MEMORY_GRAPH,
|
|
113
|
+
] as const;
|
|
114
|
+
|
|
115
|
+
export const MEMORY_SUBDIRS = {
|
|
116
|
+
TASKS: "tasks",
|
|
117
|
+
HISTORY: "history",
|
|
118
|
+
} as const;
|
|
119
|
+
|
|
120
|
+
export const MEMORY_FILES = {
|
|
121
|
+
STATE: "state.json",
|
|
122
|
+
STATUS: "status.json",
|
|
123
|
+
PROJECT_MEMORY: "PROJECT_MEMORY.md",
|
|
124
|
+
SHARED_FACTS: "shared-facts.json",
|
|
125
|
+
} as const;
|
|
126
|
+
|
|
127
|
+
// ─── Monorepo default paths ───────────────────────────────────────────────────
|
|
128
|
+
|
|
129
|
+
export const DEFAULT_MONOREPO_PATHS = {
|
|
130
|
+
backend: "apps/backend",
|
|
131
|
+
frontend: "apps/web",
|
|
132
|
+
mobile: "apps/mobile",
|
|
133
|
+
docs: "docs",
|
|
134
|
+
tests: "tests",
|
|
135
|
+
} as const;
|
|
136
|
+
|
|
137
|
+
/** Cursor rule globs per agent role (monorepo layout). */
|
|
138
|
+
export const CURSOR_AGENT_GLOBS: Record<string, string> = {
|
|
139
|
+
backend: `${DEFAULT_MONOREPO_PATHS.backend}/**/*`,
|
|
140
|
+
frontend: `${DEFAULT_MONOREPO_PATHS.frontend}/**/*`,
|
|
141
|
+
database: `${DEFAULT_MONOREPO_PATHS.backend}/src/database/**/*`,
|
|
142
|
+
mobile: `${DEFAULT_MONOREPO_PATHS.mobile}/**/*`,
|
|
143
|
+
native: "apps/native/**/*",
|
|
144
|
+
quality: "*",
|
|
145
|
+
security: "*",
|
|
146
|
+
devops: "*",
|
|
147
|
+
explorer: "*",
|
|
148
|
+
git: "*",
|
|
149
|
+
analyst: "*",
|
|
150
|
+
manager: "*",
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
// ─── MCP & environment ──────────────────────────────────────────────────────
|
|
154
|
+
|
|
155
|
+
export const MCP = {
|
|
156
|
+
SERVER_NAME: "agent-enderun",
|
|
157
|
+
ROOT_CONFIG_FILE: "mcp.json",
|
|
158
|
+
PROJECT_ROOT_ENV: "ENDERUN_PROJECT_ROOT",
|
|
159
|
+
TEST_DIR_ENV: "ENDERUN_TEST_DIR",
|
|
160
|
+
} as const;
|
|
161
|
+
|
|
162
|
+
export const ROOT_CONFIG_FILES = {
|
|
163
|
+
MCP: MCP.ROOT_CONFIG_FILE,
|
|
164
|
+
DOT_MCP: ".mcp.json",
|
|
165
|
+
ENV_EXAMPLE: ".env.example",
|
|
166
|
+
VSCODE_MCP: ".vscode/mcp.json",
|
|
167
|
+
} as const;
|
|
168
|
+
|
|
169
|
+
// ─── Shim template placeholders ───────────────────────────────────────────────
|
|
170
|
+
|
|
171
|
+
export const TEMPLATE_PLACEHOLDERS = {
|
|
172
|
+
FRAMEWORK_DIR: "{{FRAMEWORK_DIR}}",
|
|
173
|
+
ADAPTER: "{{ADAPTER}}",
|
|
174
|
+
BACKEND_DIR: "{{BACKEND_DIR}}",
|
|
175
|
+
FRONTEND_DIR: "{{FRONTEND_DIR}}",
|
|
176
|
+
DOCS_DIR: "{{DOCS_DIR}}",
|
|
177
|
+
TESTS_DIR: "{{TESTS_DIR}}",
|
|
178
|
+
} as const;
|
|
179
|
+
|
|
180
|
+
// ─── File extensions ─────────────────────────────────────────────────────────
|
|
181
|
+
|
|
182
|
+
export const AGENT_FILE_EXT = {
|
|
183
|
+
MARKDOWN: ".md",
|
|
184
|
+
CURSOR_RULE: ".mdc",
|
|
185
|
+
} as const;
|
|
186
|
+
|
|
187
|
+
// ─── Path helpers ─────────────────────────────────────────────────────────────
|
|
188
|
+
|
|
189
|
+
export function pathJoin(...segments: string[]): string {
|
|
190
|
+
return segments.filter(Boolean).join("/");
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export function corePath(...segments: string[]): string {
|
|
194
|
+
return pathJoin(FRAMEWORK.CORE_DIR, ...segments);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export function unifiedHubPath(...segments: string[]): string {
|
|
198
|
+
return pathJoin(FRAMEWORK.UNIFIED_HUB_DIR, ...segments);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export function unifiedAdapterPath(slug: string, ...segments: string[]): string {
|
|
202
|
+
return unifiedHubPath(slug, ...segments);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export function knowledgePath(filename: string): string {
|
|
206
|
+
return corePath(FRAMEWORK_SUBDIRS.KNOWLEDGE, filename);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/** Backward-compatible aliases */
|
|
210
|
+
export const CORE_FRAMEWORK_DIR = FRAMEWORK.CORE_DIR;
|
|
211
|
+
export const UNIFIED_HUB_DIR = FRAMEWORK.UNIFIED_HUB_DIR;
|
|
212
|
+
export const SKILLS_HUB_PATH = pathJoin(UNIFIED_HUB_DIR, FRAMEWORK_SUBDIRS.SKILLS);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# 🐞 Scientific Debugging (Bug-Fix) Recipe
|
|
2
|
+
|
|
3
|
+
This recipe defines how to autonomously detect and permanently resolve a bug.
|
|
4
|
+
|
|
5
|
+
## 1. Reproduction
|
|
6
|
+
- Analyze the logs (`audit_log.md`) that reported the error.
|
|
7
|
+
- Write the smallest test case (failing test) that triggers the error.
|
|
8
|
+
|
|
9
|
+
## 2. Root Cause Analysis
|
|
10
|
+
- Check system resources with `get_system_health`.
|
|
11
|
+
- Verify the status of services with `check_active_ports`.
|
|
12
|
+
- Examine relevant code blocks line by line using `read_file`.
|
|
13
|
+
|
|
14
|
+
## 3. Surgical Fix
|
|
15
|
+
- Perform only the surgical intervention that will fix the error.
|
|
16
|
+
- Check if there is a missing variable in ".env".
|
|
17
|
+
|
|
18
|
+
## 4. Permanent Solution
|
|
19
|
+
- Verify that the test you wrote passes.
|
|
20
|
+
- If `quality-standards.md` needs to be updated to prevent similar errors, submit a proposal.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# 📜 Engineering Recipe: Contract-First Design
|
|
2
|
+
|
|
3
|
+
This recipe governs the @architect agent's protocol for creating type-safe agreements between system layers.
|
|
4
|
+
|
|
5
|
+
## 🏁 Phase 1: Requirement Alignment
|
|
6
|
+
1. **Analysis:** Read user requirements and Business Analyst (@analyst) reports.
|
|
7
|
+
2. **Scope Discovery:** Identify the domain objects, actions, and events required for the feature.
|
|
8
|
+
|
|
9
|
+
## 📐 Phase 2: Technical Modeling
|
|
10
|
+
1. **Branded Types:** Define semantic IDs in `src/types/brands.ts` (e.g., `OrderId`, `ProductSKU`).
|
|
11
|
+
2. **Domain Models:** Create or update interfaces in `src/types/models.ts`. Ensure they extend `BaseEntity`.
|
|
12
|
+
3. **Constants:** Update `src/types/constants.ts` for enums and fixed state values.
|
|
13
|
+
|
|
14
|
+
## 🔏 Phase 3: Hash Sealing
|
|
15
|
+
1. **Integrity Check:** Run `agent-enderun verify-contract` to check existing state.
|
|
16
|
+
2. **Commitment:** Run `agent-enderun update-contract` to generate new SHA-256 signatures for the updated types.
|
|
17
|
+
3. **Audit:** Verify that `contract.version.json` accurately reflects the new architecture.
|
|
18
|
+
|
|
19
|
+
## 📡 Phase 4: Synchronization
|
|
20
|
+
1. **Distribution:** Ensure the updated `src/types` directory is correctly linked or copied to both Frontend and Backend projects.
|
|
21
|
+
2. **Verification:** Trigger @backend and @frontend agents to read the new contract and plan their implementations.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# 🗄️ Engineering Recipe: Database Management & Migrations
|
|
2
|
+
|
|
3
|
+
This recipe governs the @database agent's protocol for schema creation, table modifications, and data integrity.
|
|
4
|
+
|
|
5
|
+
## 📐 Phase 1: Contract-First Definition
|
|
6
|
+
1. **Type Mapping:** Define the new table or column in `src/types/models.ts` using Branded Types for IDs.
|
|
7
|
+
2. **Validation:** Ensure the interface extends `BaseEntity` (id, createdAt, updatedAt).
|
|
8
|
+
|
|
9
|
+
## 🚀 Phase 2: Migration Generation
|
|
10
|
+
1. **Scripting:** Write a reversible migration (up/down) using the project's migration tool (e.g., Kysely or SQL).
|
|
11
|
+
2. **Atomic Changes:** One migration per logical feature. Never bundle unrelated schema changes.
|
|
12
|
+
3. **Naming:** Use timestamp-prefixed naming (e.g., `20240101_add_customers_table.ts`).
|
|
13
|
+
|
|
14
|
+
## 🧱 Phase 3: Infrastructure Setup (If New DB)
|
|
15
|
+
1. **Initialization:** Verify the connection string in `.env`.
|
|
16
|
+
2. **Health Check:** Run `check_active_ports` to ensure the DB engine is reachable.
|
|
17
|
+
|
|
18
|
+
## 🛠️ Phase 4: Implementation & Repository Update
|
|
19
|
+
1. **Repo Layer:** Create or update the Repository class to include the new query logic.
|
|
20
|
+
2. **Strict Mode:** Ensure no raw SQL is used; leverage the query builder exclusively.
|
|
21
|
+
|
|
22
|
+
## ✅ Phase 5: Verification & Zero-Downtime Audit
|
|
23
|
+
1. **Dry Run:** If supported, dry-run the migration to check for locking issues.
|
|
24
|
+
2. **Validation:** Run `agent-enderun verify-contract` to ensure code and schema are synced.
|
|
25
|
+
3. **Handoff:** Update `PROJECT_MEMORY.md` with the new schema version.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# 🚀 Engineering Recipe: Infrastructure Deployment
|
|
2
|
+
|
|
3
|
+
This recipe governs the @devops agent's protocol for safe, traceable, and reversible system rollouts.
|
|
4
|
+
|
|
5
|
+
## 🏁 Phase 1: Pre-Deployment Environment Audit
|
|
6
|
+
1. **Integrity Check:** Run `agent-enderun check` to ensure all discipline rules are met.
|
|
7
|
+
2. **Health Scan:** Execute `get_system_health` and `check_active_ports` on the target environment.
|
|
8
|
+
3. **Config Sync:** Verify that all keys in `.env.example` are present in the target environment's secrets manager.
|
|
9
|
+
|
|
10
|
+
## 🧱 Phase 2: Build & Validation
|
|
11
|
+
1. **Compilation:** Run `npm run build` and capture any stderr.
|
|
12
|
+
2. **Contract Verify:** Run `agent-enderun verify-contract` to ensure FE/BE synchronization.
|
|
13
|
+
3. **Test Suite:** Execute the full test battery. Failure in a single test blocks deployment.
|
|
14
|
+
|
|
15
|
+
## 📡 Phase 3: Controlled Rollout
|
|
16
|
+
1. **Atomic Swap:** Deploy the new bundle/service using the project's orchestration scripts.
|
|
17
|
+
2. **Database Sync:** If migrations are pending, follow the `db-management-recipe.md` first.
|
|
18
|
+
3. **Log Monitoring:** Tail `logs/manager.json` for immediate post-deploy spikes in errors.
|
|
19
|
+
|
|
20
|
+
## ✅ Phase 4: Post-Deploy & Rollback Readiness
|
|
21
|
+
1. **Observability:** Verify system metrics stabilize within 5 minutes.
|
|
22
|
+
2. **Traceability:** Record the deployment Trace ID and commit hash in `PROJECT_MEMORY.md`.
|
|
23
|
+
3. **Rollback Check:** Ensure the previous stable version is tagged and reachable in Git.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# ✨ New Feature Development Recipe
|
|
2
|
+
|
|
3
|
+
The "Nizam-ı Enderun" steps to follow when adding a new module or feature.
|
|
4
|
+
|
|
5
|
+
## 1. Contract Design (Phase 1)
|
|
6
|
+
- First, update the `contract.version.json` file and the relevant TypeScript types.
|
|
7
|
+
- Do not start writing code without getting approval from `@architect`.
|
|
8
|
+
|
|
9
|
+
## 2. Mock-Free Development (Phase 2)
|
|
10
|
+
- Add the new feature to the correct directory under `apps/backend` or `apps/web`.
|
|
11
|
+
- If database changes are required, coordinate with the `@database` agent.
|
|
12
|
+
|
|
13
|
+
## 3. Responsive & i18n (Phase 3)
|
|
14
|
+
- Use `{ base: '...', md: '...' }` responsive syntax in frontend developments.
|
|
15
|
+
- Move all texts to the `locales/` directory immediately.
|
|
16
|
+
|
|
17
|
+
## 4. Completion (Phase 4)
|
|
18
|
+
- Ensure no TODOs remain using `get_project_gaps`.
|
|
19
|
+
- Verify that you haven't created any new package pollution with `audit_dependencies`.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# ⚡ Engineering Recipe: Performance Optimization
|
|
2
|
+
|
|
3
|
+
This recipe governs the protocol for identifying and resolving system bottlenecks (Frontend, Backend, or Database).
|
|
4
|
+
|
|
5
|
+
## 📊 Phase 1: Profiling & Bottleneck Identification
|
|
6
|
+
1. **Metric Collection:** Read `observability/metrics.json` or run `get_system_health`.
|
|
7
|
+
2. **Log Audit:** Scan `logs/manager.json` for slow actions or timeouts.
|
|
8
|
+
3. **Trace Analysis:** Use `TraceID` to follow a slow request through all layers.
|
|
9
|
+
|
|
10
|
+
## 🧠 Phase 2: Root Cause Analysis
|
|
11
|
+
1. **SQL Audit:** Check for N+1 query patterns or missing indexes in `repository/` files.
|
|
12
|
+
2. **Algorithm Audit:** Scan for O(n²) loops or heavy synchronous operations.
|
|
13
|
+
3. **Frontend Audit:** Check for unnecessary re-renders or massive bundle sizes.
|
|
14
|
+
|
|
15
|
+
## 🛠️ Phase 3: Surgical Optimization
|
|
16
|
+
1. **DB Level:** Add missing indexes or refactor complex joins.
|
|
17
|
+
2. **Logic Level:** Implement caching (e.g., Redis or in-memory) for frequent read operations.
|
|
18
|
+
3. **UI Level:** Apply memoization, virtualization (FlashList), or code-splitting.
|
|
19
|
+
|
|
20
|
+
## ✅ Phase 4: Validation & Comparison
|
|
21
|
+
1. **Benchmarking:** Re-run the action and compare new metrics with the baseline.
|
|
22
|
+
2. **Regression Check:** Run `agent-enderun check` and existing tests to ensure logic is intact.
|
|
23
|
+
3. **Knowledge Update:** Record the optimization strategy in `knowledge/performance-history.md`.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# 📦 Pull Request Title: [TRC-{TraceId}] Brief Description
|
|
2
|
+
|
|
3
|
+
## 📝 Summary
|
|
4
|
+
<!-- What did you change and why? -->
|
|
5
|
+
|
|
6
|
+
## 🔗 Related Tasks
|
|
7
|
+
- **Trace ID:** [Link to Trace/Task or ID]
|
|
8
|
+
- **Issue:** [Link to issue if applicable]
|
|
9
|
+
|
|
10
|
+
## 🛡️ Governance & Compliance Checklist
|
|
11
|
+
- [ ] Code passes `npm run enderun:test`.
|
|
12
|
+
- [ ] Code passes `npm run enderun:check` (Compliance Scanner).
|
|
13
|
+
- [ ] No `any` type usage added.
|
|
14
|
+
- [ ] No secrets or hardcoded API keys.
|
|
15
|
+
- [ ] New functionality is registered in `src/modules/agents/definitions.ts` (if applicable).
|
|
16
|
+
|
|
17
|
+
## 🧪 Testing Notes
|
|
18
|
+
<!-- How did you verify the fix? -->
|
|
19
|
+
|
|
20
|
+
## 🛠️ Risk Assessment
|
|
21
|
+
<!-- Any potential side effects? -->
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# 🛠️ Surgical Refactoring Recipe
|
|
2
|
+
|
|
3
|
+
This recipe defines how to modernize existing code without breaking other parts of the project.
|
|
4
|
+
|
|
5
|
+
## 1. Reconnaissance
|
|
6
|
+
- Use `grep_search` to find all references to the function to be refactored.
|
|
7
|
+
- Understand the module's dependency graph with `get_project_map`.
|
|
8
|
+
- Verify the baseline by running existing tests (`run_tests`).
|
|
9
|
+
|
|
10
|
+
## 2. Planning (Strategy)
|
|
11
|
+
- Break the change into small, atomic steps.
|
|
12
|
+
- Define new types and interfaces first.
|
|
13
|
+
|
|
14
|
+
## 3. Surgical Execution
|
|
15
|
+
- **RULE:** Never delete a file completely. Only use `replace_text` or `batch_surgical_edit`.
|
|
16
|
+
- Maintain type safety (ban on `any`) at every step.
|
|
17
|
+
- Update `PROJECT_MEMORY.md` after every major change.
|
|
18
|
+
|
|
19
|
+
## 4. Validation
|
|
20
|
+
- Ensure no regressions occurred using `run_tests`.
|
|
21
|
+
- Audit code quality with the `@quality` agent.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# 🛡️ Engineering Recipe: Advanced Security Audit
|
|
2
|
+
|
|
3
|
+
This recipe governs the @security agent's protocol for identifying and mitigating vulnerabilities within the Agent Enderun framework.
|
|
4
|
+
|
|
5
|
+
## 🏁 Phase 1: Automated Reconnaissance
|
|
6
|
+
1. **Secret Scan:** Run `grep_search` for keywords: `apiKey`, `secret`, `password`, `token`, `private_key`.
|
|
7
|
+
2. **SQL Injection Audit:** Scan for `raw SQL` or template literals bypassing the query builder.
|
|
8
|
+
3. **Auth Check:** Verify that all sensitive routes have active `auth` guards and Role-Based Access Control (RBAC).
|
|
9
|
+
|
|
10
|
+
## 🧠 Phase 2: Contextual Analysis
|
|
11
|
+
1. **Impact Mapping:** For every identified risk, read the surrounding code to determine if it's exposed to the public internet.
|
|
12
|
+
2. **Configuration Check:** Verify `.env.example` contains all required keys and no real secrets are committed to Git.
|
|
13
|
+
|
|
14
|
+
## 🛠️ Phase 3: Surgical Mitigation
|
|
15
|
+
1. **Fix:** Use `replace_text` to move hardcoded secrets to `.env` or refactor raw SQL to Kysely.
|
|
16
|
+
2. **Sanitization:** Apply input validation using Zod schemas for all external data.
|
|
17
|
+
|
|
18
|
+
## ✅ Phase 4: Verification & Logging
|
|
19
|
+
1. **Discipline Check:** Run `agent-enderun check` to ensure no new violations were introduced.
|
|
20
|
+
2. **Action Log:** Execute `log_agent_action` with a summary of found vs. fixed vulnerabilities.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# 📐 Corporate Architecture Standards (AL Framework)
|
|
2
|
+
|
|
3
|
+
This project is developed in accordance with the "Nizam-ı Mimari" (Architectural Order) rules defined by Agent Enderun.
|
|
4
|
+
|
|
5
|
+
## 1. Directory Structure (Monorepo Standard)
|
|
6
|
+
- `apps/backend/`: Business logic, API, and database layers.
|
|
7
|
+
- `apps/web/`: Frontend (React/Next.js) layer.
|
|
8
|
+
- `packages/shared/`: Type definitions and helpers shared between Backend and Frontend.
|
|
9
|
+
|
|
10
|
+
## 2. Layered Architecture
|
|
11
|
+
All business logic must follow this hierarchy:
|
|
12
|
+
1. **Routes/Controllers:** API entry points and request validation.
|
|
13
|
+
2. **Services:** Where business logic is coordinated.
|
|
14
|
+
3. **Repositories/Models:** Database access and raw data mutations.
|
|
15
|
+
|
|
16
|
+
## 3. Type Safety and Contracts
|
|
17
|
+
- The hash in the `contract.version.json` file must always match the active code.
|
|
18
|
+
- The use of the `any` type is strictly forbidden.
|
|
19
|
+
- All asynchronous operations must be wrapped in `try-catch` blocks and proper error management (ErrorHandler).
|
|
20
|
+
|
|
21
|
+
## 4. AL (Agent Lifecycle) Phase Discipline
|
|
22
|
+
- Development progresses sequentially from Phase 0 to Phase 4.
|
|
23
|
+
- Application code (Phase 2) cannot be written before contracts are approved (Phase 1).
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# Authentication & Authorization Standards
|
|
2
|
+
|
|
3
|
+
> JWT + bcrypt authentication and role-based access control for Fastify APIs.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Enterprise-grade authentication system using JSON Web Tokens (JWT) for stateless authentication and bcrypt for secure password hashing.
|
|
8
|
+
|
|
9
|
+
## Setup
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# Required dependencies
|
|
13
|
+
npm install bcrypt jsonwebtoken
|
|
14
|
+
npm install -D @types/bcrypt @types/jsonwebtoken
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Token Management
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import jwt from "jsonwebtoken";
|
|
21
|
+
|
|
22
|
+
const JWT_SECRET = process.env.JWT_SECRET || "change-me-in-production";
|
|
23
|
+
const JWT_EXPIRES_IN = process.env.JWT_EXPIRES_IN || "24h";
|
|
24
|
+
|
|
25
|
+
interface AuthPayload {
|
|
26
|
+
sub: string; // User ID
|
|
27
|
+
email: string; // User email
|
|
28
|
+
role: string; // User role (ADMIN, DEVELOPER, VIEWER)
|
|
29
|
+
iat?: number; // Issued at
|
|
30
|
+
exp?: number; // Expires at
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function generateToken(payload: AuthPayload): string {
|
|
34
|
+
return jwt.sign(payload, JWT_SECRET, { expiresIn: JWT_EXPIRES_IN });
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function verifyToken(token: string): AuthPayload {
|
|
38
|
+
return jwt.verify(token, JWT_SECRET) as AuthPayload;
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Middleware
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
import type { FastifyRequest, FastifyReply } from "fastify";
|
|
46
|
+
|
|
47
|
+
export async function authenticate(
|
|
48
|
+
request: FastifyRequest,
|
|
49
|
+
reply: FastifyReply,
|
|
50
|
+
): Promise<void> {
|
|
51
|
+
const authHeader = request.headers.authorization;
|
|
52
|
+
if (!authHeader?.startsWith("Bearer ")) {
|
|
53
|
+
throw new UnauthorizedError("Missing authorization header");
|
|
54
|
+
}
|
|
55
|
+
const token = authHeader.slice(7);
|
|
56
|
+
const payload = verifyToken(token);
|
|
57
|
+
(request as any).user = payload;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function requireRole(...roles: string[]) {
|
|
61
|
+
return async (request: FastifyRequest, reply: FastifyReply) => {
|
|
62
|
+
const user = (request as any).user as AuthPayload;
|
|
63
|
+
if (!user || !roles.includes(user.role)) {
|
|
64
|
+
throw new ForbiddenError("Insufficient permissions");
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Password Security
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
import bcrypt from "bcrypt";
|
|
74
|
+
|
|
75
|
+
const SALT_ROUNDS = 12;
|
|
76
|
+
|
|
77
|
+
// Hash password for storage
|
|
78
|
+
export async function hashPassword(password: string): Promise<string> {
|
|
79
|
+
return bcrypt.hash(password, SALT_ROUNDS);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Verify password against hash
|
|
83
|
+
export async function verifyPassword(
|
|
84
|
+
password: string,
|
|
85
|
+
hash: string,
|
|
86
|
+
): Promise<boolean> {
|
|
87
|
+
return bcrypt.compare(password, hash);
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## CRUD Governance Integration
|
|
92
|
+
|
|
93
|
+
Admin-level mutations (user creation, role changes, schema modifications) **MUST** follow the CRUD Governance protocol:
|
|
94
|
+
- Route through `@manager` for approval
|
|
95
|
+
- Require human sign-off via `agent-enderun approve <traceId>`
|
|
96
|
+
- Log all authorization decisions
|
|
97
|
+
|
|
98
|
+
## API Endpoints
|
|
99
|
+
|
|
100
|
+
| Method | Path | Auth Required | Role Required | Description |
|
|
101
|
+
|--------|------|:------------:|:------------:|-------------|
|
|
102
|
+
| POST | `/api/v1/auth/register` | No | No | Create new user |
|
|
103
|
+
| POST | `/api/v1/auth/login` | No | No | Login & get token |
|
|
104
|
+
| GET | `/api/v1/auth/me` | Yes | No | Get current user |
|
|
105
|
+
| PUT | `/api/v1/auth/password` | Yes | No | Change password |
|
|
106
|
+
|
|
107
|
+
## Environment Variables
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
JWT_SECRET=your-secret-key-at-least-32-chars-long
|
|
111
|
+
JWT_EXPIRES_IN=24h
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Best Practices
|
|
115
|
+
|
|
116
|
+
1. **Password Hashing**: Always use bcrypt with minimum 12 salt rounds
|
|
117
|
+
2. **Token Expiry**: Use short-lived tokens (24h max). Implement refresh tokens for longer sessions
|
|
118
|
+
3. **Secret Rotation**: Rotate JWT_SECRET periodically in production
|
|
119
|
+
4. **Rate Limiting**: Apply rate limiting on login/register endpoints to prevent brute force
|
|
120
|
+
5. **HTTPS Only**: Never transmit tokens over unencrypted connections
|
|
121
|
+
6. **Password Strength**: Enforce minimum password requirements (8+ chars, mixed case, numbers)
|
|
122
|
+
7. **Audit Logging**: Log all authentication attempts (success/failure) for security monitoring
|
|
123
|
+
8. **No Plain Text**: Never log or store passwords in plain text
|
|
124
|
+
9. **Token Storage**: Store tokens securely (httpOnly cookies for web, secure storage for mobile)
|
|
125
|
+
10. **Role Hierarchy**: ADMIN > MANAGER > DEVELOPER > VIEWER — validate permissions at each level
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# 🏛️ Corporate CRUD and Governance Standards
|
|
2
|
+
|
|
3
|
+
This document defines the strict rules applicable to data mutation and administrative operations in projects managed by the Agent Enderun army.
|
|
4
|
+
|
|
5
|
+
## 1. High-Risk Operations
|
|
6
|
+
The following operations are considered "High-Risk" and cannot be performed autonomously by specialist agents (@backend, @database, etc.):
|
|
7
|
+
- Database schema changes (DDL).
|
|
8
|
+
- Bulk data deletion or purging (Bulk Delete/Purge).
|
|
9
|
+
- User authorization and role assignment systems.
|
|
10
|
+
- Payment system (Billing) integrations.
|
|
11
|
+
- PII (Personal Data) export.
|
|
12
|
+
|
|
13
|
+
## 2. Approval Flow
|
|
14
|
+
- When a specialist agent receives a high-risk operation request, they must reject the operation and report the status to `@manager`.
|
|
15
|
+
- `@manager` analyzes the request and creates a task awaiting `managerApproval`.
|
|
16
|
+
- The operation is held until a human overseer (Human-in-the-Loop) grants approval via the `agent-enderun approve [TraceID]` command.
|
|
17
|
+
|
|
18
|
+
## 3. Data Discipline
|
|
19
|
+
- **Branded Types:** All IDs (UserID, OrderID, etc.) must strictly follow the branded types format.
|
|
20
|
+
- **Kysely Only:** Raw SQL queries are forbidden. Only the type-safe Kysely query builder may be used.
|
|
21
|
+
- **Repository Pattern:** Database operations cannot be performed directly within controllers; they must pass through the service and repository layers.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# 🚀 Deployment and Release Standards
|
|
2
|
+
|
|
3
|
+
This document outlines the protocols for deploying, updating, and rolling back services managed by Agent Enderun.
|
|
4
|
+
|
|
5
|
+
## 1. Release Strategy
|
|
6
|
+
- **Version Control:** All releases must follow Semantic Versioning (SemVer) and be tagged in Git with the format `vX.Y.Z`.
|
|
7
|
+
- **Atomic Commits:** Each deployment must be linked to a specific Git commit, which itself must contain a `Trace ID` in the commit message.
|
|
8
|
+
|
|
9
|
+
## 2. Deployment Workflow
|
|
10
|
+
- **CI/CD Integration:** Every deployment must pass the `npm run enderun:test` and `npm run enderun:check` pipeline.
|
|
11
|
+
- **Environment Isolation:** Deployments must use environment-specific configurations (.env.{env}) and never cross-pollinate variables.
|
|
12
|
+
|
|
13
|
+
## 3. Rollback Procedures (The Hermes Safety Valve)
|
|
14
|
+
- **Immediate Rollback:** If a deployment causes an escalation alert from an agent or a production failure, a rollback must be initiated within 5 minutes.
|
|
15
|
+
- **Git Revert Strategy:**
|
|
16
|
+
- Rollbacks are executed by checking out the previous stable tag (e.g., `git checkout v1.0.9`).
|
|
17
|
+
- A "Fix-Forward" approach is only allowed for P0 security patches; otherwise, "Revert-First" is the law.
|
|
18
|
+
- **Database Safety:**
|
|
19
|
+
- Every Migration script must strictly include a corresponding `down()` or `revert()` path.
|
|
20
|
+
- Database rollbacks must be tested in the staging environment before production execution.
|
|
21
|
+
- **Post-Mortem Requirement:** Every rollback triggers an automatic `@manager` task to create a `docs/post-mortems/TRACE_ID.md` report.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# 🎨 Corporate Frontend and Responsive Standards
|
|
2
|
+
|
|
3
|
+
This document defines the UI/UX standards for projects managed by Agent Enderun. All interfaces must comply with "Mobile-First", "Fluid Responsive", and "Cross-Device Adaptive" principles.
|
|
4
|
+
|
|
5
|
+
## 1. Design System: Panda CSS & Tailwind Integration
|
|
6
|
+
- **Zero UI Library:** Heavy external UI libraries like Ant Design or MUI are not used. All styles are written with type-safe **Panda CSS** or structured **Tailwind CSS**.
|
|
7
|
+
- **Token Usage:** Colors, spacing, and font sizes must be managed via the `token()` function or standard CSS variables.
|
|
8
|
+
- **Responsive Syntax:** Object-based responsive syntax is mandatory:
|
|
9
|
+
```typescript
|
|
10
|
+
css({
|
|
11
|
+
width: { base: '100%', md: '50%', lg: '33.33%' },
|
|
12
|
+
padding: { base: '4', md: '8' }
|
|
13
|
+
})
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## 2. Mobile-First and Fluid Design
|
|
17
|
+
- **Mobile-First Approach:** Styles must always be written for the smallest screen size (`base`), then expanded to larger screens using `sm`, `md`, `lg`, `xl`, and `2xl` breakpoints.
|
|
18
|
+
- **Fluid Grid & Flexbox:** Layouts should not be restricted by fixed widths. `flex-wrap` and CSS Grid (`grid-template-columns: repeat(auto-fit, minmax(280px, 1fr))`) are preferred.
|
|
19
|
+
- **Fluid Typography:** Font sizes should scale dynamically based on screen width:
|
|
20
|
+
```css
|
|
21
|
+
font-size: clamp(1rem, 2vw + 0.5rem, 2rem);
|
|
22
|
+
```
|
|
23
|
+
- **Container Bounds:** The main body of the page must have responsive padding and a maximum width limit (standard of `1280px` or `1440px`).
|
|
24
|
+
|
|
25
|
+
## 3. Viewport Safety
|
|
26
|
+
- **Overflow Guard:** Horizontal scrollbars are strictly forbidden. `box-sizing: border-box` must be applied to all elements, and widths must be restricted with `max-width: 100%`.
|
|
27
|
+
- **Dynamic Viewport Units:** To avoid issues with mobile browser address bars, use `dvh` (Dynamic Viewport Height) and `dvw` instead of `vh` and `vw`.
|
|
28
|
+
- **Touch Targets:** Clickable elements (buttons, links, inputs) on mobile devices must have a minimum size of `44px x 44px`.
|
|
29
|
+
|
|
30
|
+
## 4. Component Governance
|
|
31
|
+
- **Atomic Design:** UI components must be collected under `apps/web/src/components/ui/`.
|
|
32
|
+
- **Page Isolation:** Reusable atomic components should be preferred over defining styles within page files.
|
|
33
|
+
- **Image Optimization:** Use the `picture` tag or `srcset` for responsive images, and support `@2x` resolutions for retina displays. SVGs must always be scalable via `viewBox`.
|
|
34
|
+
|
|
35
|
+
## 5. Accessibility and Performance
|
|
36
|
+
- **WCAG AA:** All color contrasts and keyboard navigation structures must comply with WCAG AA standards.
|
|
37
|
+
- **Lighthouse Score:** A score of 90+ for performance, accessibility, and SEO should be targeted for all pages.
|