AI agent conventions for the abapify / adt-cli monorepo.
| Item | Value |
|---|---|
| Package manager | bun workspaces — use bun/bunx, not npm, pnpm or yarn |
| Monorepo tooling | Nx 22 |
| Language | TypeScript 5 strict ESM |
| Build tool | tsdown (per package) |
| Test runner | Vitest (some packages use Jest) |
| Lint | ESLint 10 + Prettier |
bunx nx build [package] # build one or all packages
bunx nx test [package] # run tests
bunx nx typecheck # full type check
bunx nx lint # lint (auto-fix)
bunx nx format:write # REQUIRED before every commit/
├── packages/ # All publishable packages (@abapify/*)
├── samples/ # Example projects
├── tools/ # Nx plugins/tools
├── openspec/ # Specs and changes (source of truth)
├── .agents/rules/ # AI agent rules (symlinked to .windsurf/rules/ and .cognition/rules/)
├── docs/ # Architecture docs
└── tmp/ # Scratch files (gitignored)
adt-cli
└── adt-client ──► adt-contracts ──► adt-schemas ──► @abapify/ts-xsd
└── adk ──► adt-schemas
└── adt-auth ──► browser-auth ──► adt-playwright / adt-puppeteer
└── adt-config
└── plugins: adt-atc, adt-export, adt-plugin-abapgit
└── adt-plugin (interface)
abap-ast (zero deps, typed AST + printer for ABAP source)
openai-codegen ──► abap-ast (OpenAPI → ABAP client codegen)
Foundation packages (no @abapify deps): ts-xsd, speci, logger, acds, aclass, abap-ast.
@abapify/adt-mcp is a thin MCP adapter over the CLI service layer. It
may (and does) depend on @abapify/adt-cli and on the domain plugin packages
(@abapify/adt-aunit, @abapify/adt-rfc, @abapify/adt-plugin-*, etc.).
This is a deliberate architectural choice, not an accident:
- Invariant: every CLI subcommand has a matching MCP tool, and every MCP tool has a matching CLI subcommand. Behaviour, flags, output shape, and error messages are expected to match.
- Enforcement: the parity test suite in
packages/adt-cli/tests/e2e/parity.*.test.tsis the source of truth. A feature is not "done" until both the CLI path and the MCP path hit the same mock backend through the same service function and return equivalent results. - Code reuse: MCP tool handlers delegate to CLI service functions
(exported from
packages/adt-cli/src/index.ts) rather than re-implementing transports, locking, XML serialisation, or ADK orchestration. - Consequence: the
adt-cli→adt-mcpdependency direction is forbidden (would create a cycle). Theadt-mcp→adt-clidirection is required.
When adding a new feature, add the CLI command and the MCP tool in the same change, and add a parity test that exercises both paths.
SAP XSD files
→ ts-xsd (parse + type inference)
→ adt-schemas (schema literals as TypeScript exports)
→ adt-contracts (speci endpoint descriptors wrapping schemas)
→ adt-client (executes contracts, full type inference at call site)
SAP ADT uses a security session protocol for CSRF tokens. Locks are bound to the security session — a CSRF token obtained without the proper flow is invalid for lock/unlock.
3-step flow (implemented in SessionManager.initializeCsrf()):
GET /sessions+x-sap-security-session: create→ security session + cookiesGET /sessions+x-sap-security-session: use+x-csrf-token: Fetch→ CSRF tokenDELETE /sessions/<id>+x-sap-security-session: use→ free slot (token survives)
All subsequent requests include x-sap-security-session: use. SAP allows 1 security session per user — always DELETE after getting the token.
Lock flow: adt-locks/LockService is the single lock implementation. All lock/unlock operations in adk/model.ts, adt-export, and CLI commands delegate to it. See packages/adt-client/AGENTS.md for full protocol details.
All AI agent rules live in .agents/rules/ (single source of truth).
Symlinked to .windsurf/rules/ and .cognition/rules/ for tool compatibility.
| Rule | Description |
|---|---|
git/no-auto-commit |
Never commit or push without explicit user approval |
development/coding-conventions |
TS strict, ESM only, naming, formatting, import conventions |
development/file-lifecycle |
Generated/downloaded file guardrails |
openspec/project-planning-memory |
OpenSpec workflow and project memory |
verification/after-changes |
Build, typecheck, test, lint, format checklist |
| Rule | Description |
|---|---|
openspec/spec-first-then-code |
Check specs before coding |
development/tmp-folder-testing |
Use tmp/ for scratch files |
development/package-versions |
Always install latest versions |
adt/adk-save-logic |
ADK upsert/lock edge cases |
adt/adt-ddic-mapping |
DDIC object → schema mapping |
adt/xsd-best-practices |
XSD validity and builder rules |
nx/nx-monorepo-setup |
Package creation, config templates |
nx/nx-circular-dependencies |
Fix false circular dep issues |
| Rule | Glob | Description |
|---|---|---|
development/bundler-imports |
**/*.ts |
Extensionless imports for bundled packages |
bun.lock is in .git/info/exclude to prevent JFrog Artifactory URLs from reaching GitHub. Nx's Rust file walker uses the ignore crate, which reads .git/info/exclude but (unlike git) has no concept of the git index — tracked files matching ignore patterns are still skipped. This means Nx never sees the lockfile and externalNodes in the project graph is empty.
Consequence: Any Nx plugin that infers { externalDependencies: [...] } in target inputs will fail. The @nx/eslint/plugin does this for the lint target.
Workaround: The lint target's inputs are overridden in nx.json targetDefaults to drop externalDependencies. If a new plugin introduces similar inputs, add the same override for that target.
Do NOT: Remove bun.lock from .git/info/exclude — the JFrog constraint is intentional.
Each package has its own AGENTS.md with detailed conventions:
packages/abap-ast/AGENTS.md— zero-dependency AST + deterministic printer for ABAP; foundation for code generation.packages/adk/AGENTS.md— ABAP Development Kit, object CRUD, save/lock flow, ETag managementpackages/acds/AGENTS.md— ABAP CDS parser, tokenizer, AST typespackages/aclass/AGENTS.md— ABAP OO parser (CLAS/INTF), Chevrotain lexer + typed ASTpackages/adt-cli/AGENTS.md— CLI commands, service pattern, client initializationpackages/adt-client/AGENTS.md— Contract-driven REST client, schema conventions, type inferencepackages/adt-contracts/AGENTS.md— Contract testing framework, schema integrationpackages/adt-schemas/AGENTS.md— XSD-derived schemas, generation pipelinepackages/adt-mcp/AGENTS.md— MCP server: tool conventions, schema rules, mock server, extension guide. Ships two transports (stdio + Streamable HTTP since Wave 1) with session-scoped state + transactionalchangeset_*tools on the HTTP path; seedocs/deployment/mcp-http.mdfor deployment.packages/adt-plugin-abapgit/AGENTS.md— abapGit serialization, handler templatepackages/openai-codegen/AGENTS.md— OpenAPI → ABAP client generator; emits a single zero-runtime-deps ABAP class per spec, BTP Steampunk cloud profile.packages/ts-xsd/AGENTS.md— W3C XSD parser, type inference, codegenpackages/adt-auth/AGENTS.md— Auth methods, browser SSOpackages/adt-fixtures/AGENTS.md— Test fixtures