mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-21 23:50:45 +00:00
* feat(vault): let Skills + CLI operate notes with the same approval as MCP Expose vault note list, read, write, and markdown import on the tool CLI so agents can save generated documents only after the user approves. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(vault): keep explicit empty note fields in the CLI A supplied empty string was treated as an omitted flag, so note clears and empty markdown imports never reached the note service. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(vault): allow an explicit empty note body on CLI create notes create --content "" was rejected as a missing flag, so it did not match vault_notes_create. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(vault): stop echoing imported note bodies and recognize leading CLI flags A batch import resent every document over IPC, and a leading --json hid the notes command from artifact inference. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(vault): make note CLI import safe and fail writes cleanly --------- Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: bincxz <16399091+binaricat@users.noreply.github.com>
49 lines
1.9 KiB
JavaScript
49 lines
1.9 KiB
JavaScript
"use strict";
|
|
|
|
const test = require("node:test");
|
|
const assert = require("node:assert/strict");
|
|
|
|
const electronPath = require.resolve("electron");
|
|
const previousElectron = require.cache[electronPath];
|
|
require.cache[electronPath] = {
|
|
id: electronPath,
|
|
filename: electronPath,
|
|
loaded: true,
|
|
exports: { dialog: {}, shell: {} },
|
|
};
|
|
const { buildExternalAgentSystemContext } = require("./aiBridge.cjs");
|
|
if (previousElectron) {
|
|
require.cache[electronPath] = previousElectron;
|
|
} else {
|
|
delete require.cache[electronPath];
|
|
}
|
|
|
|
test("buildExternalAgentSystemContext (MCP mode) includes vault host vs notes guidance", () => {
|
|
const context = buildExternalAgentSystemContext({
|
|
mode: "mcp",
|
|
chatSessionId: "chat-1",
|
|
});
|
|
assert.match(context, /vault_hosts_create/i);
|
|
assert.match(context, /NOT vault_notes_create/i);
|
|
assert.match(context, /do not silently create a Vault note/i);
|
|
});
|
|
|
|
test("buildExternalAgentSystemContext (skills mode) routes attachments through Netcatty CLI", () => {
|
|
const context = buildExternalAgentSystemContext({
|
|
mode: "skills",
|
|
chatSessionId: "chat-1",
|
|
});
|
|
|
|
assert.match(context, /attachment list --json/i);
|
|
assert.match(context, /attachment read --filename <filename> --json/i);
|
|
assert.match(context, /already bound in this process via the host environment/i);
|
|
assert.doesNotMatch(context, /--chat-session/);
|
|
assert.match(context, /Use the local shell only to invoke Netcatty CLI commands/i);
|
|
assert.match(context, /notes list\|get\|create\|update\|delete\|import --json/);
|
|
assert.match(context, /notes create or notes update ONLY when the user explicitly wants/i);
|
|
assert.match(context, /notes import --attachment-index from attachment list for attached Markdown/i);
|
|
assert.match(context, /Never interpolate note text into a shell command/i);
|
|
assert.match(context, /do not silently create a Vault note/i);
|
|
assert.match(context, /if approval is denied, stop/i);
|
|
});
|