agent-enderun 1.0.8 → 1.1.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/.enderun/ARCHITECTURE.md +1 -0
- package/.enderun/BRAIN_DASHBOARD.md +1 -1
- package/.enderun/ENDERUN.md +4 -3
- package/.enderun/SECURITY.md +1 -0
- package/.enderun/STATUS.md +4 -4
- package/.enderun/agents/agent_army_schema.json +71 -77
- package/.enderun/agents/analyst.json +32 -0
- package/.enderun/agents/backend.json +32 -0
- package/.enderun/agents/database.json +32 -0
- package/.enderun/agents/devops.json +32 -0
- package/.enderun/agents/explorer.json +32 -0
- package/.enderun/agents/frontend.json +32 -0
- package/.enderun/agents/git.json +32 -0
- package/.enderun/agents/manager.json +34 -0
- package/.enderun/agents/mobile.json +32 -0
- package/.enderun/agents/native.json +32 -0
- package/.enderun/agents/quality.json +32 -0
- package/.enderun/agents/schema/agent-lifecycle-schema.json +35 -80
- package/.enderun/agents/security.json +32 -0
- package/.enderun/cli-commands.json +7 -5
- package/.enderun/config.json +1 -1
- package/.enderun/knowledge/ARCHITECTURE.md +1 -0
- package/.enderun/knowledge/SECURITY.md +1 -0
- package/.enderun/knowledge/SHIM_TEMPLATE.md +1 -1
- package/.enderun/logs/manager.json +1 -0
- package/.enderun/memory/PROJECT_MEMORY.md +6 -0
- package/.enderun/observability/README.md +1 -1
- package/CLAUDE.md +5 -5
- package/GEMINI.md +8 -5
- package/GROK.md +1 -1
- package/README.md +34 -33
- package/agent.md +1 -1
- package/bin/hermes-sandbox.js +0 -4
- package/bin/init-check.js +0 -1
- package/bin/validate-agent-army.js +34 -92
- package/dist/apps/backend/src/types/index.d.ts +9 -0
- package/dist/apps/backend/src/types/index.js +5 -0
- package/dist/apps/backend/src/types/index.js.map +1 -0
- package/dist/apps/web/src/main.d.ts +1 -0
- package/dist/apps/web/src/main.js +9 -0
- package/dist/apps/web/src/main.js.map +1 -0
- package/dist/apps/web/vite.config.d.ts +2 -0
- package/dist/apps/web/vite.config.js +6 -0
- package/dist/apps/web/vite.config.js.map +1 -0
- package/dist/framework-mcp/src/index.d.ts +1 -0
- package/dist/framework-mcp/src/index.js +71 -0
- package/dist/framework-mcp/src/index.js.map +1 -0
- package/dist/framework-mcp/src/tools/definitions.d.ts +2 -0
- package/dist/framework-mcp/src/tools/definitions.js +111 -0
- package/dist/framework-mcp/src/tools/definitions.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 +19 -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 +8 -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 +32 -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 +10 -0
- package/dist/framework-mcp/src/tools/file_system/write_file.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/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 +5 -0
- package/dist/framework-mcp/src/tools/index.js +26 -0
- package/dist/framework-mcp/src/tools/index.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 +24 -0
- package/dist/framework-mcp/src/tools/messaging/send_message.js.map +1 -0
- package/dist/framework-mcp/src/tools/types.d.ts +47 -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/security.d.ts +12 -0
- package/dist/framework-mcp/src/utils/security.js +54 -0
- package/dist/framework-mcp/src/utils/security.js.map +1 -0
- package/dist/src/cli/adapters.d.ts +32 -0
- package/dist/src/cli/adapters.js +264 -0
- package/dist/src/cli/adapters.js.map +1 -0
- package/dist/src/cli/commands/app.d.ts +4 -0
- package/dist/src/cli/commands/app.js +32 -0
- package/dist/src/cli/commands/app.js.map +1 -0
- package/dist/src/cli/commands/check.d.ts +6 -0
- package/dist/src/cli/commands/check.js +110 -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 +8 -0
- package/dist/src/cli/commands/contract.js +73 -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.d.ts +1 -0
- package/dist/src/cli/commands/init.js +338 -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 +24 -0
- package/dist/src/cli/commands/lint.js.map +1 -0
- package/dist/src/cli/commands/log.d.ts +9 -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 +72 -0
- package/dist/src/cli/commands/memory.js.map +1 -0
- package/dist/src/cli/commands/orchestrate.d.ts +1 -0
- package/dist/src/cli/commands/orchestrate.js +111 -0
- package/dist/src/cli/commands/orchestrate.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 +56 -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 +42 -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 +117 -0
- package/dist/src/cli/index.js.map +1 -0
- package/dist/src/cli/utils/app.d.ts +33 -0
- package/dist/src/cli/utils/app.js +710 -0
- package/dist/src/cli/utils/app.js.map +1 -0
- package/dist/src/cli/utils/claude.d.ts +8 -0
- package/dist/src/cli/utils/claude.js +56 -0
- package/dist/src/cli/utils/claude.js.map +1 -0
- package/dist/src/cli/utils/fs.d.ts +11 -0
- package/dist/src/cli/utils/fs.js +144 -0
- package/dist/src/cli/utils/fs.js.map +1 -0
- package/dist/src/cli/utils/memory.d.ts +14 -0
- package/dist/src/cli/utils/memory.js +173 -0
- package/dist/src/cli/utils/memory.js.map +1 -0
- package/dist/src/cli/utils/pkg.d.ts +24 -0
- package/dist/src/cli/utils/pkg.js +254 -0
- package/dist/src/cli/utils/pkg.js.map +1 -0
- package/dist/src/cli/utils/string.d.ts +6 -0
- package/dist/src/cli/utils/string.js +44 -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/tests/adapter.test.d.ts +1 -0
- package/dist/tests/adapter.test.js +80 -0
- package/dist/tests/adapter.test.js.map +1 -0
- package/dist/tests/framework-init-test/framework-mcp/src/index.d.ts +1 -0
- package/dist/tests/framework-init-test/framework-mcp/src/index.js +71 -0
- package/dist/tests/framework-init-test/framework-mcp/src/index.js.map +1 -0
- package/dist/tests/framework-init-test/framework-mcp/src/tools/definitions.d.ts +2 -0
- package/dist/tests/framework-init-test/framework-mcp/src/tools/definitions.js +111 -0
- package/dist/tests/framework-init-test/framework-mcp/src/tools/definitions.js.map +1 -0
- package/dist/tests/framework-init-test/framework-mcp/src/tools/file_system/patch_file.d.ts +2 -0
- package/dist/tests/framework-init-test/framework-mcp/src/tools/file_system/patch_file.js +19 -0
- package/dist/tests/framework-init-test/framework-mcp/src/tools/file_system/patch_file.js.map +1 -0
- package/dist/tests/framework-init-test/framework-mcp/src/tools/file_system/read_file.d.ts +2 -0
- package/dist/tests/framework-init-test/framework-mcp/src/tools/file_system/read_file.js +8 -0
- package/dist/tests/framework-init-test/framework-mcp/src/tools/file_system/read_file.js.map +1 -0
- package/dist/tests/framework-init-test/framework-mcp/src/tools/file_system/replace_text.d.ts +2 -0
- package/dist/tests/framework-init-test/framework-mcp/src/tools/file_system/replace_text.js +32 -0
- package/dist/tests/framework-init-test/framework-mcp/src/tools/file_system/replace_text.js.map +1 -0
- package/dist/tests/framework-init-test/framework-mcp/src/tools/file_system/write_file.d.ts +2 -0
- package/dist/tests/framework-init-test/framework-mcp/src/tools/file_system/write_file.js +10 -0
- package/dist/tests/framework-init-test/framework-mcp/src/tools/file_system/write_file.js.map +1 -0
- package/dist/tests/framework-init-test/framework-mcp/src/tools/framework/get_status.d.ts +2 -0
- package/dist/tests/framework-init-test/framework-mcp/src/tools/framework/get_status.js +6 -0
- package/dist/tests/framework-init-test/framework-mcp/src/tools/framework/get_status.js.map +1 -0
- package/dist/tests/framework-init-test/framework-mcp/src/tools/framework/orchestrate.d.ts +2 -0
- package/dist/tests/framework-init-test/framework-mcp/src/tools/framework/orchestrate.js +6 -0
- package/dist/tests/framework-init-test/framework-mcp/src/tools/framework/orchestrate.js.map +1 -0
- package/dist/tests/framework-init-test/framework-mcp/src/tools/framework/update_contract_hash.d.ts +2 -0
- package/dist/tests/framework-init-test/framework-mcp/src/tools/framework/update_contract_hash.js +6 -0
- package/dist/tests/framework-init-test/framework-mcp/src/tools/framework/update_contract_hash.js.map +1 -0
- package/dist/tests/framework-init-test/framework-mcp/src/tools/framework/update_memory.d.ts +2 -0
- package/dist/tests/framework-init-test/framework-mcp/src/tools/framework/update_memory.js +9 -0
- package/dist/tests/framework-init-test/framework-mcp/src/tools/framework/update_memory.js.map +1 -0
- package/dist/tests/framework-init-test/framework-mcp/src/tools/index.d.ts +5 -0
- package/dist/tests/framework-init-test/framework-mcp/src/tools/index.js +26 -0
- package/dist/tests/framework-init-test/framework-mcp/src/tools/index.js.map +1 -0
- package/dist/tests/framework-init-test/framework-mcp/src/tools/messaging/log_action.d.ts +2 -0
- package/dist/tests/framework-init-test/framework-mcp/src/tools/messaging/log_action.js +23 -0
- package/dist/tests/framework-init-test/framework-mcp/src/tools/messaging/log_action.js.map +1 -0
- package/dist/tests/framework-init-test/framework-mcp/src/tools/messaging/send_message.d.ts +2 -0
- package/dist/tests/framework-init-test/framework-mcp/src/tools/messaging/send_message.js +24 -0
- package/dist/tests/framework-init-test/framework-mcp/src/tools/messaging/send_message.js.map +1 -0
- package/dist/tests/framework-init-test/framework-mcp/src/tools/types.d.ts +47 -0
- package/dist/tests/framework-init-test/framework-mcp/src/tools/types.js +2 -0
- package/dist/tests/framework-init-test/framework-mcp/src/tools/types.js.map +1 -0
- package/dist/tests/framework-init-test/framework-mcp/src/utils/cli.d.ts +5 -0
- package/dist/tests/framework-init-test/framework-mcp/src/utils/cli.js +21 -0
- package/dist/tests/framework-init-test/framework-mcp/src/utils/cli.js.map +1 -0
- package/dist/tests/framework-init-test/framework-mcp/src/utils/security.d.ts +12 -0
- package/dist/tests/framework-init-test/framework-mcp/src/utils/security.js +54 -0
- package/dist/tests/framework-init-test/framework-mcp/src/utils/security.js.map +1 -0
- package/dist/tests/framework-init-test/framework-mcp/tests/tools/file_system/replace_text.test.d.ts +1 -0
- package/dist/tests/framework-init-test/framework-mcp/tests/tools/file_system/replace_text.test.js +69 -0
- package/dist/tests/framework-init-test/framework-mcp/tests/tools/file_system/replace_text.test.js.map +1 -0
- package/dist/tests/framework-init-test/panda.config.d.ts +4 -0
- package/dist/tests/framework-init-test/panda.config.js +95 -0
- package/dist/tests/framework-init-test/panda.config.js.map +1 -0
- package/dist/tests/framework-init-test/vitest.config.d.ts +2 -0
- package/dist/tests/framework-init-test/vitest.config.js +19 -0
- package/dist/tests/framework-init-test/vitest.config.js.map +1 -0
- package/dist/tests/gemini.test.d.ts +1 -0
- package/dist/tests/gemini.test.js +38 -0
- package/dist/tests/gemini.test.js.map +1 -0
- package/dist/tests/initial.test.d.ts +1 -0
- package/dist/tests/initial.test.js +7 -0
- package/dist/tests/initial.test.js.map +1 -0
- package/dist/vitest.config.d.ts +2 -0
- package/dist/vitest.config.js +19 -0
- package/dist/vitest.config.js.map +1 -0
- package/eslint.config.js +1 -1
- package/framework-mcp/dist/index.js +2 -2
- package/framework-mcp/dist/src/index.js +70 -0
- package/framework-mcp/dist/src/tools/definitions.js +110 -0
- package/framework-mcp/dist/src/tools/file_system/patch_file.js +18 -0
- package/framework-mcp/dist/src/tools/file_system/read_file.js +7 -0
- package/framework-mcp/dist/src/tools/file_system/replace_text.js +31 -0
- package/framework-mcp/dist/src/tools/file_system/write_file.js +9 -0
- package/framework-mcp/dist/src/tools/framework/get_status.js +5 -0
- package/framework-mcp/dist/src/tools/framework/orchestrate.js +5 -0
- package/framework-mcp/dist/src/tools/framework/update_contract_hash.js +5 -0
- package/framework-mcp/dist/src/tools/framework/update_memory.js +8 -0
- package/framework-mcp/dist/src/tools/index.js +25 -0
- package/framework-mcp/dist/src/tools/messaging/log_action.js +22 -0
- package/framework-mcp/dist/src/tools/messaging/send_message.js +46 -0
- package/framework-mcp/dist/src/tools/types.js +1 -0
- package/framework-mcp/dist/src/utils/cli.js +20 -0
- package/framework-mcp/dist/src/utils/security.js +53 -0
- package/framework-mcp/dist/tests/tools/file_system/replace_text.test.js +68 -0
- package/framework-mcp/dist/tools/definitions.js +1 -0
- package/framework-mcp/dist/tools/file_system/replace_text.js +18 -1
- package/framework-mcp/dist/tools/framework/get_status.js +2 -2
- package/framework-mcp/dist/tools/framework/orchestrate.js +2 -2
- package/framework-mcp/dist/tools/framework/update_contract_hash.js +2 -2
- package/framework-mcp/dist/tools/framework/update_memory.js +1 -1
- package/framework-mcp/dist/tools/messaging/send_message.js +4 -2
- package/framework-mcp/dist/utils/cli.js +2 -2
- package/framework-mcp/dist/utils/security.js +23 -5
- package/framework-mcp/package.json +3 -3
- package/framework-mcp/src/index.ts +2 -2
- package/framework-mcp/src/tools/definitions.ts +1 -0
- package/framework-mcp/src/tools/file_system/replace_text.ts +21 -1
- package/framework-mcp/src/tools/framework/get_status.ts +3 -3
- package/framework-mcp/src/tools/framework/orchestrate.ts +3 -3
- package/framework-mcp/src/tools/framework/update_contract_hash.ts +3 -3
- package/framework-mcp/src/tools/framework/update_memory.ts +1 -1
- package/framework-mcp/src/tools/messaging/send_message.ts +37 -13
- package/framework-mcp/src/tools/types.ts +3 -0
- package/framework-mcp/src/utils/cli.ts +2 -2
- package/framework-mcp/src/utils/security.ts +23 -5
- package/framework-mcp/tests/tools/file_system/replace_text.test.js +68 -0
- package/framework-mcp/tests/tools/file_system/replace_text.test.ts +77 -0
- package/framework-mcp/tsconfig.json +1 -2
- package/mcp.json +4 -4
- package/package.json +4 -3
- package/src/cli/adapters.ts +16 -9
- package/src/cli/commands/contract.ts +2 -2
- package/src/cli/commands/init.ts +211 -432
- package/src/cli/commands/memory.ts +5 -0
- package/src/cli/commands/orchestrate.ts +53 -0
- package/src/cli/index.ts +99 -19
- package/src/cli/utils/app.ts +19 -16
- package/src/cli/utils/claude.ts +2 -1
- package/src/cli/utils/fs.ts +2 -1
- package/src/cli/utils/memory.ts +2 -2
- package/src/cli/utils/pkg.ts +32 -0
- package/.enderun/agents/analyst.md +0 -32
- package/.enderun/agents/backend.md +0 -49
- package/.enderun/agents/database.md +0 -41
- package/.enderun/agents/devops.md +0 -41
- package/.enderun/agents/explorer.md +0 -40
- package/.enderun/agents/frontend.md +0 -48
- package/.enderun/agents/git.md +0 -41
- package/.enderun/agents/manager.md +0 -43
- package/.enderun/agents/mobile.md +0 -42
- package/.enderun/agents/native.md +0 -41
- package/.enderun/agents/quality.md +0 -40
- package/.enderun/agents/security.md +0 -32
package/dist/tests/framework-init-test/framework-mcp/tests/tools/file_system/replace_text.test.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import { handleReplaceText } from "../../../src/tools/file_system/replace_text";
|
|
5
|
+
const TEST_DIR = path.join(__dirname, "../_temp_test_files");
|
|
6
|
+
const TEST_FILE = path.join(TEST_DIR, "test_file.txt");
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
fs.mkdirSync(TEST_DIR, { recursive: true });
|
|
9
|
+
});
|
|
10
|
+
afterEach(() => {
|
|
11
|
+
fs.rmSync(TEST_DIR, { recursive: true, force: true });
|
|
12
|
+
});
|
|
13
|
+
describe("handleReplaceText", () => {
|
|
14
|
+
it("should replace a single occurrence of text", () => {
|
|
15
|
+
fs.writeFileSync(TEST_FILE, "hello world", "utf8");
|
|
16
|
+
const args = {
|
|
17
|
+
path: TEST_FILE,
|
|
18
|
+
oldText: "world",
|
|
19
|
+
newText: "there",
|
|
20
|
+
};
|
|
21
|
+
const result = handleReplaceText(TEST_DIR, args);
|
|
22
|
+
expect(result.content[0].text).toContain("✅ Surgical edit successful");
|
|
23
|
+
expect(fs.readFileSync(TEST_FILE, "utf8")).toBe("hello there");
|
|
24
|
+
});
|
|
25
|
+
it("should throw an error if text is not found", () => {
|
|
26
|
+
fs.writeFileSync(TEST_FILE, "hello world", "utf8");
|
|
27
|
+
const args = {
|
|
28
|
+
path: TEST_FILE,
|
|
29
|
+
oldText: "missing",
|
|
30
|
+
newText: "found",
|
|
31
|
+
};
|
|
32
|
+
expect(() => handleReplaceText(TEST_DIR, args)).toThrowError("Text not found in file");
|
|
33
|
+
});
|
|
34
|
+
it("should throw an error for ambiguous replacement if allowMultiple is false", () => {
|
|
35
|
+
fs.writeFileSync(TEST_FILE, "hello world world", "utf8");
|
|
36
|
+
const args = {
|
|
37
|
+
path: TEST_FILE,
|
|
38
|
+
oldText: "world",
|
|
39
|
+
newText: "there",
|
|
40
|
+
allowMultiple: false,
|
|
41
|
+
};
|
|
42
|
+
expect(() => handleReplaceText(TEST_DIR, args)).toThrowError("Ambiguous replacement");
|
|
43
|
+
});
|
|
44
|
+
it("should replace all occurrences of text if allowMultiple is true", () => {
|
|
45
|
+
fs.writeFileSync(TEST_FILE, "hello world world", "utf8");
|
|
46
|
+
const args = {
|
|
47
|
+
path: TEST_FILE,
|
|
48
|
+
oldText: "world",
|
|
49
|
+
newText: "there",
|
|
50
|
+
allowMultiple: true,
|
|
51
|
+
};
|
|
52
|
+
const result = handleReplaceText(TEST_DIR, args);
|
|
53
|
+
expect(result.content[0].text).toContain("✅ Surgical edit successful");
|
|
54
|
+
expect(fs.readFileSync(TEST_FILE, "utf8")).toBe("hello there there");
|
|
55
|
+
});
|
|
56
|
+
it("should handle special characters in oldText when allowMultiple is true", () => {
|
|
57
|
+
fs.writeFileSync(TEST_FILE, "test.txt", "utf8");
|
|
58
|
+
const args = {
|
|
59
|
+
path: TEST_FILE,
|
|
60
|
+
oldText: ".txt",
|
|
61
|
+
newText: ".md",
|
|
62
|
+
allowMultiple: true,
|
|
63
|
+
};
|
|
64
|
+
const result = handleReplaceText(TEST_DIR, args);
|
|
65
|
+
expect(result.content[0].text).toContain("✅ Surgical edit successful");
|
|
66
|
+
expect(fs.readFileSync(TEST_FILE, "utf8")).toBe("test.md");
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
//# sourceMappingURL=replace_text.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replace_text.test.js","sourceRoot":"","sources":["../../../../../../../tests/framework-init-test/framework-mcp/tests/tools/file_system/replace_text.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACrE,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AAGhF,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,qBAAqB,CAAC,CAAC;AAC7D,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;AAEvD,UAAU,CAAC,GAAG,EAAE;IACZ,EAAE,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AE,IAAI,CAAC,CAAC;QACjD,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,4BAA4B,CAAC,CAAC;QACvE,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { defineConfig } from "@pandacss/dev";
|
|
2
|
+
export default defineConfig({
|
|
3
|
+
// Whether to use css reset
|
|
4
|
+
preflight: true,
|
|
5
|
+
// Where to look for your css declarations
|
|
6
|
+
include: [
|
|
7
|
+
"./src/**/*.{js,jsx,ts,tsx}",
|
|
8
|
+
"./pages/**/*.{js,jsx,ts,tsx}",
|
|
9
|
+
"./apps/**/*.{js,jsx,ts,tsx}",
|
|
10
|
+
// Project-internal UI components only (no packages/ui by default)
|
|
11
|
+
"./apps/**/src/components/**/*.{ts,tsx}",
|
|
12
|
+
"./apps/**/src/ui/**/*.{ts,tsx}",
|
|
13
|
+
],
|
|
14
|
+
// Files to exclude
|
|
15
|
+
exclude: [],
|
|
16
|
+
// Conditions for Dark Mode and other states
|
|
17
|
+
conditions: {
|
|
18
|
+
extend: {
|
|
19
|
+
dark: ".dark &, [data-theme='dark'] &",
|
|
20
|
+
light: ".light &, [data-theme='light'] &",
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
// Theme Customization
|
|
24
|
+
theme: {
|
|
25
|
+
extend: {
|
|
26
|
+
// Base Tokens (Absolute Values)
|
|
27
|
+
tokens: {
|
|
28
|
+
colors: {
|
|
29
|
+
brand: {
|
|
30
|
+
50: { value: "#eef2ff" },
|
|
31
|
+
100: { value: "#e0e7ff" },
|
|
32
|
+
200: { value: "#c7d2fe" },
|
|
33
|
+
300: { value: "#a5b4fc" },
|
|
34
|
+
400: { value: "#818cf8" },
|
|
35
|
+
500: { value: "#6366f1" },
|
|
36
|
+
600: { value: "#4f46e5" },
|
|
37
|
+
700: { value: "#4338ca" },
|
|
38
|
+
800: { value: "#3730a3" },
|
|
39
|
+
900: { value: "#312e81" },
|
|
40
|
+
950: { value: "#1e1b4b" },
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
spacing: {
|
|
44
|
+
container: { value: "1200px" },
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
// Semantic Tokens (Theme Aware)
|
|
48
|
+
semanticTokens: {
|
|
49
|
+
colors: {
|
|
50
|
+
bg: {
|
|
51
|
+
canvas: {
|
|
52
|
+
value: { base: "{colors.white}", _dark: "{colors.brand.950}" },
|
|
53
|
+
},
|
|
54
|
+
surface: {
|
|
55
|
+
value: { base: "{colors.gray.50}", _dark: "{colors.brand.900}" },
|
|
56
|
+
},
|
|
57
|
+
muted: {
|
|
58
|
+
value: { base: "{colors.gray.100}", _dark: "{colors.brand.800}" },
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
text: {
|
|
62
|
+
default: {
|
|
63
|
+
value: { base: "{colors.gray.900}", _dark: "{colors.white}" },
|
|
64
|
+
},
|
|
65
|
+
muted: {
|
|
66
|
+
value: { base: "{colors.gray.500}", _dark: "{colors.gray.400}" },
|
|
67
|
+
},
|
|
68
|
+
brand: {
|
|
69
|
+
value: { base: "{colors.brand.600}", _dark: "{colors.brand.400}" },
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
accent: {
|
|
73
|
+
default: {
|
|
74
|
+
value: { base: "{colors.brand.500}", _dark: "{colors.brand.500}" },
|
|
75
|
+
},
|
|
76
|
+
emphasis: {
|
|
77
|
+
value: { base: "{colors.brand.600}", _dark: "{colors.brand.400}" },
|
|
78
|
+
},
|
|
79
|
+
fg: {
|
|
80
|
+
value: { base: "{colors.white}", _dark: "{colors.white}" },
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
border: {
|
|
84
|
+
default: {
|
|
85
|
+
value: { base: "{colors.gray.200}", _dark: "{colors.brand.800}" },
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
// The output directory for your css system
|
|
93
|
+
outdir: "styled-system",
|
|
94
|
+
});
|
|
95
|
+
//# sourceMappingURL=panda.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"panda.config.js","sourceRoot":"","sources":["../../../tests/framework-init-test/panda.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,eAAe,YAAY,CAAC;IACxB,2BAA2B;IAC3B,SAAS,EAAE,IAAI;IAEf,0CAA0C;IAC1C,OAAO,EAAE;QACL,4BAA4B;QAC5B,8BAA8B;QAC9B,6BAA6B;QAC7B,kEAAkE;QAClE,wCAAwC;QACxC,gCAAgC;KACnC;IAED,mBAAmB;IACnB,OAAO,EAAE,EAAE;IAEX,4CAA4C;IAC5C,UAAU,EAAE;QACR,MAAM,EAAE;YACJ,IAAI,EAAE,gCAAgC;YACtC,KAAK,EAAE,kCAAkC;SAC5C;KACJ;IAED,sBAAsB;IACtB,KAAK,EAAE;QACH,MAAM,EAAE;YACJ,gCAAgC;YAChC,MAAM,EAAE;gBACJ,MAAM,EAAE;oBACJ,KAAK,EAAE;wBACH,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE;wBACxB,GAAG,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE;wBACzB,GAAG,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE;wBACzB,GAAG,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE;wBACzB,GAAG,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE;wBACzB,GAAG,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE;wBACzB,GAAG,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE;wBACzB,GAAG,EAAE,EA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4BACA,KAAK,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,gBAAgB,EAAE;yBAC7D;qBACJ;oBACD,MAAM,EAAE;wBACJ,OAAO,EAAE;4BACL,KAAK,EAAE,EAAE,IAAI,EAAE,mBAAmB,EAAE,KAAK,EAAE,oBAAoB,EAAE;yBACpE;qBACJ;iBACJ;aACJ;SACJ;KACJ;IAED,2CAA2C;IAC3C,MAAM,EAAE,eAAe;CAC1B,CAAC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { defineConfig } from "vitest/config";
|
|
2
|
+
export default defineConfig({
|
|
3
|
+
test: {
|
|
4
|
+
globals: true,
|
|
5
|
+
environment: "node",
|
|
6
|
+
include: ["tests/**/*.test.ts", "apps/**/*.test.ts"],
|
|
7
|
+
coverage: {
|
|
8
|
+
provider: "v8",
|
|
9
|
+
reporter: ["text", "json", "html"],
|
|
10
|
+
thresholds: {
|
|
11
|
+
lines: 80,
|
|
12
|
+
functions: 80,
|
|
13
|
+
branches: 80,
|
|
14
|
+
statements: 80,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
//# sourceMappingURL=vitest.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vitest.config.js","sourceRoot":"","sources":["../../../tests/framework-init-test/vitest.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,eAAe,YAAY,CAAC;IACxB,IAAI,EAAE;QACF,OAAO,EAAE,IAAI;QACb,WAAW,EAAE,MAAM;QACnB,OAAO,EAAE,CAAC,oBAAoB,EAAE,mBAAmB,CAAC;QACpD,QAAQ,EAAE;YACN,QAAQ,EAAE,IAAI;YACd,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;YAClC,UAAU,EAAE;gBACR,KAAK,EAAE,EAAE;gBACT,SAAS,EAAE,EAAE;gBACb,QAAQ,EAAE,EAAE;gBACZ,UAAU,EAAE,EAAE;aACjB;SACJ;KACJ;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { resolveAdapter, isAdapterShimFile, remapFrameworkContent } from "../src/cli/adapters.js";
|
|
3
|
+
describe("Agent Enderun — Gemini CLI Engine Integration Tests", () => {
|
|
4
|
+
describe("Gemini Adapter Configuration & Directories", () => {
|
|
5
|
+
it("should successfully resolve the gemini adapter with its distinct .gemini directory name", () => {
|
|
6
|
+
const config = resolveAdapter("gemini");
|
|
7
|
+
expect(config.id).toBe("gemini");
|
|
8
|
+
expect(config.frameworkDir).toBe(".gemini");
|
|
9
|
+
expect(config.shimFile).toBe("gemini.md");
|
|
10
|
+
expect(config.nestedDirs).toContain("agents");
|
|
11
|
+
expect(config.nestedDirs).toContain("skills");
|
|
12
|
+
expect(config.nestedDirs).toContain("knowledge");
|
|
13
|
+
});
|
|
14
|
+
it("should verify that Gemini frameworkDir is distinct from Antigravity CLI paths", () => {
|
|
15
|
+
const geminiConfig = resolveAdapter("gemini");
|
|
16
|
+
const cliConfig = resolveAdapter("antigravity-cli");
|
|
17
|
+
expect(geminiConfig.frameworkDir).not.toBe(cliConfig.frameworkDir);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
describe("Gemini Shim Helpers", () => {
|
|
21
|
+
it("should validate gemini.md as a valid shim file", () => {
|
|
22
|
+
expect(isAdapterShimFile("gemini.md")).toBe(true);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
describe("Gemini Path Remapping", () => {
|
|
26
|
+
it("should replace primary adapter and framework placeholder tokens for gemini", () => {
|
|
27
|
+
const template = "Welcome to {{ADAPTER}} running on {{FRAMEWORK_DIR}}!";
|
|
28
|
+
const output = remapFrameworkContent(template, ".gemini", "gemini");
|
|
29
|
+
expect(output).toBe("Welcome to gemini running on .gemini!");
|
|
30
|
+
});
|
|
31
|
+
it("should surgically remap directories to .gemini subfolders", () => {
|
|
32
|
+
const template = "Constitutions: .enderun/agents/ & .enderun/knowledge/ rules.";
|
|
33
|
+
const output = remapFrameworkContent(template, ".gemini", "gemini");
|
|
34
|
+
expect(output).toBe("Constitutions: .gemini/agents/ & .gemini/knowledge/ rules.");
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=gemini.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gemini.test.js","sourceRoot":"","sources":["../../tests/gemini.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACH,cAAc,EACd,iBAAiB,EACjB,qBAAqB,EACxB,MAAM,wBAAwB,CAAC;AAEhC,QAAQ,CAAC,qDAAqD,EAAE,GAAG,EAAE;IAEjE,QAAQ,CAAC,4CAA4C,EAAE,GAAG,EAAE;QACxD,EAAE,CAAC,yFAAyF,EAAE,GAAG,EAAE;YAC/F,MAAM,MAAM,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;YACxC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACjC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC5C,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAC1C,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;YAC9C,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;YAC9C,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,SAA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{};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initial.test.js","sourceRoot":"","sources":["../../tests/initial.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE9C,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC3B,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;QACvD,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { defineConfig } from "vitest/config";
|
|
2
|
+
export default defineConfig({
|
|
3
|
+
test: {
|
|
4
|
+
globals: true,
|
|
5
|
+
environment: "node",
|
|
6
|
+
include: ["tests/**/*.test.ts", "apps/**/*.test.ts", "framework-mcp/tests/**/*.test.ts"],
|
|
7
|
+
coverage: {
|
|
8
|
+
provider: "v8",
|
|
9
|
+
reporter: ["text", "json", "html"],
|
|
10
|
+
thresholds: {
|
|
11
|
+
lines: 80,
|
|
12
|
+
functions: 80,
|
|
13
|
+
branches: 80,
|
|
14
|
+
statements: 80,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
//# sourceMappingURL=vitest.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vitest.config.js","sourceRoot":"","sources":["../vitest.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,eAAe,YAAY,CAAC;IACxB,IAAI,EAAE;QACF,OAAO,EAAE,IAAI;QACb,WAAW,EAAE,MAAM;QACnB,OAAO,EAAE,CAAC,oBAAoB,EAAE,mBAAmB,EAAE,kCAAkC,CAAC;QACxF,QAAQ,EAAE;YACN,QAAQ,EAAE,IAAI;YACd,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;YAClC,UAAU,EAAE;gBACR,KAAK,EAAE,EAAE;gBACT,SAAS,EAAE,EAAE;gBACb,QAAQ,EAAE,EAAE;gBACZ,UAAU,EAAE,EAAE;aACjB;SACJ;KACJ;CACJ,CAAC,CAAC"}
|
package/eslint.config.js
CHANGED
|
@@ -45,7 +45,7 @@ export default tseslint.config(
|
|
|
45
45
|
rules: {
|
|
46
46
|
...styleRules,
|
|
47
47
|
"no-unused-vars": "off",
|
|
48
|
-
"@typescript-eslint/no-explicit-any": "
|
|
48
|
+
"@typescript-eslint/no-explicit-any": "error",
|
|
49
49
|
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
50
50
|
"@typescript-eslint/no-unused-vars": ["warn", { argsIgnorePattern: "^_" }],
|
|
51
51
|
},
|
|
@@ -4,8 +4,8 @@ import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextpro
|
|
|
4
4
|
import { TOOLS, toolHandlers } from "./tools/index.js";
|
|
5
5
|
// ─── Server Setup ─────────────────────────────────────────────────
|
|
6
6
|
const server = new Server({
|
|
7
|
-
name: "agent-enderun",
|
|
8
|
-
version: "1.0.
|
|
7
|
+
name: "@agent-enderun/mcp",
|
|
8
|
+
version: "1.0.9",
|
|
9
9
|
}, {
|
|
10
10
|
capabilities: {
|
|
11
11
|
tools: {},
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
2
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
4
|
+
import { TOOLS, toolHandlers } from "./tools/index.js";
|
|
5
|
+
// ─── Server Setup ─────────────────────────────────────────────────
|
|
6
|
+
const server = new Server({
|
|
7
|
+
name: "@agent-enderun/mcp",
|
|
8
|
+
version: "1.0.9",
|
|
9
|
+
}, {
|
|
10
|
+
capabilities: {
|
|
11
|
+
tools: {},
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
15
|
+
return { tools: TOOLS };
|
|
16
|
+
});
|
|
17
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
18
|
+
const typedRequest = request;
|
|
19
|
+
const { name, arguments: args } = typedRequest.params;
|
|
20
|
+
const projectRoot = process.env.ENDERUN_PROJECT_ROOT || process.cwd();
|
|
21
|
+
try {
|
|
22
|
+
const handler = toolHandlers[name];
|
|
23
|
+
if (!handler) {
|
|
24
|
+
return {
|
|
25
|
+
isError: true,
|
|
26
|
+
content: [{ type: "text", text: `Unknown tool: ${name}` }],
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
return handler(projectRoot, args || {});
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
const message = error instanceof Error ? error.message : "Unknown error occurred";
|
|
33
|
+
return {
|
|
34
|
+
isError: true,
|
|
35
|
+
content: [{ type: "text", text: message }],
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
// ─── Graceful Startup & Shutdown ──────────────────────────────────
|
|
40
|
+
async function run() {
|
|
41
|
+
const transport = new StdioServerTransport();
|
|
42
|
+
// Prevent unhandled errors from crashing the MCP stream
|
|
43
|
+
process.on("uncaughtException", (error) => {
|
|
44
|
+
process.stderr.write(`[agent-enderun-mcp] Uncaught exception: ${error.message}
|
|
45
|
+
`);
|
|
46
|
+
});
|
|
47
|
+
process.on("unhandledRejection", (reason) => {
|
|
48
|
+
const message = reason instanceof Error ? reason.message : String(reason);
|
|
49
|
+
process.stderr.write(`[agent-enderun-mcp] Unhandled rejection: ${message}
|
|
50
|
+
`);
|
|
51
|
+
});
|
|
52
|
+
// Graceful shutdown on SIGINT/SIGTERM
|
|
53
|
+
const shutdown = async () => {
|
|
54
|
+
try {
|
|
55
|
+
await server.close();
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
// Already closed or failed — safe to ignore
|
|
59
|
+
}
|
|
60
|
+
process.exit(0);
|
|
61
|
+
};
|
|
62
|
+
process.on("SIGINT", shutdown);
|
|
63
|
+
process.on("SIGTERM", shutdown);
|
|
64
|
+
await server.connect(transport);
|
|
65
|
+
}
|
|
66
|
+
run().catch((error) => {
|
|
67
|
+
process.stderr.write(`[agent-enderun-mcp] Fatal startup error: ${error.message}
|
|
68
|
+
`);
|
|
69
|
+
process.exit(1);
|
|
70
|
+
});
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
export const TOOLS = [
|
|
2
|
+
{
|
|
3
|
+
name: "read_file",
|
|
4
|
+
description: "Read the content of a file within the project.",
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: "object",
|
|
7
|
+
properties: {
|
|
8
|
+
path: { type: "string", description: "Path to the file relative to project root" },
|
|
9
|
+
},
|
|
10
|
+
required: ["path"],
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: "write_file",
|
|
15
|
+
description: "Write content to a file. Creates directories if missing.",
|
|
16
|
+
inputSchema: {
|
|
17
|
+
type: "object",
|
|
18
|
+
properties: {
|
|
19
|
+
path: { type: "string", description: "Path to the file relative to project root" },
|
|
20
|
+
content: { type: "string", description: "Complete content of the file" },
|
|
21
|
+
},
|
|
22
|
+
required: ["path", "content"],
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: "replace_text",
|
|
27
|
+
description: "Surgically replace a string in a file with another string.",
|
|
28
|
+
inputSchema: {
|
|
29
|
+
type: "object",
|
|
30
|
+
properties: {
|
|
31
|
+
path: { type: "string", description: "Path to the file" },
|
|
32
|
+
oldText: { type: "string", description: "The exact text to find" },
|
|
33
|
+
newText: { type: "string", description: "The text to replace it with" },
|
|
34
|
+
},
|
|
35
|
+
required: ["path", "oldText", "newText"],
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: "patch_file",
|
|
40
|
+
description: "Safely update a file by replacing a specific line range with new content.",
|
|
41
|
+
inputSchema: {
|
|
42
|
+
type: "object",
|
|
43
|
+
properties: {
|
|
44
|
+
path: { type: "string", description: "Path to the file" },
|
|
45
|
+
startLine: { type: "number", description: "Starting line number (1-indexed)" },
|
|
46
|
+
endLine: { type: "number", description: "Ending line number (inclusive)" },
|
|
47
|
+
newContent: { type: "string", description: "The new lines to insert" },
|
|
48
|
+
},
|
|
49
|
+
required: ["path", "startLine", "endLine", "newContent"],
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: "get_framework_status",
|
|
54
|
+
description: "Get the current project phase, active traces, and agent states.",
|
|
55
|
+
inputSchema: { type: "object", properties: {} },
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: "update_project_memory",
|
|
59
|
+
description: "Update a specific section in PROJECT_MEMORY.md.",
|
|
60
|
+
inputSchema: {
|
|
61
|
+
type: "object",
|
|
62
|
+
properties: {
|
|
63
|
+
section: { type: "string", description: "Section name (e.g., HISTORY, ACTIVE TASKS)" },
|
|
64
|
+
content: { type: "string", description: "Markdown content to append or set" },
|
|
65
|
+
},
|
|
66
|
+
required: ["section", "content"],
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: "orchestrate_loop",
|
|
71
|
+
description: "Process the pending Hermes messages and trigger dynamic state transitions.",
|
|
72
|
+
inputSchema: { type: "object", properties: {} },
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: "send_agent_message",
|
|
76
|
+
description: "Send a Hermes protocol message to another agent.",
|
|
77
|
+
inputSchema: {
|
|
78
|
+
type: "object",
|
|
79
|
+
properties: {
|
|
80
|
+
from: { type: "string", description: "Sender agent (e.g., @manager, @backend). Defaults to @mcp if omitted." },
|
|
81
|
+
to: { type: "string", description: "Target agent (e.g., @backend, @qa)" },
|
|
82
|
+
category: { type: "string", enum: ["ACTION", "DELEGATION", "INFO", "ALERT"] },
|
|
83
|
+
content: { type: "string", description: "Message content" },
|
|
84
|
+
traceId: { type: "string", description: "Active Trace ID" },
|
|
85
|
+
},
|
|
86
|
+
required: ["to", "category", "content", "traceId"],
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: "log_agent_action",
|
|
91
|
+
description: "Log an agent action to the framework logs.",
|
|
92
|
+
inputSchema: {
|
|
93
|
+
type: "object",
|
|
94
|
+
properties: {
|
|
95
|
+
agent: { type: "string", description: "The agent name (e.g., @manager, @backend)" },
|
|
96
|
+
action: { type: "string", description: "Action type or name" },
|
|
97
|
+
traceId: { type: "string", description: "The active Trace ID" },
|
|
98
|
+
status: { type: "string", enum: ["SUCCESS", "FAILURE"], description: "The status of the action" },
|
|
99
|
+
summary: { type: "string", description: "Brief description of the action taken" },
|
|
100
|
+
findings: { type: "string", description: "Optional comma-separated findings or details" }
|
|
101
|
+
},
|
|
102
|
+
required: ["agent", "action", "traceId", "status", "summary"]
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: "update_contract_hash",
|
|
107
|
+
description: "Re-generate and synchronize the backend contract SHA-256 hash.",
|
|
108
|
+
inputSchema: { type: "object", properties: {} }
|
|
109
|
+
}
|
|
110
|
+
];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import { safePath } from "../../utils/security.js";
|
|
3
|
+
export function handlePatchFile(projectRoot, args) {
|
|
4
|
+
const filePath = safePath(projectRoot, args.path);
|
|
5
|
+
const lines = fs.readFileSync(filePath, "utf8").split("\n");
|
|
6
|
+
const start = args.startLine - 1;
|
|
7
|
+
const end = args.endLine;
|
|
8
|
+
const newContent = args.newContent.split("\n");
|
|
9
|
+
if (start < 0 || start > lines.length) {
|
|
10
|
+
throw new Error(`Invalid start line: ${start + 1}. File has ${lines.length} lines.`);
|
|
11
|
+
}
|
|
12
|
+
if (end < start + 1 || end > lines.length) {
|
|
13
|
+
throw new Error(`Invalid end line: ${end}. Must be between ${start + 1} and ${lines.length}.`);
|
|
14
|
+
}
|
|
15
|
+
lines.splice(start, end - start, ...newContent);
|
|
16
|
+
fs.writeFileSync(filePath, lines.join("\n"));
|
|
17
|
+
return { content: [{ type: "text", text: `✅ File patched successfully: ${args.path}` }] };
|
|
18
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import { safePath } from "../../utils/security.js";
|
|
3
|
+
export function handleReadFile(projectRoot, args) {
|
|
4
|
+
const filePath = safePath(projectRoot, args.path);
|
|
5
|
+
const content = fs.readFileSync(filePath, "utf8");
|
|
6
|
+
return { content: [{ type: "text", text: content }] };
|
|
7
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import { safePath } from "../../utils/security.js";
|
|
3
|
+
export function handleReplaceText(projectRoot, args) {
|
|
4
|
+
const filePath = safePath(projectRoot, args.path);
|
|
5
|
+
let content = fs.readFileSync(filePath, "utf8");
|
|
6
|
+
const oldText = args.oldText;
|
|
7
|
+
const newText = args.newText;
|
|
8
|
+
const allowMultiple = args.allowMultiple || false; // Default to false
|
|
9
|
+
if (!content.includes(oldText)) {
|
|
10
|
+
throw new Error(`Text not found in file: ${oldText.slice(0, 100)}...`);
|
|
11
|
+
}
|
|
12
|
+
// Surgical precision guard: reject ambiguous replacements unless allowMultiple is true.
|
|
13
|
+
if (!allowMultiple) {
|
|
14
|
+
const firstIndex = content.indexOf(oldText);
|
|
15
|
+
const lastIndex = content.lastIndexOf(oldText);
|
|
16
|
+
if (firstIndex !== lastIndex) {
|
|
17
|
+
const count = (content.match(new RegExp(oldText.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g")) || []).length;
|
|
18
|
+
throw new Error(`Ambiguous replacement: "${oldText.slice(0, 80)}..." found ${count} times in ${args.path}. ` +
|
|
19
|
+
"Provide a longer, unique context string or set 'allow_multiple' to true.");
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
// Perform replacement(s)
|
|
23
|
+
if (allowMultiple) {
|
|
24
|
+
content = content.replace(new RegExp(oldText.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "g"), newText);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
content = content.replace(oldText, newText);
|
|
28
|
+
}
|
|
29
|
+
fs.writeFileSync(filePath, content);
|
|
30
|
+
return { content: [{ type: "text", text: `✅ Surgical edit successful in ${args.path}` }] };
|
|
31
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { safePath } from "../../utils/security.js";
|
|
4
|
+
export function handleWriteFile(projectRoot, args) {
|
|
5
|
+
const filePath = safePath(projectRoot, args.path);
|
|
6
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
7
|
+
fs.writeFileSync(filePath, args.content);
|
|
8
|
+
return { content: [{ type: "text", text: `✅ File written: ${args.path}` }] };
|
|
9
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { safeExec } from "../../utils/cli.js";
|
|
2
|
+
export function handleUpdateProjectMemory(projectRoot, args) {
|
|
3
|
+
const section = args.section;
|
|
4
|
+
const content = args.content;
|
|
5
|
+
// Using execFileSync with array args prevents command injection
|
|
6
|
+
safeExec("npx", ["agent-enderun", "update_project_memory", section, content], projectRoot, args.timeout);
|
|
7
|
+
return { content: [{ type: "text", text: `✅ Section ${section} updated.` }] };
|
|
8
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { TOOLS } from "./definitions.js";
|
|
2
|
+
import { handleReadFile } from "./file_system/read_file.js";
|
|
3
|
+
import { handleWriteFile } from "./file_system/write_file.js";
|
|
4
|
+
import { handleReplaceText } from "./file_system/replace_text.js";
|
|
5
|
+
import { handlePatchFile } from "./file_system/patch_file.js";
|
|
6
|
+
import { handleGetFrameworkStatus } from "./framework/get_status.js";
|
|
7
|
+
import { handleUpdateProjectMemory } from "./framework/update_memory.js";
|
|
8
|
+
import { handleOrchestrateLoop } from "./framework/orchestrate.js";
|
|
9
|
+
import { handleUpdateContractHash } from "./framework/update_contract_hash.js";
|
|
10
|
+
import { handleSendAgentMessage } from "./messaging/send_message.js";
|
|
11
|
+
import { handleLogAgentAction } from "./messaging/log_action.js";
|
|
12
|
+
// Map of tool names to their handler functions
|
|
13
|
+
export const toolHandlers = {
|
|
14
|
+
read_file: handleReadFile,
|
|
15
|
+
write_file: handleWriteFile,
|
|
16
|
+
replace_text: handleReplaceText,
|
|
17
|
+
patch_file: handlePatchFile,
|
|
18
|
+
get_framework_status: handleGetFrameworkStatus,
|
|
19
|
+
update_project_memory: handleUpdateProjectMemory,
|
|
20
|
+
orchestrate_loop: handleOrchestrateLoop,
|
|
21
|
+
send_agent_message: handleSendAgentMessage,
|
|
22
|
+
log_agent_action: handleLogAgentAction,
|
|
23
|
+
update_contract_hash: handleUpdateContractHash,
|
|
24
|
+
};
|
|
25
|
+
export { TOOLS };
|