Files
Merlin's CatGitHubCopilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>MerlinHCopilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
9fa9ac25a4 feat: add workflow eval framework (#32)
* feat: add workflow eval framework

Add workflow evaluation scenarios, rubrics, schemas, and runner scripts for installed Truthmark workflows.

Move research notes under docs/research and migrate tests from Vitest to node:test.

* Potential fix for pull request finding 'CodeQL / Replacement of a substring with itself'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

---------

Co-authored-by: MerlinH <merlinh221@gmail.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2026-06-30 20:57:55 +10:00

68 lines
1.9 KiB
TypeScript

import { describe, it } from "node:test";
import { expect } from "expect";
import { createTempRepo } from "../helpers/temp-repo.js";
import { parseMarkdownDocument } from "../../src/markdown/parse.js";
import { resolveAuthorityPaths } from "../../src/routing/authority.js";
describe("parseMarkdownDocument", () => {
it("extracts frontmatter, headings, and internal links", () => {
const document = parseMarkdownDocument(`---
status: active
---
# Authentication
See [Auth API](docs/api/authentication.md) and [anchor](#timeouts).
## Timeouts
Ignore [external](https://example.com).
`);
expect(document.frontmatter).toMatchObject({
status: "active",
});
expect(document.headings).toEqual([
{ depth: 1, text: "Authentication" },
{ depth: 2, text: "Timeouts" },
]);
expect(document.internalLinks).toEqual([
"docs/api/authentication.md",
"#timeouts",
]);
});
});
describe("resolveAuthorityPaths", () => {
it("preserves declared authority order while expanding globs deterministically", async () => {
const repo = await createTempRepo();
try {
await repo.writeFile(
"docs/truthmark/routes/areas.md",
"# Truthmark Areas\n",
);
await repo.writeFile("docs/guides/beta.md", "# Beta\n");
await repo.writeFile("docs/guides/alpha.md", "# Alpha\n");
await repo.writeFile("docs/api/authentication.md", "# Auth API\n");
const result = await resolveAuthorityPaths(repo.rootDir, [
"docs/truthmark/routes/areas.md",
"docs/guides/*.md",
"docs/api/*.md",
]);
expect(result.diagnostics).toEqual([]);
expect(result.paths).toEqual([
"docs/truthmark/routes/areas.md",
"docs/guides/alpha.md",
"docs/guides/beta.md",
"docs/api/authentication.md",
]);
} finally {
await repo.cleanup();
}
});
});