Files
LLeMbas-CLI/scripts/harness.ts
T
HomerandClaude Opus 5.5 f9bad01ed7
ci / check (push) Waiting to run
LLeMbas CLI 1.0.0
The first public release of LLeMbas CLI: a terminal coding agent and project manager for any LLM
API, with permission modes, git snapshots, memory and skills, knowledge bases, MCP, voice, and a
link to a LLeMbas instance whose web UI can work its sessions too. Signed Linux binaries for x64
and arm64.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 21:59:03 +00:00

36 lines
1.7 KiB
TypeScript

// The harness spec's conformance cases (harness/conformance/*.json), shared with LLeMbas.
// bun run harness record fill in the `expect` of every case that has none, from LLeMbas CLI
// bun run harness record --all record every case again, and say which ones changed
// Recording is how a new case gets its answer; a changed answer is a change of behaviour, which
// the spec's version and both projects must then follow.
import { readdirSync, readFileSync, writeFileSync } from "node:fs"
import { join } from "node:path"
import { AREAS } from "../tests/conformance.ts"
const dir = join(import.meta.dir, "..", "harness", "conformance")
const [cmd, flag] = process.argv.slice(2)
if (cmd !== "record") {
console.error("usage: bun run harness record [--all]")
process.exit(2)
}
let filled = 0
let changed = 0
for (const f of readdirSync(dir).filter((x) => x.endsWith(".json")).sort()) {
const area = f.replace(/\.json$/, "")
const run = AREAS[area]
if (!run) throw new Error(`no runner for ${area}`)
const doc = JSON.parse(readFileSync(join(dir, f), "utf8")) as { about: string; cases: Record<string, unknown>[] }
for (const c of doc.cases) {
if ("expect" in c && flag !== "--all") continue
const { expect: before, ...input } = c
const now = run(input)
if ("expect" in c && JSON.stringify(before) !== JSON.stringify(now)) {
changed++
console.log(`${area}: ${JSON.stringify(input)}\n was ${JSON.stringify(before)}\n now ${JSON.stringify(now)}`)
} else if (!("expect" in c)) filled++
c.expect = now
}
writeFileSync(join(dir, f), JSON.stringify(doc, null, 2) + "\n")
}
console.log(`recorded: ${filled} new, ${changed} changed`)