Files
truthmark/tests/cli/help.test.ts
T
a083b703fa feat: add Truthmark health scorecard and bounded workflow contracts (#13)
* feat: add OpenSpec-driven workflow state

* docs: plan generated playbooks workflow contract

* feat: add truth health scorecard

Release Truthmark 2.1.0 with check JSON scorecard output.

Archive the completed OpenSpec pass 4 scorecard change and update generated truth surfaces.

* fix: unblock truthmark scorecard review

- restore and update coverage for scorecard/evidence/workflow behavior
- make truthmark-sync select a cheap local base when --base is omitted
- report malformed evidence YAML blocks as diagnostics instead of throwing

* fix: tighten workflow boundaries

* fix: fail closed when sync has no comparison base

* fix: tighten truth health review coverage

- only parse fenced YAML evidence blocks with top-level evidence markers
- convert coverage fixtures to valid v2 config and assert non-vacuous diagnostics
- update Truthmark truth docs for source traceability and workflow-state tests

* docs: clarify source traceability diagnostics

* docs: harden optional CLI workflow boundary

* docs: clarify product boundary is repo-local

* fix: bound truthmark workflow fallback behavior

- make live workflow preflight use the one-call instructions contract
- keep missing-CLI fallback bounded for Sync, Document, Structure, and Realize
- add routing and generated-surface coverage plus refreshed host surfaces

* test: cover no-cli workflow fallback bounds

- assert route-first fallback wording in generated workflow surfaces
- clarify progressive-disclosure support files are conditional
- align overview docs with bounded no-CLI behavior

* docs: route workflow eval coverage

* fix: remove workflow instructions preflight

* fix: remove stale workflow preflight wording

* fix: remove generic workflow validation blocks

* fix: avoid duplicated markdown context JSON

* fix: keep workflow status manifest-only

* docs: align truth docs with v2 hierarchy

---------

Co-authored-by: MerlinH <merlinh221@gmail.com>
2026-06-13 04:09:45 +10:00

81 lines
2.3 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { runCli } from "../helpers/run-cli.js";
const forbiddenCommands = [
"packet",
"review",
"scan",
"doctor",
"build",
"realize",
];
describe("truthmark CLI", () => {
it("lists config, init, and check in top-level help", async () => {
const result = await runCli(["--help"]);
expect(result.exitCode).toBe(0);
expect(result.stdout).toContain("config");
expect(result.stdout).toContain("init");
expect(result.stdout).toContain("check");
expect(result.stdout).toContain("index");
expect(result.stdout).toContain("impact");
expect(result.stdout).toContain("context");
for (const command of forbiddenCommands) {
expect(result.stdout).not.toContain(command);
}
});
it("shows init help", async () => {
const result = await runCli(["init", "--help"]);
expect(result.exitCode).toBe(0);
expect(result.stdout).toContain("Usage: truthmark init");
expect(result.stdout).toContain("--json");
});
it("shows config help", async () => {
const result = await runCli(["config", "--help"]);
expect(result.exitCode).toBe(0);
expect(result.stdout).toContain("Usage: truthmark config");
expect(result.stdout).toContain("--json");
expect(result.stdout).toContain("--stdout");
expect(result.stdout).toContain("--force");
});
it("shows check help", async () => {
const result = await runCli(["check", "--help"]);
expect(result.exitCode).toBe(0);
expect(result.stdout).toContain("Usage: truthmark check");
expect(result.stdout).toContain("--json");
expect(result.stdout).not.toContain("--workflow");
});
it("returns valid JSON for check", async () => {
const result = await runCli(["check", "--json"]);
expect(result.exitCode).toBe(0);
const payload = JSON.parse(result.stdout) as {
command: string;
summary: string;
diagnostics: unknown[];
data?: {
scorecard?: {
schemaVersion?: string;
};
};
};
expect(payload.command).toBe("check");
expect(typeof payload.summary).toBe("string");
expect(payload.summary.length).toBeGreaterThan(0);
expect(Array.isArray(payload.diagnostics)).toBe(true);
expect(payload.data?.scorecard?.schemaVersion).toBe("truthmark-scorecard/v0");
});
});