apple-notes-mcp 1.4.4 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +97 -6
- package/build/index.js +96 -42
- package/build/services/appleNotesManager.js +261 -147
- package/build/services/appleNotesManager.test.js +204 -67
- package/build/services/attachmentSave.test.js +85 -0
- package/build/services/fileConfig.js +51 -0
- package/build/services/fileConfig.test.js +48 -0
- package/build/tools/doctor.js +50 -0
- package/build/tools/doctor.test.js +42 -0
- package/build/tools/resourcesAndPrompts.js +70 -0
- package/build/tools/resourcesAndPrompts.test.js +63 -0
- package/build/utils/applescript.js +47 -3
- package/build/utils/applescript.test.js +29 -1
- package/build/utils/attachmentFs.js +59 -0
- package/build/utils/attachmentFs.test.js +46 -0
- package/build/utils/jxa.js +17 -0
- package/build/utils/jxa.test.js +20 -1
- package/package.json +1 -1
package/build/utils/jxa.test.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* These tests verify the JXA executor and compare behavior with AppleScript.
|
|
5
5
|
*/
|
|
6
|
-
import { describe, it, expect, vi, beforeEach } from "vitest";
|
|
6
|
+
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
|
|
7
7
|
import { executeJXA, escapeForJXA, buildNotesJXA } from "./jxa.js";
|
|
8
8
|
// Mock execSync to avoid actual osascript calls
|
|
9
9
|
vi.mock("child_process", () => ({
|
|
@@ -68,6 +68,25 @@ describe("executeJXA", () => {
|
|
|
68
68
|
expect(result.success).toBe(false);
|
|
69
69
|
expect(result.error).toContain("Cannot find note");
|
|
70
70
|
});
|
|
71
|
+
describe("hardened executor (#16/#17)", () => {
|
|
72
|
+
afterEach(() => {
|
|
73
|
+
delete process.env.APPLE_NOTES_MCP_MAX_BUFFER;
|
|
74
|
+
});
|
|
75
|
+
it("passes SIGKILL and a large maxBuffer to execSync", () => {
|
|
76
|
+
mockExecSync.mockReturnValue("ok");
|
|
77
|
+
executeJXA("JSON.stringify({})");
|
|
78
|
+
const opts = mockExecSync.mock.calls[0][1];
|
|
79
|
+
expect(opts.killSignal).toBe("SIGKILL");
|
|
80
|
+
expect(opts.maxBuffer).toBe(64 * 1024 * 1024);
|
|
81
|
+
});
|
|
82
|
+
it("honors APPLE_NOTES_MCP_MAX_BUFFER override", () => {
|
|
83
|
+
process.env.APPLE_NOTES_MCP_MAX_BUFFER = "2097152";
|
|
84
|
+
mockExecSync.mockReturnValue("ok");
|
|
85
|
+
executeJXA("JSON.stringify({})");
|
|
86
|
+
const opts = mockExecSync.mock.calls[0][1];
|
|
87
|
+
expect(opts.maxBuffer).toBe(2097152);
|
|
88
|
+
});
|
|
89
|
+
});
|
|
71
90
|
it("handles timeout errors", () => {
|
|
72
91
|
const error = new Error("Command failed");
|
|
73
92
|
error.killed = true;
|