AGENTS.md — working on Open RAP Runtime
Instructions for the AI agents (and the humans) who change this repository. To use Open RAP Runtime in a RAP project, see section 13 of the guide; rapt new also writes an AGENTS.md in the projects it creates.
The project in short
A TypeScript compiler (pnpm monorepo) that turns the sources of a RAP BO (abapGit format) into a Node.js application: OData V4, RAP managed runtime, ABAP transpiled by abaplint, PostgreSQL, OpenUI5 UI. Read README.md, docs/GUIDE.md and the list of decisions docs/DECISIONS.md (D1 to D124) first.
packages/model/ types of the IR (model.json) and shared derivations (OData, value helps, MCP)
packages/compiler/ rapt CLI (src/cli.ts), parsers (bdef/, cds/, srvd/, dcl/, ddic/), IR (ir/),
generators (gen/: sql, csdl, abap, ui, launchpad, docs, mcp, app),
object creation (authoring/: new, generate, abapgit, mcp), standard/ (SAP views)
packages/runtime/ Fastify server (app.ts, server.ts), OData (odata/), RAP (rap/), ABAP (abap/),
auth (auth/), launchpad (launchpad/), MCP (mcp/), UI (ui/), platform.ts
packages/vscode/ VS Code extension: calls the CLI with --json, compiles nothing
packages/cli/ npm package @open-rap/cli: the rapt command with what rapt dev needs
fixtures/travel reference BO (must stay importable and activatable on SAP)
fixtures/custom-entity custom entity, enhanced mode
fixtures/table-entity BO on a table entity, simple and enumerated types, enhanced mode
site/ project website (GitHub Pages, site.yml workflow, docs rendered by scripts/build-site.mjs)
Commands
pnpm install
pnpm build # tsc of each package; the compiler also copies docs/ into packages/compiler/docs
pnpm typecheck
pnpm test # vitest, ~3 min; browser tests with Playwright when it is installed
npx vitest run packages/compiler/test/ui.test.ts # one file
node packages/compiler/dist/cli.js check fixtures/travel
node packages/compiler/dist/cli.js dev fixtures/travel --port 8081
node scripts/build-site.mjs _site # the website, with the documentation pages
pnpm changeset # the changeset of a pull request: the bump and its line in the changelog (D77)
pnpm check:version # one version in every file that carries it
The runtime tests import the built @open-rap/compiler: run pnpm build before running them after a change to the compiler.
Rules
- SAP behavior first. In
standardmode, a source behaves as on SAP; a deliberate difference goes to theenhancedmode (D45) or into KNOWN_GAPS.md. - No proprietary SAP library (no SAPUI5, no
sap.fe, nosap.ushell, no CAP); dependencies under permissive licenses, listed in LICENSES.md, pinned versions. - Do not patch abaplint: the
@abaplint/*packages are used as published, never patched. An ABAP feature the transpiler or its runtime mishandles is fixed in our own layers (the rewriting pass, the kernel, the database adapter: D2, D26, D80), with tests, or documented in KNOWN_GAPS.md with the workaround; no upstream issue is required. - One decision per feature: add a
Dnnentry to docs/DECISIONS.md (context, decision, why, tests), update docs/FEATURES.md, docs/DIAGNOSTICS.md (new codes), KNOWN_GAPS.md and the guide. - Positioned diagnostics:
file:line:column, one code per problem (CDS0xx,BDEF0xx,ABP0xx…), the right severity; never an uncaught exception on a wrong source. - Tests: each feature has its tests (compiler and runtime; browser for the UI). Variants of the fixture go through
generatedVariant/fixtureVariantrather than changingfixtures/travel(whose snapshots are the reference); a variant also needed on SAP (draft, SAP BTP trial) is written infixtures/variants.json(D84). - Generated UI: ES5 JavaScript in TypeScript strings (
gen/ui/static.ts); mind the escaping (\\din the TS gives\din the JS). The ids of the controls are used by the browser tests. - Everything in English: documentation, website, code, comments, messages, the README of the generated applications, and everything around the repository: commit messages, branch names, pull requests (title, description, review comments), issues and release notes.
- Generated files: never edit
.rapt/,dist/,packages/compiler/docs/, nor the virtual objects<standard>/…(standard views, D44). - Versions (D77): never change a version by hand. A pull request that changes what ships (sources of a package,
docs/, the dependencies of a published package) adds a changeset (pnpm changeset:patchfor a fix,minorfor a feature; one line in English for the changelog), orpnpm changeset add --emptywhen it must not be released; the CI checks it. The Version packages pull request bumps the versions, its merge releases.
Adding a feature, in practice
- CDS type (DRTY):
ddic/cds-types.tsthenir/dictionary.ts(like a data element). - CDS or BDEF construct: parser (
cds/adapter.ts,bdef/parser.ts) → IR (ir/) → model (packages/model) → generators and runtime → tests → documentation. - Released ABAP Cloud class: clean-room implementation in
gen/abap/framework-*.ts(public signatures of SAP), JavaScript kernel inruntime/src/abap/when needed (D24, D40). - UI annotation:
gen/ui/layout.ts(layout.json), then views (views.ts) and controllers (static.ts). - CLI command:
cli.ts(usage, options,--json), then the VS Code command (packages/vscode/src/extension.ts,package.json), and the tool ofrapt agentwhen an agent needs it (compiler/src/agent/server.ts).