initial import: @mikefreno/omp-pygenium (omp port)

This commit is contained in:
2026-08-10 09:46:09 -04:00
commit a40cdcd9e3
70 changed files with 12624 additions and 0 deletions

101
tests/help.test.ts Normal file
View File

@@ -0,0 +1,101 @@
/**
* help.test.ts — `/pygienium-help` content (task 14).
*
* Asserts the help block lists every operator command, every implemented flag,
* and at least 8 commands once a handful of checks are registered. The
* per-check command family and the dynamic checks list are registry-driven, so
* these tests register stub checks rather than importing the real ones.
*/
import { describe, expect, it, beforeEach } from "bun:test";
import {
clearChecks,
registerCheck,
type CheckDefinition,
} from "../src/checks/registry.js";
import {
COMMANDS,
CLI_FLAGS,
PYGIENIUM_FLAGS,
buildPygieniumHelpLines,
} from "../src/help.js";
function stub(name: string): CheckDefinition {
return {
name,
label: name,
description: `${name} check`,
agentName: "scanner",
phaseId: "scan",
buildScanTask: () => "scan",
buildFixTask: () => "fix",
gate: () => undefined,
};
}
describe("/pygienium-help content (task 14)", () => {
beforeEach(() => clearChecks());
it("COMMANDS lists every operator command with usage/description/example", () => {
const usages = COMMANDS.map((c) => c.usage);
expect(usages).toContain("pygienium-help");
expect(usages).toContain("pygienium-<check> [path] [--fix] [--fresh]");
expect(usages).toContain(
"pygienium-all [path] [--fix] [--fresh] [--only=a,b]",
);
expect(usages).toContain("pygienium-status [path]");
expect(usages).toContain("pygienium-resume [path] [--fresh]");
expect(usages).toContain(
"pygienium-export [path] [--check=] [--status=] [--out=md|json]",
);
for (const cmd of COMMANDS) {
expect(cmd.description.length).toBeGreaterThan(0);
expect(cmd.example.length).toBeGreaterThan(0);
}
});
it("CLI_FLAGS lists every implemented flag", () => {
const names = CLI_FLAGS.map((f) => f.name);
expect(names).toContain("[path]");
expect(names).toContain("--fix");
expect(names).toContain("--fresh");
expect(names).toContain("--check=");
expect(names).toContain("--status=");
expect(names).toContain("--out=");
expect(CLI_FLAGS.length).toBeGreaterThanOrEqual(6);
// Back-compat alias points at the same array.
expect(PYGIENIUM_FLAGS).toBe(CLI_FLAGS);
});
it("buildPygieniumHelpLines surfaces every command usage and flag name", () => {
const text = buildPygieniumHelpLines().join("\n");
for (const cmd of COMMANDS) {
expect(text).toContain(`/${cmd.usage}`);
}
for (const flag of CLI_FLAGS) {
expect(text).toContain(flag.name);
}
});
it("lists 8+ commands once several checks are registered", () => {
registerCheck(stub("alpha"));
registerCheck(stub("beta"));
registerCheck(stub("gamma"));
const lines = buildPygieniumHelpLines();
// Any line that begins ` /pygienium-` is a command/check listing row.
const commandRows = lines.filter((l) => l.startsWith(" /pygienium-"));
// 6 operator command rows + 3 registered checks = 9.
expect(commandRows.length).toBeGreaterThanOrEqual(8);
// Each registered check is listed by name with its description.
const text = lines.join("\n");
expect(text).toContain("/pygienium-alpha");
expect(text).toContain("/pygienium-beta");
expect(text).toContain("/pygienium-gamma");
expect(text).toContain("alpha check");
});
it("notes the one-file + registerCheck extensibility workflow", () => {
const text = buildPygieniumHelpLines().join("\n");
expect(text).toContain("registerCheck");
expect(text).toContain("No index.ts command-wiring changes");
});
});