agent-enderun 0.9.3 → 0.9.5

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.
Files changed (50) hide show
  1. package/.enderun/ENDERUN.md +1 -1
  2. package/.enderun/PROJECT_MEMORY.md +16 -0
  3. package/.enderun/STATUS.md +2 -2
  4. package/.enderun/config.json +1 -1
  5. package/.enderun/logs/manager.json +17 -0
  6. package/.enderun/mcp_config.json +4 -2
  7. package/.enderun/memory-graph/shared-facts.json +1 -1
  8. package/README.md +171 -99
  9. package/bin/init-check.js +9 -1
  10. package/bin/update-contract.js +9 -1
  11. package/bin/validate-agent-army.js +9 -1
  12. package/framework-mcp/dist/index.js +43 -225
  13. package/framework-mcp/dist/tools/definitions.js +109 -0
  14. package/framework-mcp/dist/tools/file_system/patch_file.js +18 -0
  15. package/framework-mcp/dist/tools/file_system/read_file.js +7 -0
  16. package/framework-mcp/dist/tools/file_system/replace_text.js +14 -0
  17. package/framework-mcp/dist/tools/file_system/write_file.js +9 -0
  18. package/framework-mcp/dist/tools/framework/get_status.js +5 -0
  19. package/framework-mcp/dist/tools/framework/orchestrate.js +5 -0
  20. package/framework-mcp/dist/tools/framework/update_contract_hash.js +5 -0
  21. package/framework-mcp/dist/tools/framework/update_memory.js +8 -0
  22. package/framework-mcp/dist/tools/index.js +25 -0
  23. package/framework-mcp/dist/tools/messaging/log_action.js +22 -0
  24. package/framework-mcp/dist/tools/messaging/send_message.js +21 -0
  25. package/framework-mcp/dist/tools/types.js +1 -0
  26. package/framework-mcp/dist/utils/cli.js +20 -0
  27. package/framework-mcp/dist/utils/security.js +35 -0
  28. package/framework-mcp/package.json +1 -1
  29. package/framework-mcp/src/declarations.d.ts +17 -3
  30. package/framework-mcp/src/index.ts +50 -262
  31. package/framework-mcp/src/tools/definitions.ts +111 -0
  32. package/framework-mcp/src/tools/file_system/patch_file.ts +23 -0
  33. package/framework-mcp/src/tools/file_system/read_file.ts +9 -0
  34. package/framework-mcp/src/tools/file_system/replace_text.ts +18 -0
  35. package/framework-mcp/src/tools/file_system/write_file.ts +11 -0
  36. package/framework-mcp/src/tools/framework/get_status.ts +7 -0
  37. package/framework-mcp/src/tools/framework/orchestrate.ts +7 -0
  38. package/framework-mcp/src/tools/framework/update_contract_hash.ts +7 -0
  39. package/framework-mcp/src/tools/framework/update_memory.ts +10 -0
  40. package/framework-mcp/src/tools/index.ts +31 -0
  41. package/framework-mcp/src/tools/messaging/log_action.ts +28 -0
  42. package/framework-mcp/src/tools/messaging/send_message.ts +26 -0
  43. package/framework-mcp/src/tools/types.ts +40 -0
  44. package/framework-mcp/src/utils/cli.ts +20 -0
  45. package/framework-mcp/src/utils/security.ts +41 -0
  46. package/mcp.json +4 -2
  47. package/package.json +2 -2
  48. package/src/cli/adapters.ts +4 -1
  49. package/src/cli/utils/app.ts +1 -10
  50. package/src/cli/utils/claude.ts +8 -3
@@ -0,0 +1,40 @@
1
+ export interface ToolDefinition {
2
+ name: string;
3
+ description: string;
4
+ inputSchema: {
5
+ type: "object";
6
+ properties: Record<string, { type: string; description?: string; enum?: string[] }>;
7
+ required?: string[];
8
+ };
9
+ }
10
+
11
+ export interface CallToolRequest {
12
+ params: {
13
+ name: string;
14
+ arguments?: ToolArgs;
15
+ };
16
+ }
17
+
18
+ export interface ToolArgs {
19
+ path?: string;
20
+ content?: string;
21
+ oldText?: string;
22
+ newText?: string;
23
+ startLine?: number;
24
+ endLine?: number;
25
+ newContent?: string;
26
+ section?: string;
27
+ to?: string;
28
+ category?: "ACTION" | "DELEGATION" | "INFO" | "ALERT";
29
+ traceId?: string;
30
+ agent?: string;
31
+ action?: string;
32
+ status?: "SUCCESS" | "FAILURE";
33
+ summary?: string;
34
+ findings?: string;
35
+ }
36
+
37
+ export interface ToolResult {
38
+ isError?: boolean;
39
+ content: Array<{ type: "text"; text: string }>;
40
+ }
@@ -0,0 +1,20 @@
1
+ import { execFileSync } from "child_process";
2
+
3
+ /**
4
+ * Executes a CLI command safely using execFileSync (no shell injection risk).
5
+ * Captures stderr gracefully to prevent stream crashes.
6
+ */
7
+ export function safeExec(command: string, args: string[], cwd: string): string {
8
+ try {
9
+ return execFileSync(command, args, {
10
+ cwd,
11
+ encoding: "utf8",
12
+ timeout: 30000,
13
+ maxBuffer: 1024 * 1024,
14
+ stdio: ["pipe", "pipe", "pipe"],
15
+ });
16
+ } catch (error: unknown) {
17
+ const err = error as { stderr?: string; message?: string };
18
+ throw new Error(err.stderr || err.message || "Command execution failed");
19
+ }
20
+ }
@@ -0,0 +1,41 @@
1
+ import path from "path";
2
+ import fs from "fs";
3
+
4
+ /**
5
+ * Validates and resolves a user-provided path to prevent path traversal attacks.
6
+ * Ensures the resolved path stays within the project root boundary.
7
+ */
8
+ export function safePath(projectRoot: string, userPath: string): string {
9
+ const resolved = path.resolve(projectRoot, userPath);
10
+ const normalizedRoot = path.resolve(projectRoot);
11
+
12
+ if (!resolved.startsWith(normalizedRoot + path.sep) && resolved !== normalizedRoot) {
13
+ throw new Error(`Access denied: path "${userPath}" escapes project root.`);
14
+ }
15
+
16
+ return resolved;
17
+ }
18
+
19
+ /**
20
+ * Resolves the active framework directory by scanning known candidates.
21
+ */
22
+ export function resolveFrameworkDir(projectRoot: string): string {
23
+ const candidates = [
24
+ ".gemini/antigravity",
25
+ ".gemini/antigravity-cli",
26
+ ".gemini",
27
+ ".claude",
28
+ ".grok",
29
+ ".agent",
30
+ ".enderun",
31
+ ];
32
+
33
+ for (const candidate of candidates) {
34
+ const candidatePath = path.join(projectRoot, candidate);
35
+ if (fs.existsSync(candidatePath)) {
36
+ return candidate;
37
+ }
38
+ }
39
+
40
+ return ".enderun";
41
+ }
package/mcp.json CHANGED
@@ -2,8 +2,10 @@
2
2
  "mcpServers": {
3
3
  "agent-enderun": {
4
4
  "command": "node",
5
- "args": ["framework-mcp/dist/index.js"],
5
+ "args": [
6
+ "framework-mcp/dist/index.js"
7
+ ],
6
8
  "env": {}
7
9
  }
8
10
  }
9
- }
11
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-enderun",
3
- "version": "0.9.3",
3
+ "version": "0.9.5",
4
4
  "description": "The Supreme AI Governance & Orchestration Framework for Enterprise Development",
5
5
  "author": "Yusuf BEKAR",
6
6
  "license": "MIT",
@@ -85,4 +85,4 @@
85
85
  "version": "0.9.0",
86
86
  "initializedAt": "2026-05-29T13:21:18.516Z"
87
87
  }
88
- }
88
+ }
@@ -35,7 +35,7 @@ export const ADAPTERS: Record<AdapterId, AdapterConfig> = {
35
35
  },
36
36
  grok: {
37
37
  id: "grok",
38
- frameworkDir: ".agent", // Future-proof agent-centric directory for Grok/X.ai
38
+ frameworkDir: ".grok", // Standard config directory for Grok/X.ai agent
39
39
  shimFile: "grok.md",
40
40
  templateDir: ".enderun",
41
41
  },
@@ -63,6 +63,7 @@ export const FRAMEWORK_DIR_CANDIDATES = [
63
63
  ".gemini/antigravity-cli",
64
64
  ".gemini",
65
65
  ".claude",
66
+ ".grok",
66
67
  ".agent",
67
68
  ".enderun",
68
69
  ] as const;
@@ -196,6 +197,8 @@ export function runAdapterPostInit(adapter: AdapterConfig, projectRoot: string):
196
197
  console.warn("⚠️ Claude config not found. Add MCP manually (see README).");
197
198
  }
198
199
  writeJsonFile(path.join(projectRoot, adapter.frameworkDir, "mcp_config.json"), mcpBlock);
200
+ writeJsonFile(path.join(projectRoot, ".mcp.json"), mcpBlock);
201
+ console.warn("✅ Claude Code Project MCP → .mcp.json");
199
202
  break;
200
203
  }
201
204
  default:
@@ -4,7 +4,7 @@ import crypto from "crypto";
4
4
  import { ensureDir, writeTextFile, writeJsonFile } from "../utils/fs.js";
5
5
  import { updateProjectMemoryCommand } from "../commands/memory.js";
6
6
  import { slugifyName, titleCase } from "../utils/string.js";
7
- import { getConfiguredPaths } from "./memory.js";
7
+ import { getConfiguredPaths, getFrameworkDir, getMemoryPath } from "./memory.js";
8
8
 
9
9
 
10
10
  const targetDir = process.cwd(); // Assuming targetDir is process.cwd() in the CLI context
@@ -752,13 +752,4 @@ export async function collectCreateAppDescription(args: string[]) {
752
752
  }
753
753
  }
754
754
 
755
- function getFrameworkDir(): string {
756
- for (const dir of [".gemini", ".claude", ".agent", ".enderun"]) {
757
- if (fs.existsSync(path.join(process.cwd(), dir))) return dir;
758
- }
759
- return ".gemini";
760
- }
761
755
 
762
- function getMemoryPath(): string {
763
- return path.join(process.cwd(), getFrameworkDir(), "PROJECT_MEMORY.md");
764
- }
@@ -9,11 +9,16 @@ export function findClaudeConfigPath(): string | null {
9
9
  if (!home) return null;
10
10
 
11
11
  const possiblePaths = [
12
+ // Claude Desktop
13
+ path.join(home, "Library", "Application Support", "Claude", "claude_desktop_config.json"), // macOS Claude Desktop
14
+ path.join(home, "AppData", "Roaming", "Claude", "claude_desktop_config.json"), // Windows Claude Desktop
15
+ // Claude Code CLI
16
+ path.join(home, ".claude.json"), // Global Claude Code CLI MCP config
17
+ // Legacy or system-specific paths
12
18
  path.join(home, ".config", "claude", "config.json"),
13
19
  path.join(home, ".claude", "config.json"),
14
- path.join(home, "Library", "Application Support", "Claude", "config.json"), // macOS Claude Desktop
15
- path.join(home, "Library", "Application Support", "Claude Code", "config.json"), // macOS Claude Code
16
- path.join(home, ".config", "Claude", "config.json"), // some Linux setups
20
+ path.join(home, "Library", "Application Support", "Claude Code", "config.json"),
21
+ path.join(home, ".config", "Claude", "config.json"),
17
22
  ];
18
23
 
19
24
  for (const p of possiblePaths) {