Files
shinyobjectz bbd7369548 One loop, raea goal: every rule in TypeScript, held at edit, render, publish and done; raea make is the asset tools
The rules are raea/goal's (sdk/goal), run by `raea goal check` at four moments: the hook after a save, every
render's end, raea cloud's publish, and the Stop hook. Rust's cut and goal gates and the box's word, sound, frame and
place checks are packs (MK30-MK39); runtime/cut-plan, runtime/goal-plan, raea make status and the box's check code
are gone with no alias (MK41).

brief.ts is the one registered root (MK43): raea runs it, and every file that imports raea must be reached from it
(the registered check, an error at publish and done). Its tasks are its `plan` (MK44), read from its run and written
back where each is written by `raea goal tasks`, the one path for the app, agents and the box. Its `goal` is one
goal or a workflow of several (MK46), each with its step, after and rules, checked and reported alone. Taste lines
and signed asks run inside the loop (MK47).

`raea goal check|tasks|seen|judge|gates|next` is the loop; `raea make clothes|motion|solid|wear|splat|physics|bake|
sao|tokensynth|sounds|component|blockout|...` the asset tools (MK45). Old names are refused with where they went.
docs/make.feature is docs/goal.feature; tools/legacy-names.sh holds the old names out.

raea's Node mode on JavaScriptCore now gives a CommonJS package's names as named exports (React's jsx), loads a
file a tool imports by URL, keeps process.exit's code from a promise callback, and reads stdin as fd 0, so the goal
runner runs on the shipped binary.
2026-11-29 16:02:31 -08:00

32 lines
1.3 KiB
TypeScript

// Test fixtures are written as a plan.ts's text: value() reads the literal (as source.ts finds it), and these wrap the
// value API so a test can say what a plan is and what it becomes in the words a person would write.
import type { PlanFile } from "../src/doc.ts"
import * as edit from "../src/edit.ts"
import type { PlanRegistry } from "../src/extend.ts"
import { readValue } from "../src/literal.ts"
import * as model from "../src/model.ts"
import { planModule } from "../src/source.ts"
/** the value plan({...}) writes in a plan.ts's text; none for an empty text */
export function value(text: string): PlanFile | undefined {
if (!text.trim()) return undefined
const m = /\bplan\s*\(/.exec(text)
if (!m) throw new Error("no plan({...})")
return readValue(text, m.index + m[0].length).value as unknown as PlanFile
}
export function readPlan(text: string, reg?: PlanRegistry): model.Plan {
try {
return model.readPlan(value(text), reg)
} catch (e) {
return { ...model.readPlan(undefined, reg), problem: (e as Error).message }
}
}
export function applyEdits(text: string, edits: readonly edit.PlanEdit[], o?: edit.ApplyOptions) {
const r = edit.applyEdits(value(text), edits, o)
return { ...r, text: planModule(r.file) }
}
export const newPlan = (title: string, keywords?: string) => planModule(edit.newPlan(title, keywords))