Skip to content

Prepare the 0.1.0 release: runnable examples, a printing quickstart, metadata and the 0.1 changeset - #139

Merged
NSchatz merged 1 commit into
mainfrom
release-0.1-examples
Sep 25, 2026
Merged

NSchatz merged 1 commit into
mainfrom
release-0.1-examples

Conversation

@NSchatz

@NSchatz NSchatz commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

Prepares @cosyte/ccda for its 0.1.0 release. No change under src/.

What changes

  • examples/: four runnable programs, one per job the README presents:

    • read-a-ccd.ts: the document type, the patient and MRN, and the problems, medications and allergies with their code systems.
    • build-and-round-trip.ts: build a spec-clean CCD, read back a UCUM-checked vital sign, check the six required sections and the re-serialized fixed point.
    • lenient-and-strict.ts: a document with a missing medication route reads leniently with MISSING_ROUTE_CODE, and { strict: true } refuses it with the same code.
    • edit-a-section.ts: replace one section and add another with editCcda, getting a CDA R2 revision (versionNumber 2, RPLC).

    Each imports @cosyte/ccda by name, so it resolves through the package's own exports to the built dist/, prints what it read or built, and asserts its own output. The one input document (examples/data/ccd.ts) is a byte-for-byte copy of the quickstart fixture in test/__fixtures__/first-use.ts, kept in a .ts module because this repository never tracks an XML document as a file.

  • Scripts: pnpm examples (scripts/run-examples.ts, which refuses to pass when it finds nothing to run), typecheck:examples and lint:examples (against the built types, via examples/tsconfig.json and examples/eslint.config.js). The PHI scan already walks the whole tree, examples/ included. format and format:check now cover examples/.

  • CI: a new examples job in ci.yml (install, build, typecheck, lint, run), with the same action pins as the conformance job.

  • README quickstart: the ## Usage block now prints its key results, followed by a text block showing the output. test/docs-content.test.ts runs the block as a program against the built entry and requires stdout to equal that text block byte for byte, plus a negative control. The // => claims and the MRN001 input the first-use tests mutate are unchanged.

  • README Status, and the version commit: Status now states what 0.1.0 promises. The README status test requires the version package.json declares, and the release pipeline runs pnpm test on the Version Packages commit before publishing; the Status as it was names only 0.0.15, so that commit would have failed there. scripts/sync-readme-version.ts rewrites the one bold backticked version in ## Status to package.json's, run by the version script after sync-version.mjs (tested in test/scripts/sync-readme-version.test.ts).

  • package.json: keywords for C-CDA and its document types; homepage is now https://docs.cosyte.com/ccda. description, repository and bugs were already correct.

  • Changeset first-minor-release.md (minor): what 0.1 covers, what the version promises below 1.0, what is not covered yet. It becomes the generated changelog entry.

Quickstart proof

From the packed tarball:

pnpm build && npm pack                      -> cosyte-ccda-0.0.15.tgz
npm init -y && npm install ./cosyte-ccda-0.0.15.tgz   (empty dir)  exit 0
node qs-extract.mjs node_modules/@cosyte/ccda/README.md  -> code block L100 (ts)
node quickstart.mts                          exit 0
  ccd MRN001 Doe
  problem 59621000 active
  medication 314076
  allergy 7980 Penicillin G
  warnings 0
  round trip unchanged true

Release commit simulation

On a copy of this branch: pnpm run version (prints sync-readme-version: README.md -> 0.1.0, generates the 0.1.0 changelog section), committed locally, then pnpm typecheck && pnpm lint && pnpm test && pnpm build && pnpm attw exits 0 (43 files, 1369 passed) and format:check is clean.

Local gates

pnpm typecheck && pnpm lint && pnpm test && pnpm build && pnpm attw pass (43 files, 1369 tests), as do format:check, phi-scan, check:no-emdash, check:no-internal-refs, typecheck:examples, lint:examples and examples.

https://claude.ai/code/session_01U24bnHKNxQWMxmfN7ny7w9

…metadata and the 0.1 changeset

The 0.1.0 release needs examples a new user can run, CI that keeps them
honest, a README quickstart that prints its results when copied into a
clean project, package metadata that points at the docs site, a
changelog entry that says what 0.1 means, and a version commit that
passes its own tests.

- examples/: four programs covering the jobs the README presents (read
  a CCD, build one and round-trip it, lenient versus strict parsing of
  a quirky document, edit a section into a CDA R2 revision). Each
  imports @cosyte/ccda by name, so it runs against the built package
  through its own exports, and asserts its own output. The one input
  document is a copy of the quickstart fixture, kept in a .ts module
  because this repository never tracks an XML document as a file.
- pnpm examples runs them all (scripts/run-examples.ts, refusing to pass
  when it finds nothing to run); typecheck:examples and lint:examples
  check them against the built types. The PHI scan already walks the
  whole tree. ci.yml gains an examples job with the same action pins
  as the conformance job; format and format:check cover examples/.
- README Usage: the block now prints its key results with console.log,
  followed by a text block of the output, and test/docs-content.test.ts
  runs the block as a program and requires its stdout to equal that
  text block, with a negative control. The `// =>` claims and the MRN
  input the first-use tests mutate are unchanged.
- README Status states what 0.1.0 promises, and the version commit now
  keeps it true: scripts/sync-readme-version.ts rewrites the one bold
  backticked version in `## Status` to package.json's, run by the
  `version` script after sync-version.mjs. With the Status as it was,
  the Version Packages commit failed "states the version package.json
  declares" in the release Verify step, before anything publishes; the
  sync also keeps the published README from declaring 0.0.15 at 0.1.0.
- package.json: keywords for C-CDA and its document types; homepage
  https://docs.cosyte.com/ccda.
- .changeset/first-minor-release.md: the minor that states what 0.1
  covers, what the version promises below 1.0, and what is not covered
  yet. It is the changelog entry the release generates.

Claude-Session: https://claude.ai/code/session_01U24bnHKNxQWMxmfN7ny7w9
@NSchatz
NSchatz enabled auto-merge (squash) September 25, 2026 21:00
@NSchatz
NSchatz merged commit e726a86 into main Sep 25, 2026
11 checks passed
@NSchatz
NSchatz deleted the release-0.1-examples branch September 25, 2026 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant