Imported from iTwin/imodel-transformer (
AGENTS.md). Install upstream withnpx skills add iTwin/imodel-transformer. Copyright stays with the author.
AGENTS.md
Guidance for AI agents working in iTwin/imodel-transformer. Read packages/transformer/README.md for package behavior, strict peer-dependency handling, and environment variables.
Workspace
| Package | Purpose |
|---|---|
packages/transformer |
Published @itwin/imodel-transformer library and its Vitest suite. |
packages/test-app |
CLI and sample app for manual runs. |
packages/performance-tests |
Vitest weekly and quick performance suites. Run them explicitly; root pnpm test excludes this package. |
packages/performance-scripts |
Performance profiling helpers. |
Build and test
- In
packages/transformer, usepnpm build,pnpm test, andpnpm cover. Vitest runssrc/test/**/*.test.tsdirectly;buildtype-checks all sources, emits only production CommonJS, and extracts the public API. pnpm coveruses Vitest's V8 provider, enforces the configured thresholds, and writes reports topackages/transformer/coverage.extract-apiregeneratescommon/api/*. Never edit those files manually. Commit regenerated reports when a public API changes.src/test/setupVitest.tsstarts and stopsIModelHostand registers custom assertions for each test file. Tests run in a bounded pool of forked workers with worker-local output directories.HubMockcomes from@itwin/core-backendinternals.- In
packages/performance-tests,pnpm testruns the credential-dependent weekly suite,pnpm exec vitest run test/unitruns its infrastructure tests,pnpm test:quick-harnessvalidates the credential-free quick harness, andpnpm test:quickruns the quick benchmark. Buildpackages/transformerwithpnpm build:cjsbefore running quick commands.
Edit transactions
Use the withEditTxn pattern already present in a test instead of adding a bare db.saveChanges():
const id = withEditTxn(db, "insert PhysicalObject", (txn) => {
return someId;
});
The edit-transaction migration is a breaking-change area tracked by #305 and #306. Flag semantic changes as major rather than silently folding them into unrelated work.
Validation and release
- Use the Node version from
.github/workflows/ci.yml;package.jsondefines the supported range. - Package CI and release run in
.github/workflows/. Documentation uses.azure-pipelines/generate-docs.yamland the externaldocs-build.yaml@itwinjs-coretemplate. - Published behavior changes require a beachball change file.
pnpm checkvalidates it. - Document minor and major changes in
docs/changehistory/NEXT_VERSION.md, including migration steps for breaking changes.
Error ownership
- For consumer-actionable transformer failures, throw
ITwinErrorwithIModelTransformerErrorScopeand anIModelTransformerErrorkey. Consumers branch on the scope and key, not the message. - Preserve errors from core, backend, and database APIs unless deliberately translating them to a more specific transformer error. Preserve the original error as
causewhen translating. - Use plain
Erroror an assertion for internal invariants and implementation bugs. - Do not create
IModelErrorinstances for transformer-owned failures.