This file provides guidance to AI agents when working with code in this repository.
LDE (Linked Data Elements) is an Nx monorepo of Node.js libraries for building Linked Data applications and pipelines. Built on SPARQL, SHACL, and DCAT-AP 3.0 standards. Uses TypeScript with ESNext modules and Vite for building/testing.
- Record architecture decisions in @docs/decisions following the ADR format. ADR titles start with a verb (e.g. ‘Merge pipeline approaches’).
- We’re pre-release, so be aggressive about removing dead code. Do not yet care about backward compatibility.
- All exported/public APIs must have JSDoc comments for a good developer experience.
- With all code changes, ensure all README.md files (including diagrams) are still accurate.
npx nx build <package-name>- Build a specific packagenpx nx run-many -t build- Build all packages
npx nx test <package-name>- Run tests for a specific package (Vitest)npx nx run-many -t test- Run all testsnpx vitest <test-file-path>- Run individual test file
npx nx lint <package-name>- Lint a specific packagenpx nx typecheck <package-name>- Type check a specific packagenpx nx run-many -t lint typecheck- Lint and type check all packages
npx nx affected -t lint test typecheck build- Run tasks only on changed packages (used in CI)- Always run this before pushing to catch CI failures locally.
Packages live in /packages/ with @lde/ scope:
- Data:
dataset,dataset-registry-client(DCAT-AP 3.0 discovery) - Processing:
distribution-download,sparql-importer,sparql-qlever,pipeline - Infrastructure:
local-sparql-endpoint,wait-for-sparql,task-runner* - Documentation:
docgen(SHACL shapes to docs) - Web:
fastify-rdf(RDF content negotiation plugin)
- Module resolution:
nodenext(ESM) - Strict mode enabled with composite projects for incremental builds
- Each package has
tsconfig.json,tsconfig.lib.json, andtsconfig.spec.json
Each package uses conditional exports with a development condition for local development:
"exports": {
".": {
"development": "./src/index.ts",
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
}
}- Vitest with coverage via
@vitest/coverage-v8 - Test files use
.test.tssuffix intest/directory - Fixtures in
test/fixtures/ - HTTP mocking with Nock
- Tests that start a local SPARQL endpoint (
@lde/local-sparql-endpoint) must use unique ports across packages to avoid conflicts when Nx runs tests in parallel. Current port allocations:dataset-registry-client(3002),pipelinesparqlQuery (3001),pipelineexecutor (3003)
- RDF:
n3,sparqljs,jsonld - Query engines:
@comunica/query-sparql-file,ldkit - CLI packages use Commander
- Use Nx generators: packages are TypeScript libraries with ESLint and Vitest
- Configure Nx in
package.json(notproject.json) - Add
developmentcondition in exports for local dev - Add README.md similar to other packages
- Add the package to root README.md
- For CLIs, use Commander and expose version from
package.json
.github/workflows/ci.yml- Runs tests, linting, and builds on PRs and main branch pushes.github/workflows/release.yml- Automated releases on main branch pushes usingnx release
- Automated releases via GitHub Actions on pushes to main
- Uses conventional commits for version determination
- Independent versioning per package
- Uses NPM OIDC Trusted Publishing
- For navigating/exploring the workspace, invoke the
nx-workspaceskill first - it has patterns for querying projects, targets, and dependencies - When running tasks (for example build, lint, test, e2e, etc.), always prefer running the task through
nx(i.e.nx run,nx run-many,nx affected) instead of using the underlying tooling directly - Prefix nx commands with the workspace's package manager (e.g.,
pnpm nx build,npm exec nx test) - avoids using globally installed CLI - You have access to the Nx MCP server and its tools, use them to help the user
- For Nx plugin best practices, check
node_modules/@nx/<plugin>/PLUGIN.md. Not all plugins have this file - proceed without it if unavailable. - NEVER guess CLI flags - always check nx_docs or
--helpfirst when unsure
- For scaffolding tasks (creating apps, libs, project structure, setup), ALWAYS invoke the
nx-generateskill FIRST before exploring or calling MCP tools
- USE for: advanced config options, unfamiliar flags, migration guides, plugin configuration, edge cases
- DON'T USE for: basic generator syntax (
nx g @nx/react:app), standard commands, things you already know - The
nx-generateskill handles generator discovery internally - don't call nx_docs just to look up generator syntax