From f878fb70ae7a3d0502b9657cb30bae103f305dcf Mon Sep 17 00:00:00 2001 From: hectorsector Date: Tue, 28 Apr 2026 10:24:40 -0400 Subject: [PATCH] change namespace, add status map --- README.md | 6 ++-- cli/internal/lexicon/status.go | 28 +++++++++++++++++++ ...jsonc => com.hectorsector.book.book.jsonc} | 4 +-- ...onc => com.hectorsector.book.status.jsonc} | 28 +++++++++++-------- 4 files changed, 50 insertions(+), 16 deletions(-) create mode 100644 cli/internal/lexicon/status.go rename docs/{community.lexicon.book.book.jsonc => com.hectorsector.book.book.jsonc} (95%) rename docs/{community.lexicon.book.status.jsonc => com.hectorsector.book.status.jsonc} (68%) diff --git a/README.md b/README.md index 8f38d1f..f131e40 100644 --- a/README.md +++ b/README.md @@ -3,15 +3,15 @@ Minimal--inteded as canonical--book tracking lexicons for atproto. Two records: ``` -community.lexicon.book.book - a book in a user's library -community.lexicon.book.status - a change in the user's reading journey +com.hectorsector.book.book - a book in a user's library +com.hectorsector.book.status - a change in the user's reading journey ``` ## This repo is We define irreducible primitives for book tracking here: what book, what status, when. 1. CLI importer for goodreads and storygraph data - - Input: CSV -> Output: community.lexicon.book.* stores in PDS + - Input: CSV -> Output: com.hectorsector.book.* stores in PDS 2. Viewer - Read-only diff --git a/cli/internal/lexicon/status.go b/cli/internal/lexicon/status.go new file mode 100644 index 0000000..252a7ad --- /dev/null +++ b/cli/internal/lexicon/status.go @@ -0,0 +1,28 @@ +package lexicon + +import "fmt" + +const ( + StatusWantToRead = "com.hectorsector.book.status#wantToRead" + StatusReading = "com.hectorsector.book.status#reading" + StatusFinished = "com.hectorsector.book.status#finished" + StatusDidNotFinish = "com.hectorsector.book.status#didNotFinish" + StatusPaused = "com.hectorsector.book.status#paused" +) + +func MapStatus(storygraphStatus string) (string, error) { + switch storygraphStatus { + case "to-read": + return StatusWantToRead, nil + case "currently-reading": + return StatusReading, nil + case "paused": + return StatusPaused, nil + case "did-not-finish": + return StatusDidNotFinish, nil + case "read": + return StatusFinished, nil + default: + return "", fmt.Errorf("unknown status: %q", storygraphStatus) + } +} diff --git a/docs/community.lexicon.book.book.jsonc b/docs/com.hectorsector.book.book.jsonc similarity index 95% rename from docs/community.lexicon.book.book.jsonc rename to docs/com.hectorsector.book.book.jsonc index 4e546dc..e6c5c79 100644 --- a/docs/community.lexicon.book.book.jsonc +++ b/docs/com.hectorsector.book.book.jsonc @@ -3,8 +3,8 @@ "lexicon": 1, // namespace id (NSID) - // community.lexicon (org) . book (namespace) . book (record type) - "id": "community.lexicon.book.book", + // com.hectorsector (org) . book (namespace) . book (record type) + "id": "com.hectorsector.book.book", "description": "A book in a user's library. An anchor record referenced by status and other book-related events. Metadata (title, authors, cover, etc.) is resolved at display time from the identifier — it is not stored in the record. At least one of olWorkId, isbn13, or isbn10 must be present; apps should prefer olWorkId when available for work-level deduplication across editions.", // type definitions, we just use main diff --git a/docs/community.lexicon.book.status.jsonc b/docs/com.hectorsector.book.status.jsonc similarity index 68% rename from docs/community.lexicon.book.status.jsonc rename to docs/com.hectorsector.book.status.jsonc index 5099100..16606cc 100644 --- a/docs/community.lexicon.book.status.jsonc +++ b/docs/com.hectorsector.book.status.jsonc @@ -1,6 +1,6 @@ { "lexicon": 1, - "id": "community.lexicon.book.status", + "id": "com.hectorsector.book.status", "description": "A reading status change event for a book. Records are append-only and timestamped — each status transition creates a new record rather than mutating an existing one. The current status of a book is derived by taking the most recent status record (by createdAt) referencing that book.", "defs": { "main": { @@ -20,7 +20,7 @@ // cid: cryptographic hash of content // This pins the exact version of the book record at the time of status creation "ref": "com.atproto.repo.strongRef", - "description": "Strong reference to the community.lexicon.book.book anchor this status applies to.", + "description": "Strong reference to the com.hectorsector.book.book anchor this status applies to.", }, "status": { "type": "string", @@ -28,10 +28,11 @@ // not an enum, known values could change so we can extend "knownValues": [ // format: namespaceid#tokens; tokens defined below - "community.lexicon.book.status#wantToRead", - "community.lexicon.book.status#reading", - "community.lexicon.book.status#finished", - "community.lexicon.book.status#didNotFinish", + "com.hectorsector.book.status#wantToRead", + "com.hectorsector.book.status#reading", + "com.hectorsector.book.status#paused", + "com.hectorsector.book.status#didNotFinish", + "com.hectorsector.book.status#finished", ], "description": "The reading status being set. Open union — future status tokens may be added; consumers should handle unknown values gracefully.", }, @@ -45,21 +46,26 @@ }, }, // token definitions + // Explicitly left out since it can be reasoned from existing statuses: rereading "wantToRead": { "type": "token", - "description": "The user intends to read this book.", + "description": "The user intends to read the book.", }, "reading": { "type": "token", - "description": "The user is currently reading this book.", + "description": "The user is currently reading the book.", }, - "finished": { + "paused": { "type": "token", - "description": "The user has completed the book. Multiple finished status records for the same book indicate rereads.", + "description": "The user has paused reading the book and hasn't yet decided if they will continue.", }, "didNotFinish": { "type": "token", - "description": "The user started the book but indicated putting it down.", + "description": "The user has indicated they won't complete this book.", + }, + "finished": { + "type": "token", + "description": "The user has completed the book.", }, }, } -- 2.51.2