#!/usr/bin/env node import { type CorpusProblem } from "../corpus/load.ts"; import type { Corpus } from "../corpus/types.ts"; /** * The `rulekit` command. * * Four things, and no more. There is no `import` and no `fetch`: this project * does no data collection, so a corpus arrives already written and the command * only ever reads, checks, and compiles one. */ type Problem = CorpusProblem; /** * Where this command writes, as one object a test can replace. * * A TEST MUST NOT REPLACE `process.stdout.write` TO READ WHAT A COMMAND PRINTS. * The test runner reports its own results through that same function, so a * replacement swallows them: the run prints fewer results than it ran, and the * summary counts fewer than it ran. Fifteen tests in `bin.test.ts` were * invisible that way, and a deliberately broken one still printed "fail 0". * Only the exit code stayed honest. */ export declare const output: { write: (text: string) => undefined; writeError: (text: string) => undefined; }; /** * The corpora that ship inside the package, newest reader first. * * All four carry a CC0 1.0 dedication, so anybody may copy one and sell what * they build on it. The Riftbound corpus is not here and never will be: Riot * Games owns that data, and their policy permits non-commercial use only. */ declare const SHIPPED_CORPORA: readonly ["demo", "chess", "texas-holdem", "estate-line"]; /** The version of this package, which a script may need to report. */ declare function packageVersion(): string; /** * The README section that shows how to serve an agent, and its address. * * A message once sent a reader to a section called "Run it". No README has had * that heading for some time, so the reader arrived nowhere. A test beside this * file reads the headings out of the README and fails if this pair drifts * again. The full address is here because a reader who installed from npm holds * no copy of the README this names. */ export declare const AGENT_README_SECTION = "Put it in your application"; export declare const AGENT_README_URL = "https://github.com/rulekitai/rulekit#put-it-in-your-application"; /** Print problems in a form somebody can act on, newest file first. */ declare function reportProblems(problems: CorpusProblem[], limit?: number): void; /** * Every field a profile names must exist on a card. * * `cards.textFields` and `cards.statFields` are references into the data, and * nothing else checks them. A misspelled name costs the whole benefit twice * over: the assistant is told about a field no card carries, and it is never * told about the field that exists. Both failures are silent, and a reader sees * only a slightly worse answer. * * A profile is optional, and a corpus with none is valid. */ export declare function checkProfileFields(dir: string, corpus: Corpus): Problem[]; /** * True when a corpus states terms for a developer and none for a reader. * * `NOTICE.txt` is the developer's file: it says what you may build and sell. * The person asking whether a unit can block needs one sentence saying who owns * these rules, and `profile.attribution` is where a corpus author writes it. * * This is a note and never a failure. A corpus in the public domain carries no * notice, and one may still choose to say nothing to a reader. */ export declare function missingReaderCredit(dir: string): boolean; /** * Report any JSON file the corpus format does not know. * * One collection may be absent, which means a misspelled file name no longer * stops the load: `rulings.jsonn` reads as "this game has no rulings", and the * writer sees a corpus that validates and answers nothing. Naming the stray file * costs one directory read and turns that silence back into a message. * * It suggests the nearest known name, because the cause is nearly always a typo. */ export declare function checkStrayFiles(dir: string): Promise; declare function commandValidate(dir: string): Promise; declare function commandBuild(dir: string, outFile: string | null): Promise; declare function commandInit(dir: string, corpus?: string): Promise; /** * Ask a question using only the stages that need no model. * * This is how you check a corpus without spending anything. A question the free * stages cannot answer reports that plainly, which is the honest result rather * than a failure. */ declare function commandAsk(dir: string, question: string, asJson?: boolean): Promise; declare function main(): Promise; /** * Is this file the command that was run, rather than a module somebody imported? * * Without this check, importing a command to test it runs the whole program and * calls `exit`, which kills the test runner before a single assertion. * * RESOLVE THE SYMLINK BEFORE COMPARING. npm installs a `bin` as a symlink in * `node_modules/.bin`, so `process.argv[1]` is the link and `import.meta.url` * is its target. An unresolved comparison therefore fails for every user who * installs from npm, and the command exits 0 and prints nothing. It works when * run from a path inside the repository, so no test here saw it. */ export declare function isMainModule(argv1: string | undefined, metaUrl: string): boolean; export { commandAsk, commandBuild, commandInit, commandValidate, main, packageVersion, reportProblems, SHIPPED_CORPORA, }; //# sourceMappingURL=bin.d.ts.map