Files
SenMeshNet/electron/capabilities/catalog/integrity.test.cjs
zhaolei 2f9f8da48e
Some checks failed
AI automation / Route event (push) Has been cancelled
AI automation / Hand reopened issue to maintainers (push) Has been cancelled
AI automation / Clean source issue state (push) Has been cancelled
AI automation / Reconcile handoffs (push) Has been cancelled
AI automation / Classify issue (push) Has been cancelled
AI automation / Claude Code smoke (push) Has been cancelled
AI automation / Review issue follow-up (push) Has been cancelled
AI automation / Publish issue follow-up (push) Has been cancelled
AI automation / Implement with Claude Code (push) Has been cancelled
AI automation / Publish implement PR (push) Has been cancelled
AI automation / Continue queued issue comments (push) Has been cancelled
AI automation / Codex review loop (push) Has been cancelled
AI automation / Publish Codex fix (push) Has been cancelled
AI automation / Clear Codex dispatch marker (push) Has been cancelled
AI automation / Own PR re-request Codex (push) Has been cancelled
AI automation / External PR re-request Codex (push) Has been cancelled
AI automation / Poll Codex reaction / retry (push) Has been cancelled
Initial commit: NetMesh smart ops platform with 3D topology, inspection reports, RCA and AI ops assistant
2026-10-15 13:53:04 +08:00

87 lines
2.6 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"],
["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);
});