@xanots/xanoscript
v0.0.2
Published
Renders a XanoTS workspace to XanoScript — the language the Xano engine runs. A file-for-file port of the engine's encoder, proven byte-for-byte against the engine's own golden corpus.
Readme
@xanots/xanoscript
Renders a XanoTS workspace to XanoScript — the language the Xano engine actually runs.
Status: 0.x, published. The emitter, the
./plugintoolchain entry and the npm release are all live; the API is still free to change on a minor bump.
What it is
The emitter is a file-for-file port of the Xano engine's own JSON → XanoScript encoder, pinned to one engine commit. Its contract is not "looks right" — it is byte equality with the engine, proven against 1,280 of the engine's own golden fixtures on every run.
That is what makes a committed xanoscript/ tree worth reading: a backend change
shows up in review as the XanoScript the engine will run, one file per object,
beside the TypeScript that produced it.
Quick start (maintainers)
npm install
npx vitest run # the full suite, corpus included
npm run xs:report # the corpus, as pass/fail counts grouped by reason
npm run typecheck
npm run lintnpm run xs:report should print 1279 passed, 1 failed — that one failure is
a documented corpus artifact, recorded with its reason in
test/corpus-known-failures.json.
Layout
| Path | What it is |
|---|---|
| src/index.ts | the emitter entry (emitXanoScript, createScriptContext) |
| src/engine/ | the encoder core — parsers, kinds, values, coercion semantics |
| src/transform/ | one class per statement kind |
| src/multidoc.ts | workspace → multidoc assembly |
| src/tree.ts | multidoc → one-file-per-object placement |
| src/writer.ts | the committed xanoscript/ tree: write, check, README, placeholders |
| src/render-def.ts | one def rendered alone — the only file needing the @xanots/sdk peer |
| src/diff.ts | document-aware comparison of two multidocs |
| vendor/xs-engine/ | generated engine data and the commit lock (never hand-edited) |
| scripts/xs-engine/ | the drift loop — vendor, sync, drift, report |
The emitter takes no peer
Everything under src/ imports nothing from @xanots/sdk except
render-def.ts. The . entry builds and its suite passes with the peer absent,
and test/peer-free.test.ts asserts it. That isolation is why this package can
follow the engine's release cadence instead of the SDK's.
Contributing
Read AGENTS.md in the repository first — especially the disclosure block at
the top. It carries the drift loop, the porting order, the coercion-semantics
rule, and the redaction procedure for a credential found in the corpus.
AGENTS.md is deliberately NOT in the published tarball: it describes the
engine's internal layout, which belongs in the repository and not on a public
registry. See the disclosure block for what that constrains.
License
MIT
