Skip to content

Add @haverstack/commons package with canonical type definitions - #166

Merged
cuibonobo merged 5 commits into
mainfrom
claude/issue-146-lkno87
Aug 14, 2026
Merged

Add @haverstack/commons package with canonical type definitions#166
cuibonobo merged 5 commits into
mainfrom
claude/issue-146-lkno87

Conversation

@cuibonobo

Copy link
Copy Markdown
Member

Summary

Introduces @haverstack/commons, a new package that exports canonical Schema Commons type definitions as constants and provides a defineCommonsTypes() helper. This makes registering commons types a one-liner and prevents schema drift by eliminating hand-copying schemas from documentation.

The package exports eight Draft-status commons types (NOTE, BOOKMARK, TASK, CONTACT, ARTICLE, PLACE, PAGE, PHOTO) as CommonsType constants mirroring their stack.defineType(...) blocks exactly. The defineCommonsTypes(stack, types) helper registers these types on a stack, with idempotent re-registration as the normal path.

Also promotes photo from Staged to Draft status in the commons documentation, now that file-ref fields (#63) have landed and the required image field can be schema-enforced.

Spec

No behavior change. The commons types and their schemas are already documented in docs/commons/; this package makes them available as importable constants rather than requiring manual transcription. The defineCommonsTypes() helper is a thin loop over stack.defineType() with no new semantics.

Verification

  • Added comprehensive test suite (packages/commons/tests/index.test.ts) covering:
    • Type ID format and uniqueness
    • defineCommonsTypes() registration and idempotency
    • Schema compatibility with documented read-compat cores
    • Photo's required file-ref field enforcement
  • All tests pass
  • TypeScript compilation succeeds
  • Package builds correctly with tsc

Notes for reviewers

  • The package is marked as early development (v0.1.0) and exports only Draft-status types; Proposed types remain docs-only until they have a concrete intended writer
  • defineCommonsTypes() is safe to call on every app startup — re-registering already-defined types is the idempotent no-op path
  • The photo type promotion from Staged to Draft is now safe because file-ref fields are implemented, allowing the required image field to be schema-enforced rather than convention-only
  • Governance for commons types remains in docs/commons/README.md; this package's constants are updated to match once proposals land

https://claude.ai/code/session_0176g68eiBQtrYZxXbNZTd9L

claude added 5 commits August 14, 2026 13:29
- @haverstack/commons exports canonical Draft-status commons schemas
  (note, bookmark, task, contact, article, place, page, photo) as
  constants plus a defineCommonsTypes(stack, [...]) helper, so apps
  register commons types exactly as written instead of hand-copying
  TypeScript out of markdown.
- Graduate org.haverstack/photo@1 from Staged to Draft: #63 (file-ref
  field kind) has landed, so its required image field is now
  schema-enforced as originally designed. Update docs/commons/README.md's
  namespace list, type table, and Statuses paragraph accordingly.
- Revisit stale "once file-ref fields (#63) land" follow-up notes in
  the README's embed cross-type convention, note.md, and folder.md now
  that #63 has shipped.
- Update docs/commons/README.md's tooling section and the root README's
  package table/directory structure to reflect the new package.

Closes #146.
file-ref (#63), merge-patch semantics (#69), the first-recorded rule
(#65), dangerous-type safe-listing (#66), the strengthened isCompatible
relation (#54), and the recoverability model (#59) are all shipped —
citing their tracking issues no longer tells a reader anything they
can't already get from the doc itself. State each as settled fact
instead. Issue references to genuinely open/deferred work (#15, #16,
#49, #51, #57/#58) are left as-is.
Self-certified DID identity (#49), reference-implies-access (#51), and
the grant/group reshape (#57/#58) are all closed and their outcomes are
already reflected in docs/spec/identity.md and docs/spec/access-control.md.
State each as settled fact instead of citing the tracking issue:

- The DID identity model is described directly rather than pointing at
  #49; contact.md and message.md no longer treat it as a dependency.
- folder.md states plainly that the permission model has no
  reference-implies-access or inherited mechanism, rather than framing
  it as an open question tied to #51.
- task.md, message.md, and README.md describe assignment/reactions/the
  group cluster against the grant/group model that already exists
  (`_group`, type-level grants) instead of citing #57/#58 as a pending
  dependency.

Open work (#15, #16) is left as-is — the docs already frame those as
deferred, and that's still accurate.
The repo has no install base to cater to, so prose narrating "this
used to be blocked / is no longer necessary" is dead weight once the
current state is what matters. State the present design directly:

- The Tooling section describes what defineCommonsTypes() does today
  instead of framing it as relief from a prior requirement.
- The Statuses paragraph defines Staged/Proposed generically rather
  than walking through photo's history to illustrate them (that
  history still lives in photo.md's own changelog, where it belongs).
Minor follow-up to the previous pass: "already self-certifying" and
"already used for entityId" still carried an implicit before/after
framing. State the DID identity model as a plain fact instead.
@cuibonobo
cuibonobo merged commit 2366a72 into main Aug 14, 2026
5 checks passed
@cuibonobo
cuibonobo deleted the claude/issue-146-lkno87 branch August 14, 2026 14:01
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.

2 participants