Single-commit clean baseline after security scrub of niche-tells, project codenames, internal jargon, and contributor-email leaks. Contents: - 100 Rust crates (_primitives/_rust/) - 37 agent manifests (_manifests/) + generated specs (_generated/) - 67 user-invocable skills (skills/) - 33 hooks (hooks/) - Composition blocks (_blocks/) - Documentation (docs/, README.md) - TS adapter packages (_ts_packages/) - Assembler (_assembler/) - Roles (_roles/) - Templates (_templates/) - Forgejo CI (.forgejo/) Author: Denis Parfionovich <info@greendragon.info> License: see LICENSE.
39 lines
1.5 KiB
TypeScript
39 lines
1.5 KiB
TypeScript
import { describe, it, expect } from "vitest";
|
|
import { jsonArgsToCli, RustBridge } from "../src/rust-bridge.js";
|
|
import { RustBridgeError } from "../src/errors.js";
|
|
|
|
describe("jsonArgsToCli", () => {
|
|
it("converts snake_case keys to --kebab-case flags", () => {
|
|
expect(jsonArgsToCli({ foo_bar: "value" })).toEqual(["--foo-bar", "value"]);
|
|
});
|
|
|
|
it("emits booleans as presence-only flags", () => {
|
|
expect(jsonArgsToCli({ verbose: true })).toEqual(["--verbose"]);
|
|
expect(jsonArgsToCli({ verbose: false })).toEqual([]);
|
|
});
|
|
|
|
it("skips null and undefined values", () => {
|
|
expect(jsonArgsToCli({ a: null, b: undefined, c: "x" })).toEqual(["--c", "x"]);
|
|
});
|
|
|
|
it("stringifies numeric values", () => {
|
|
expect(jsonArgsToCli({ count: 42 })).toEqual(["--count", "42"]);
|
|
});
|
|
});
|
|
|
|
describe("RustBridge binary resolution", () => {
|
|
it("rejects illegal binary names", async () => {
|
|
const bridge = new RustBridge({ binDir: "/tmp" });
|
|
await expect(bridge.call({ binary: "../etc/passwd", args: [] })).rejects.toBeInstanceOf(
|
|
RustBridgeError,
|
|
);
|
|
});
|
|
|
|
it("accepts valid snake_case and kebab-case names (resolves with non-zero exit on ENOENT)", async () => {
|
|
const bridge = new RustBridge({ binDir: "/tmp" });
|
|
const result = await bridge.call({ binary: "kei-ledger", args: [], timeoutMs: 500 });
|
|
// execa is configured with reject:false → a missing binary resolves with exitCode != 0
|
|
// (validation passed — this was the assertion under test).
|
|
expect(result.exitCode).not.toBe(0);
|
|
});
|
|
});
|