Skip to content

Prepare the 0.1.0 release: runnable examples, a self-contained quickstart, metadata and the 0.1 changeset - #153

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/dicom for its 0.1.0 release. No change under src/.

What changes

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

    • read-metadata.ts: the patient, study, series and image views, the SOP class named from the dictionary, the study date converted.
    • walk-elements.ts: every element with its dictionary name and its typed, decoded value.
    • tolerate-and-reserialize.ts: an object saved without its preamble reads with DICOM_MISSING_PREAMBLE; serializeDicom writes spec-clean Part 10 that reads back with no warning and the same values.
    • deidentify.ts: the PS3.15 Annex E Basic Profile applied to the header, the audit report printed, the result written out and re-read; the source dataset is unchanged.

    Each imports @cosyte/dicom by name, so it resolves through the package's own exports to the built dist/, prints what it read or wrote, and asserts its own output. The one object is the first-use fixture (test/fixtures/first-use/ct-object.ts) as base64 in examples/data/ct-object.ts, since this repository builds fixtures in modules rather than committing binary files.

  • 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), and phi-scan:examples (the scanner's roots are test/, README.md and docs-content/; it decodes the base64 object and scans it as DICOM). format and format:check now cover examples/.

  • CI: a new examples job in ci.yml. This repo's dictionary-regen.yml references checkout@v7, pnpm/action-setup@v6 and setup-node@v6 by tag; the new job pins each by the commit that tag resolves to today.

  • README quickstart: the ## Usage block read study.dcm from disk, so it could not run from a clean install. It now parses the same synthetic object inline (the fixture's preamble-less variant as base64, so the DICOM_MISSING_PREAMBLE it shows is one the object really carries) and prints its key results, followed by a text block with the output. test/docs-content.test.ts runs the block unmodified, asserts the inline object is byte-identical to FIRST_USE_CT_NO_PREAMBLE, and requires stdout to equal the text block, with a negative control. The compile check and the claim-mutation check are kept; the temporary study.dcm rewrite is gone because nothing reads a file any more.

  • package.json: keywords for imaging and de-identification; homepage is now https://docs.cosyte.com/dicom. 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-dicom-0.0.19.tgz
npm init -y && npm install ./cosyte-dicom-0.0.19.tgz   (empty dir)  exit 0
node qs-extract.mjs node_modules/@cosyte/dicom/README.md  -> code block L60 (ts)
node quickstart.mts                          exit 0
  patient MRN-42 issuer SAMPLE-HOSP
  study 1.2.826.0.1.3680043.8.498.1.1
  series CT image 512 x 512
  rescale slope 1 intercept -1024
  tolerated 1 DICOM_MISSING_PREAMBLE

Release commit simulation

On a copy of this branch: pnpm run version (package.json and src/version.ts to 0.1.0, the changelog section generated), committed locally, then pnpm typecheck && pnpm lint && pnpm test && pnpm build && pnpm attw exits 0 (105 files, 2617 passed) and format:check is clean.

Local gates

pnpm typecheck && pnpm lint && pnpm test && pnpm build && pnpm attw pass (105 files, 2617 tests), as do format:check, phi-scan, check:no-emdash, check:no-internal-refs, typecheck:examples, lint:examples, examples and phi-scan:examples. pnpm phi-scan prints a PARTIAL note about one object in docs-content/cookbook.md (an undefined-length value); it exits 0 and prints the same on main, so it is not from this change.

https://claude.ai/code/session_01U24bnHKNxQWMxmfN7ny7w9

…tart, 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 runs when copied into an empty project,
package metadata that points at the docs site, and a changelog entry
that says what 0.1 means for someone depending on the package.

- examples/: four programs covering the jobs the README presents (read
  the four views, walk every element with its typed value, tolerate a
  missing preamble and re-serialize spec-clean, de-identify with an
  audit report). Each imports @cosyte/dicom by name, so it runs against
  the built package through its own exports, and asserts its own
  output. The one object is the first-use fixture's bytes as base64 in
  examples/data/ct-object.ts, since this repository builds fixtures in
  modules rather than committing binary files.
- 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, and phi-scan:examples names them
  to the PHI scanner, whose roots are test/, README.md and
  docs-content/. The scanner decodes the base64 object and scans it.
- ci.yml gains an examples job, with actions pinned by commit to what
  the tags dictionary-regen.yml uses resolve to today; format and
  format:check cover examples/.
- README Usage: the block read study.dcm from disk, so it could not run
  from a clean install. It now parses the same synthetic object inline
  (the fixture's preamble-less variant, as base64, so the tolerated
  DICOM_MISSING_PREAMBLE it shows is real) and prints its key results,
  followed by a text block of the output. test/docs-content.test.ts
  runs it unmodified, asserts the inline object is byte-identical to
  the fixture, and requires its stdout to equal the text block, with a
  negative control; the claim-mutation and compile checks stay.
- package.json: keywords for imaging and de-identification; homepage
  https://docs.cosyte.com/dicom.
- .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:11
@NSchatz
NSchatz merged commit bb9a7f0 into main Sep 25, 2026
11 checks passed
@NSchatz
NSchatz deleted the release-0.1-examples branch September 25, 2026 21:15
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