T0000 — Repository scaffold
Part of the roadmap. Phase 0 · wave 0 · size M.
Goal
A working pnpm monorepo where every later task can add code and tests without touching the tooling.
Scope
-
Root workspace:
package.json: private,packageManagerpinned to the current pnpm major,engines.node >= 22- scripts:
build,test,test:watch,typecheck,lint,format,check(lint + typecheck + test + build + package checks) andchangeset pnpm-workspace.yaml(packages/*,tools/*),.node-version(24),.editorconfig,.gitignore- a
LICENSEfile (MIT); the README says MIT, but the file is missing
-
TypeScript 7:
tsconfig.base.jsonwith the flags from build and packaging (strict,exactOptionalPropertyTypes,noUncheckedIndexedAccess,verbatimModuleSyntax,isolatedDeclarations), per-packagetsconfig.json,typecheckwithtsc --noEmit. -
Build: tsdown in
packages/core, producing ESMdist/index.jsanddist/index.d.ts. Pin the tsdown version (it is still 0.x). -
Tests: Vitest with
projects(one per package), a smoke test in core, and coverage (@vitest/coverage-v8) configured but not enforced. -
Lint/format: Biome with
biome.json.biome ciruns in CI. -
Package checks:
publint@arethetypeswrong/cli- a script that fails if
@callis/corehas anydependencies - a script that reports the gzip size of
@callis/core
-
Versioning: Changesets (
.changeset/config.json, independent versions,access: public). -
CI:
.github/workflows/ci.ymlruns on push and pull request:pnpm install --frozen-lockfilebiome ci- typecheck
- tests on Node 22, 24 and 26
- build
- package checks
Concurrent runs on the same ref are cancelled.
-
packages/core(@callis/core):package.jsonwithversion: 0.0.0,type: module, anexportsmap,files,sideEffects: false,engines,license,repositoryandkeywordssrc/index.tswith an empty public API- an internal
src/errors/skeleton: theFhirPathErrorhierarchy,SourceSpan, theErrorCodeunion andformat()from errors and diagnostics. Every wave-1 task needs this module, so it is created here to avoid merge conflicts.
-
Contributor docs: CONTRIBUTING.md and AGENTS.md already describe the workflow and conventions. Fill in their Commands sections: install,
pnpm checkand its parts, running a single test file, and adding a changeset. -
PR-title check: a CI job that checks PR titles against the rules in CONTRIBUTING.md: allowed types and scopes, exactly one scope (optional only for
docs,build,ciandchore), a summary that starts with a lowercase letter and has no trailing period, and at most 72 characters. The rules live inscripts/pr-title.tswith tests, andpnpm check:titleruns them locally. Generic actions such asamannn/action-semantic-pull-requestcannot express all of these rules. -
Biome rules that enforce the code style guide where Biome supports it (for example no default exports).
Out of scope
Any FHIRPath functionality; the release workflow (T0025).
Design notes
Errors and diagnostics
class FhirPathError extends Error {readonly code: ErrorCode; // stable string, e.g. 'syntax/unexpected-token'readonly span?: SourceSpan;readonly expression?: string;format(): string; // message plus source excerpt with a caret}class FhirPathSyntaxError extends FhirPathError {}class FhirPathSemanticError extends FhirPathError { readonly diagnostics: readonly Diagnostic[] }class FhirPathEvaluationError extends FhirPathError {}interface SourceSpan { start: number; end: number; line: number; column: number } // offsets in UTF-16 units; line/column 1-based
Error codes are stable strings grouped by stage, for example:
- syntax:
syntax/unexpected-token,syntax/unexpected-character,syntax/unterminated-string,syntax/unterminated-comment,syntax/invalid-escape,syntax/invalid-date-literal - semantic:
semantic/unknown-function,semantic/wrong-arity,semantic/unknown-element,semantic/unknown-type - evaluation:
eval/singleton-expected,eval/type-mismatch,eval/undefined-variable,eval/invalid-literal,eval/invalid-argument,eval/async-in-sync,eval/aborted,eval/limit-exceeded,eval/datetime-out-of-range,eval/invalid-calendar-unit
A formatted error looks like this:
FhirPathSyntaxError [syntax/unexpected-token]: Expected ')' but found end of inputPatient.name.where(use = 'official'^
When the spec says evaluation "will end and signal an error to the calling environment", Callis throws. When it says the result is empty, Callis returns []; division by zero is one example.
Build, packaging and runtime targets
| Topic | Decision |
|---|---|
| Module format | ESM only ("type": "module", an exports map with types + default, "sideEffects": false). Node ≥ 20.19 / 22.12 can require() ESM. See ADR-0009 (owner decision: no CommonJS build for now). |
| Language target | ES2022 output. BigInt is the only feature newer than ES2017 that is essential. |
| Platform independence | The core imports no node: modules and uses no Buffer, process or DOM types. lib is ES2022 only. Host APIs that appear in the public API are typed with small structural interfaces defined and exported by the core, for example CancellationSignal instead of AbortSignal (T0021: sync and async), so consumers need no extra ambient typings. |
| Runtimes | Node.js 22, 24 and 26 (current LTS lines); evergreen browsers; Deno, Bun and edge workers on a best-effort basis. engines.node: ">=22". |
| TypeScript | TypeScript 7 (native compiler) with strict, exactOptionalPropertyTypes, noUncheckedIndexedAccess, verbatimModuleSyntax and isolatedDeclarations. The last one forces explicit types on the public API and enables fast .d.ts generation. |
| Build | tsdown (Rolldown-based; tsup is no longer maintained and points users to tsdown). Outputs ESM plus .d.ts. |
| Lint and format | Biome: one tool, fast, minimal config. Type checking is a separate tsc --noEmit step. |
| Tests | Vitest, with one project per package. |
| Versioning | Changesets, independent versions per package. Model and UCUM packages have a peer dependency on @callis/core. |
| Package checks | publint and @arethetypeswrong/cli in CI. A script fails the build if @callis/core gains any dependencies. Bundle size is tracked, with an initial budget of 40 kB gzip for the core. |
| CI (GitHub Actions) | Install (pnpm, frozen lockfile), biome ci, typecheck, unit tests (Node matrix), build, package checks, conformance report (job summary + artifact). A release workflow based on changesets comes with the first release. |
Acceptance criteria
- On a clean clone,
pnpm install && pnpm checkpasses on Node 22, 24 and 26. - CI runs on every PR and is green. Breaking lint, types or tests turns it red (checked once, by hand).
-
pnpm --filter @callis/core buildemits ESM +.d.ts. publint and attw report no problems. - Adding a dependency to
@callis/coremakes the no-dependency check fail (checked once, by hand). -
pnpm changesetworks. - The Commands sections in CONTRIBUTING.md and AGENTS.md list working commands.
- A PR with a non-conforming title fails the PR-title check (checked once, by hand).