mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-21 07:32:54 +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>
93 lines
2.8 KiB
JavaScript
93 lines
2.8 KiB
JavaScript
"use strict";
|
|
|
|
const test = require("node:test");
|
|
const assert = require("node:assert/strict");
|
|
|
|
const { ALL_CAPABILITIES } = require("../index.cjs");
|
|
const { CAPABILITY_STATUS, CAPABILITY_SURFACES } = require("../constants.cjs");
|
|
const { getCliRpcMethod } = require("../adapters/cliAdapter.cjs");
|
|
|
|
const IMPLEMENTED_CLI_COMMANDS = [
|
|
["status"],
|
|
["env"],
|
|
["session"],
|
|
["exec"],
|
|
["job-start"],
|
|
["job-poll"],
|
|
["job-stop"],
|
|
["sftp", "list"],
|
|
["sftp", "read"],
|
|
["sftp", "write"],
|
|
["sftp", "download"],
|
|
["sftp", "upload"],
|
|
["sftp", "mkdir"],
|
|
["sftp", "delete"],
|
|
["sftp", "rename"],
|
|
["sftp", "stat"],
|
|
["sftp", "chmod"],
|
|
["sftp", "home"],
|
|
["cancel"],
|
|
["resume"],
|
|
["vault", "host", "get"],
|
|
["vault", "host", "open"],
|
|
["vault", "host-notes", "get"],
|
|
["vault", "host-notes", "set"],
|
|
["notes", "list"],
|
|
["notes", "get"],
|
|
["notes", "create"],
|
|
["notes", "update"],
|
|
["notes", "delete"],
|
|
["notes", "import"],
|
|
["snippets", "list"],
|
|
["snippets", "get"],
|
|
["snippets", "run"],
|
|
["snippets", "create"],
|
|
["snippets", "update"],
|
|
["snippets", "delete"],
|
|
["scripts", "list"],
|
|
["scripts", "get"],
|
|
["scripts", "run"],
|
|
["scripts", "create"],
|
|
["scripts", "update"],
|
|
["scripts", "delete"],
|
|
["scripts", "reference"],
|
|
["scripts", "runs", "list"],
|
|
["scripts", "run", "stop"],
|
|
["scripts", "run", "pause"],
|
|
["scripts", "run", "resume"],
|
|
["scripts", "targets", "set"],
|
|
["vault", "host", "connect-scripts", "list"],
|
|
["vault", "host", "connect-scripts", "set"],
|
|
["portforward", "rules", "list"],
|
|
["portforward", "tunnels", "list"],
|
|
["portforward", "start"],
|
|
["portforward", "stop"],
|
|
];
|
|
|
|
test("every implemented cli command maps to an rpc method", () => {
|
|
for (const command of IMPLEMENTED_CLI_COMMANDS) {
|
|
const rpcMethod = getCliRpcMethod(command);
|
|
assert.ok(rpcMethod, `missing rpc mapping for ${command.join(" ")}`);
|
|
}
|
|
});
|
|
|
|
test("implemented capabilities expose at least one surface binding", () => {
|
|
for (const capability of ALL_CAPABILITIES) {
|
|
if (capability.status !== CAPABILITY_STATUS.IMPLEMENTED) continue;
|
|
const surfaces = Object.keys(capability.surfaces || {});
|
|
assert.ok(surfaces.length > 0, `${capability.id} has no surfaces`);
|
|
const hasRpc = surfaces.some((surface) => capability.surfaces[surface]?.rpcMethod);
|
|
const hasCli = surfaces.some((surface) => capability.surfaces[surface]?.command);
|
|
const hasCatty = Boolean(capability.surfaces[CAPABILITY_SURFACES.CATTY]?.toolName);
|
|
assert.ok(
|
|
hasRpc || hasCli || hasCatty || capability.surfaces[CAPABILITY_SURFACES.BUILTIN]?.mcpTool,
|
|
`${capability.id} has no rpc/cli/catty/mcp binding`,
|
|
);
|
|
}
|
|
});
|
|
|
|
test("capability ids are unique", () => {
|
|
const ids = ALL_CAPABILITIES.map((capability) => capability.id);
|
|
assert.equal(new Set(ids).size, ids.length);
|
|
});
|