feat(documents): OKF v0.2 document profile with provenance and rights status #56

Merged
crapougnax merged 2 commits from feat/52-document-profile into develop 2026-11-19 18:32:48 +00:00
Owner

Refs #52 (step 1 of 3)

Defines the document profile on OKF v0.2 and the module curation and ingestion share to read and write documents: src/lib/document-profile.ts.

  • writeStudioDocument(document, { themes, vocabularies }): validates with @quatrain/okf and a Studio profile, then serializes. Refuses: a missing type, title, category, soa, generated or rights; an empty value; a key written before v0.2 (timestamp, createdAt, revision, originalFileUri, fileHash); a rights outside open | licensed | own | quote-only | unknown | excluded; open without a source naming licence and licence_url; when given, a category or thematics that is not a theme, a facet value outside its vocabulary. Unknown keys are kept.
  • readStudioDocument(text, { category, by }): converts a pre-v0.2 document (createdAt/timestamp → generated, originalFileUri + fileHash → first source { resource, sha256 }, revision dropped, folder → category, rights: unknown); a v0.2 document comes back unchanged.
  • mayKeepFullText(rights), mayIndex(rights): effects of the rights status, for step 3.
  • renderRootIndex(body): content/index.md with okf_version: "0.2".
  • Facets may no longer take a key of the profile (rights, generated, sources…).
  • Docs: docs/DOCUMENT-PROFILE.md and .fr.md; README and AGENTS.md move to OKF v0.2.

Not in this PR: wiring into the curation route and the ingestion queue (they are rewritten for tenants in 4a and 4b); facet vocabularies in the tenant settings (step 2); rights in the curation form and enforcement in indexing (step 3).

Checks: yarn test 206/206 (15 new). tsc --noEmit: the same 11 errors as on develop, none in the new code.

🤖 Generated with Claude Code

Refs #52 (step 1 of 3) Defines the document profile on OKF v0.2 and the module curation and ingestion share to read and write documents: `src/lib/document-profile.ts`. - `writeStudioDocument(document, { themes, vocabularies })`: validates with `@quatrain/okf` and a Studio profile, then serializes. Refuses: a missing `type`, `title`, `category`, `soa`, `generated` or `rights`; an empty value; a key written before v0.2 (`timestamp`, `createdAt`, `revision`, `originalFileUri`, `fileHash`); a `rights` outside `open | licensed | own | quote-only | unknown | excluded`; `open` without a source naming `licence` and `licence_url`; when given, a `category` or `thematics` that is not a theme, a facet value outside its vocabulary. Unknown keys are kept. - `readStudioDocument(text, { category, by })`: converts a pre-v0.2 document (`createdAt`/`timestamp` → `generated`, `originalFileUri` + `fileHash` → first source `{ resource, sha256 }`, `revision` dropped, folder → `category`, `rights: unknown`); a v0.2 document comes back unchanged. - `mayKeepFullText(rights)`, `mayIndex(rights)`: effects of the rights status, for step 3. - `renderRootIndex(body)`: `content/index.md` with `okf_version: "0.2"`. - Facets may no longer take a key of the profile (`rights`, `generated`, `sources`…). - Docs: `docs/DOCUMENT-PROFILE.md` and `.fr.md`; README and AGENTS.md move to OKF v0.2. Not in this PR: wiring into the curation route and the ingestion queue (they are rewritten for tenants in 4a and 4b); facet vocabularies in the tenant settings (step 2); rights in the curation form and enforcement in indexing (step 3). Checks: `yarn test` 206/206 (15 new). `tsc --noEmit`: the same 11 errors as on `develop`, none in the new code. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(documents): OKF v0.2 document profile with provenance and rights status (#52)
All checks were successful
Build and Publish OCI Image / Build & Push ARM64 OCI Image (pull_request) Successful in 55s
3bf522228f
One module reads and writes the documents of a tenant repository for
curation and ingestion: required keys (type, title, category, soa,
generated, rights), no empty value, a closed rights vocabulary, an open
licence named by a source, and the themes and facet vocabularies of the
tenant when given. Documents written before v0.2 are converted on reading
(createdAt/timestamp to generated, originalFileUri/fileHash to a source,
revision dropped, rights unknown) and their old keys refused on writing.

Documented in docs/DOCUMENT-PROFILE.md (EN, FR).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merge remote-tracking branch 'origin/develop' into feat/52-document-profile
All checks were successful
Build and Publish OCI Image / Build & Push ARM64 OCI Image (pull_request) Successful in 1m41s
72a98b4667
# Conflicts:
#	AGENTS.md
crapougnax merged commit 7acb6a4729 into develop 2026-11-19 18:32:48 +00:00
crapougnax deleted branch feat/52-document-profile 2026-11-19 18:32:48 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
modaka/studio!56
No description provided.