@codai/axiom-mcp 1.0.20 → 1.0.22

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/dist/server.js CHANGED
@@ -65,12 +65,41 @@ const server = http.createServer(async (req, res) => {
65
65
  if (!input.manifest)
66
66
  return send(res, 400, { error: "Missing manifest" });
67
67
  const mode = input.mode || "fs";
68
- const result = await apply({
69
- manifest: input.manifest,
70
- mode: mode,
71
- repoPath: input.repoPath, // Optional - va folosi process.cwd() dacă lipsește
72
- branchName: input.branchName,
73
- commitMessage: input.commitMessage,
68
+ try {
69
+ const result = await apply({
70
+ manifest: input.manifest,
71
+ mode: mode,
72
+ repoPath: input.repoPath, // Optional - va folosi process.cwd() dacă lipsește
73
+ branchName: input.branchName,
74
+ commitMessage: input.commitMessage,
75
+ });
76
+ // Check for ERR_REPOPATH_RELATIVE_UNSAFE and provide friendly guidance
77
+ if (!result.success && result.error?.includes("ERR_REPOPATH_RELATIVE_UNSAFE")) {
78
+ return send(res, 200, {
79
+ ...result,
80
+ errorCode: "ERR_REPOPATH_RELATIVE_UNSAFE",
81
+ hint: "Furnizează repoPath absolut sau setează AXIOM_REPO_ROOT la rădăcina repo-ului."
82
+ });
83
+ }
84
+ return send(res, 200, result);
85
+ }
86
+ catch (err) {
87
+ // Catch any other apply errors
88
+ return send(res, 500, {
89
+ success: false,
90
+ mode,
91
+ filesWritten: [],
92
+ error: err.message
93
+ });
94
+ }
95
+ }
96
+ if (req.method === "POST" && req.url === "/fs-probe-write") {
97
+ // Independent cross-drive write testing
98
+ const { fs_probe_write } = await import("./tools/fs-probe-write.js");
99
+ const result = await fs_probe_write({
100
+ destAbs: input.destAbs,
101
+ contentUtf8: input.contentUtf8,
102
+ contentBase64: input.contentBase64
74
103
  });
75
104
  return send(res, 200, result);
76
105
  }
@@ -0,0 +1,81 @@
1
+ import fs from "node:fs";
2
+ import crypto from "node:crypto";
3
+ import path from "node:path";
4
+ /**
5
+ * fs_probe_write - Independent cross-drive write testing tool
6
+ *
7
+ * Tests filesystem write capabilities independently of AXIOM manifest logic.
8
+ * Useful for validating cross-drive writes and arbitrary path support.
9
+ */
10
+ export async function fs_probe_write(args) {
11
+ const { destAbs, contentUtf8, contentBase64 } = args;
12
+ try {
13
+ console.error(`[fs-probe-write] Testing write to: ${destAbs}`);
14
+ // Determine content source
15
+ let content;
16
+ if (contentBase64) {
17
+ console.error(`[fs-probe-write] Source: contentBase64 (${contentBase64.length} chars)`);
18
+ content = Buffer.from(contentBase64, "base64");
19
+ }
20
+ else if (contentUtf8) {
21
+ console.error(`[fs-probe-write] Source: contentUtf8 (${contentUtf8.length} chars)`);
22
+ content = Buffer.from(contentUtf8, "utf8");
23
+ }
24
+ else {
25
+ throw new Error("ERR_NO_CONTENT: Must provide either contentUtf8 or contentBase64");
26
+ }
27
+ console.error(`[fs-probe-write] Buffer size: ${content.length} bytes`);
28
+ // Create parent directory
29
+ const dir = path.dirname(destAbs);
30
+ console.error(`[fs-probe-write] mkdir: ${dir}`);
31
+ await fs.promises.mkdir(dir, { recursive: true });
32
+ // Write file
33
+ console.error(`[fs-probe-write] Writing...`);
34
+ await fs.promises.writeFile(destAbs, content);
35
+ // Read back and verify
36
+ console.error(`[fs-probe-write] Reading back...`);
37
+ const readBack = fs.readFileSync(destAbs);
38
+ const hash = crypto.createHash("sha256").update(readBack).digest("hex");
39
+ const size = readBack.length;
40
+ console.error(`[fs-probe-write] ✓ Read-back size: ${size} bytes`);
41
+ console.error(`[fs-probe-write] ✓ Read-back SHA256: ${hash}`);
42
+ return {
43
+ success: true,
44
+ absPath: destAbs,
45
+ hash,
46
+ size
47
+ };
48
+ }
49
+ catch (error) {
50
+ console.error(`[fs-probe-write] ✗ ERROR: ${error.message}`);
51
+ return {
52
+ success: false,
53
+ absPath: destAbs,
54
+ hash: "",
55
+ size: 0,
56
+ error: error.message
57
+ };
58
+ }
59
+ }
60
+ export const fs_probe_write_def = {
61
+ name: "fs_probe_write",
62
+ description: "Independent cross-drive write testing tool for validating filesystem capabilities",
63
+ inputSchema: {
64
+ type: "object",
65
+ properties: {
66
+ destAbs: {
67
+ type: "string",
68
+ description: "Absolute destination path (can be on any drive)"
69
+ },
70
+ contentUtf8: {
71
+ type: "string",
72
+ description: "Optional UTF-8 content to write"
73
+ },
74
+ contentBase64: {
75
+ type: "string",
76
+ description: "Optional Base64-encoded content to write"
77
+ }
78
+ },
79
+ required: ["destAbs"]
80
+ }
81
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codai/axiom-mcp",
3
- "version": "1.0.20",
3
+ "version": "1.0.22",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "axiom-mcp": "dist/server.js",
@@ -25,7 +25,7 @@
25
25
  "@codai/axiom-emitter-batchjob": "^1.0.1",
26
26
  "@codai/axiom-emitter-docker": "^1.0.1",
27
27
  "@codai/axiom-emitter-webapp": "^1.0.1",
28
- "@codai/axiom-engine": "^1.0.20",
28
+ "@codai/axiom-engine": "^1.0.22",
29
29
  "@codai/axiom-policies": "^1.0.1",
30
30
  "@modelcontextprotocol/sdk": "^1.20.1"
31
31
  },