@svatah/yam-compiler
Compiler tiers, validation, lint and plan writer
- Source:
packages/compiler· README:packages/compiler/README.md - Install:
npm install @svatah/yam-compiler - Version 0.1.0 · Apache-2.0
Exports
| Export | Kind | Signature | |
|---|---|---|---|
CaseResult | interface | export interface CaseResult | |
checkSigils | function | export function checkSigils( | The first retired form in a sentence, as a diagnostic. |
clearTiers | function | export function clearTiers(): void | |
comparable | function | export function comparable(step: Step): Record<string, unknown> | The part of a step two compilers must agree on to have compiled the same |
compile | function | export function compile(options: CompileOptions): CompileResult | |
CompileOptions | interface | export interface CompileOptions | |
CompileResult | interface | export interface CompileResult | |
compileSentence | function | export function compileSentence( | One sentence through the tiers. |
compileWithModelTiers | function | export async function compileWithModelTiers( | Compile, asking the registered model tiers about the residue (REQ-COMP-1, 3, 4). |
DEFAULT_LONG_SLEEP_SECONDS | variable | DEFAULT_LONG_SLEEP_SECONDS = 5 | |
EvalReport | interface | export interface EvalReport | |
GOLDEN_PROVENANCE | variable | GOLDEN_PROVENANCE | A stand-in provenance for a model tier's entry (REQ-STD-4). |
GoldenEntry | typealias | export type GoldenEntry = z.infer<typeof goldenEntrySchema>; | |
goldenEntrySchema | variable | goldenEntrySchema = z | |
hasModelTiers | function | export function hasModelTiers(): boolean | Whether any model-backed tier is available, for --tier2 / --tier3 checks. |
LintOptions | interface | export interface LintOptions | |
lintPlan | function | export function lintPlan(plan: Plan, options: LintOptions = {}): Diagnostic[] | The warnings that need the whole plan. |
LowerContext | interface | export interface LowerContext | |
lowerStep | function | export function lowerStep( | The IR step for one parsed sentence. |
lowerValue | function | export function lowerValue(raw: RawValue, secrets: ReadonlySet<string>): ValueRef | A raw reference to a ValueRef, marking a secret data path as one. |
materialise | function | export function materialise(entry: GoldenEntry, storyName = "Golden", line = 1): Step | Build the full Step a compiler would emit for an entry. |
ModelStep | typealias | export type ModelStep = z.infer<typeof modelStepSchema>; | |
modelStepSchema | variable | modelStepSchema = z | One step, as a model may describe it. |
ModelTier | interface | export interface ModelTier | A tier that a model backs. Registered by the CLI; absent by default. |
ModelTierAnswer | interface | export interface ModelTierAnswer | What a model-backed tier answers with. |
ModelTierOptions | interface | export interface ModelTierOptions | |
ModelValue | typealias | export type ModelValue = z.infer<typeof rawValueSchema>; | |
parseGuard | function | export function parseGuard( | Parse a guard written on its own line, which the reader has already split off. |
parseSentence | function | export function parseSentence(text: string, where: { file: string; line: number }): Tier1Result | Parse one sentence. |
RawPredicate | interface | export interface RawPredicate | |
RawStep | interface | export interface RawStep | |
RawTarget | interface | export interface RawTarget | |
RawValue | typealias | export type RawValue | A value the grammar read, before it knows whether the path is secret. |
rawValueSchema | variable | rawValueSchema = z | A value the model may name. |
readGolden | function | export function readGolden(path: string): GoldenEntry[] | Read and parse a golden.jsonl file. Throws with the line number on bad input. |
referencesOf | function | export function referencesOf(step: Step): ValueRef[] | Every ValueRef a step reads, wherever it sits. |
registerTier | function | export function registerTier(tier: ModelTier): void | Register a model-backed tier. Module (b)'s CLI does this when configured. |
renderPlan | function | export function renderPlan(plan: Plan): string | plan.json's bytes: canonical, so two compiles of one input are identical. |
RETIRED_FORMS | variable | RETIRED_FORMS: readonly Form[] = [ | The retired forms, from the migration table. |
scoreCase | function | export function scoreCase(entry: GoldenEntry, actual: Step | undefined, error?: string): CaseResult | Score one measured step against the golden entry it was measured for. |
SentenceContext | interface | export interface SentenceContext | Where a sentence the grammar refused was written. |
sentenceKey | function | export function sentenceKey(file: string, line: number, text: string): string | How a sentence is keyed in modelAnswers. |
SIDE_EFFECT_WORDS | variable | SIDE_EFFECT_WORDS = [ | Target phrases that make a step side-effecting (REQ-AUTO-8). |
STABLE_TIMESTAMP | variable | STABLE_TIMESTAMP = "1970-01-01T00:00:00.000Z" | The timestamp --stable uses: fixed, and obviously so. |
StepIdentity | interface | export interface StepIdentity | Everything a step needs that the grammar does not decide. |
summarise | function | export function summarise( | Roll a list of case results into per-tier and overall rates. |
Tier1Result | interface | export interface Tier1Result | |
tierFor | function | export function tierFor(level: 2 | 3): ModelTier | undefined | |
toRawStep | function | export function toRawStep(step: ModelStep): RawStep | A model's answer, as the raw step the grammar would have produced. |
ValidateContext | interface | export interface ValidateContext | |
validateStory | function | export function validateStory( | Validate one story's steps. |