Commit graph

997 commits

Author SHA1 Message Date
tim-hub
d7e5dad586 26.07.15-1 2026-07-15 11:48:18 +12:00
Tim
12345fe0de
fix: resolve localized numbered books and repoint Clementine Vulgate (#360)
Numbered books in non-English/version-specific naming (e.g. 1 Könige,
2 Corintios, 1 Reyes) failed to return verse text (#355, #342). Root
cause: AllBibleBooksInAllSupportedLanguages dropped startNumber, so the
cross-language ordinal fallback (bookIdFromName) — the path the provider
uses to map a localized name to English — could never match numbered
books. Preserve startNumber; add a regression test.

Clementine Latin Vulgate errored because bible-api.com dropped the
'clementine' translation (404) (#357). Repoint to bolls.life's 'VULG'
(same Biblia Sacra juxta Vulgatam Clementinam); drop the stale entry
from the bible-api translations doc comment.

Claude-Session: https://claude.ai/code/session_01HvA9UdGcEyNyysyRVKKmmN

Co-authored-by: tim-hub <tim-hub@users.noreply.github.com>
2026-07-15 11:46:53 +12:00
tim-hub
2803304022 26.07.15
Claude-Session: https://claude.ai/code/session_01HvA9UdGcEyNyysyRVKKmmN
2026-07-15 11:20:17 +12:00
Tim
6c5a919ba7
Merge pull request #358 from tim-hub/feat/monorepo-merge
feat: Bun monorepo — merge bible-reference-toolkit + move plugin into packages/
2026-07-15 11:18:15 +12:00
tim-hub
59ec2d7964 feat(plugin): bundle offline WEB Bible + Offline Mode
Ship the public-domain World English Bible inside the plugin so verses
resolve with zero network. Adds an Offline Mode setting (forces the
bundled version, marked "(Offline)" in the dropdown) and auto-falls back
to bundled WEB text whenever an online fetch fails, without poisoning the
selected version's verse cache.

- offlineBible.web.json: compact string[][][] indexed [book][chapter][verse],
  canonical 66-book order (generated from TehShrike/world-english-bible).
- offlineLookup(): language-agnostic book-name normalization + verse expansion.
- OfflineProvider routes the 'offline' apiSource; BaseBibleAPIProvider
  degrades gracefully on network failure.

Closes #359

Claude-Session: https://claude.ai/code/session_01HvA9UdGcEyNyysyRVKKmmN
2026-07-15 11:14:23 +12:00
tim-hub
c0fe034519 test(plugin): preload obsidian mock when tests run package-scoped
The obsidian mock was preloaded only via the root bunfig.toml, so
`bun test` run from the package (as `--filter ... test` does) skipped it
and provider tests failed to resolve 'obsidian'. Add a package-level
bunfig.toml with a package-relative preload.

Claude-Session: https://claude.ai/code/session_01HvA9UdGcEyNyysyRVKKmmN
2026-07-15 10:32:33 +12:00
tim-hub
772ef819e2 test(i18n): guard version-code <-> book-name-catalog agreement
Export SupportedLanguages from the toolkit so callers can enumerate
catalogs instead of probing by try/catch. Add a reconciliation test that
fails CI when a version code neither matches a catalog nor is a known
English-fallback code, so a zh_TW-style drift can't silently anglicize
book names again. Also tracks catalogs shipped without a version (da, jp).

Claude-Session: https://claude.ai/code/session_01HvA9UdGcEyNyysyRVKKmmN
2026-07-15 10:31:24 +12:00
tim-hub
a4e3eb1780 fix(i18n): render localized book names for Chinese versions
Book names for Chinese Bibles rendered in English because the catalog
keys zh_CN/zh_TW were the only mixed-case ones and the toolkit lowercases
every lookup, making them unreachable. Lowercase the two catalog keys to
zh_cn/zh_tw and re-code the 5 Chinese versions to their exact catalog
(Simplified -> zh_cn, Traditional -> zh_tw).

Consolidate the version+setting -> book-name-locale decision and its
English fallback into one bookNameLocalization module; getSuggestionsFromQuery
and BollyLifeProvider now pass a Version instead of juggling a raw code.

Claude-Session: https://claude.ai/code/session_01HvA9UdGcEyNyysyRVKKmmN
2026-07-15 10:31:13 +12:00
tim-hub
f58529e767 chore: persist verse cache debug logging, add Matt Pocock skills, ignore tooling
Squashes in-progress local work: [verseCache] debug logs in the cache
path, .agents/.claude skill definitions with skills-lock.json, and
.gitignore/.stignore updates.

Claude-Session: https://claude.ai/code/session_01HvA9UdGcEyNyysyRVKKmmN
2026-07-15 10:00:13 +12:00
tim-hub
9ca0910986 feat(plugin): gate whole-chapter fetch behind explicit :a
Bare 'John 1' fired a transient whole-chapter fetch on every keystroke
before ':1' was typed. Add hasExplicitVerse predicate and guard the two
per-keystroke suggesters (editor + lookup modal) so they only fetch once
a colon + verse or ':a' is present. Whole-chapter stays available via
explicit 'John 1:a'. Programmatic API and getSuggestionsFromQuery keep
bare-chapter-whole-chapter behavior.

Claude-Session: https://claude.ai/code/session_01HvA9UdGcEyNyysyRVKKmmN
2026-07-15 09:59:15 +12:00
tim-hub
8a228fcc59 feat(plugin): persistent nested verse cache in data.json
Cache immutable Bible text per (translation, book+chapter, verse) so
repeated lookups skip the network. BaseBibleAPIProvider.query() reads
cached verses, fetches only the gap (whole chapter for BollyLife), and
fills the cache. main.ts hydrates on load and persists via a single
writer that serializes settings + cache together (no clobber).

Claude-Session: https://claude.ai/code/session_01HvA9UdGcEyNyysyRVKKmmN
2026-07-15 08:26:51 +12:00
tim-hub
45945eb478 chore(plugin): remove orphaned ackee-tracker deps and dead setting
The ackee analytics implementation was removed in d5f3b8a; only dead
remnants were left. Drop the unused ackee-tracker / @types/ackee-tracker
dependencies and the unreferenced optOutToEvents setting field/default.
Build + 200 tests pass; lockfile refreshed.

Claude-Session: https://claude.ai/code/session_013pCNGDmUyfJia4tE4aWoYM
2026-07-15 07:40:49 +12:00
tim-hub
8bd07554b8 refactor(plugin): rename VODProvider to verseOfDayApi (C6)
The module holds Verse-of-the-Day fetch functions (getVod/getEnhancedVod),
not a BaseBibleAPIProvider subclass - the ...Provider name and provider/
placement implied an adapter it never was. Rename the file; update the
3 import sites. 200 tests pass.

Claude-Session: https://claude.ai/code/session_013pCNGDmUyfJia4tE4aWoYM
2026-07-15 07:30:35 +12:00
tim-hub
bcc996eff0 refactor(plugin): remove shallow abstractions in verse/ & provider/ (C6)
- Delete IVerseSuggesting: a single-implementer interface adds surface
  without abstraction; VerseSuggesting uses its concrete type.
- Delete BibleAPIDotComProvider.getOriginalVerseReferenceLink: a no-op
  override that only called super (base impl is inherited unchanged),
  plus its stale commented-out block.

Left as-is (not actually shallow): VerseOfDaySuggesting's ctor is
load-bearing (widens visibility + stores verseTexts accessed in main.ts).
200 tests pass.

Claude-Session: https://claude.ai/code/session_013pCNGDmUyfJia4tE4aWoYM
2026-07-14 23:05:57 +12:00
tim-hub
73824e07cc refactor(plugin): deepen reference-URL dispatch, drop dead code (C5)
The four URL builders are genuinely different formats, so they stay as
distinct functions. What was shallow was the dispatch: getUrlForReference
repeated the same try/log/fallback wrapper per source, and its
'biblegateway' case was identical to the Bible Gateway fallback helper.

- Replace the ~95-line switch with a builders map + one try/catch/fallback
  (fallback logic now lives in one place); 'biblegateway' and unknown
  sources fall through to the fallback.
- Delete getLogosLink (exported but only used by its own tests); replace
  those tests with direct getLogosTranslation fallback coverage.

Behaviour unchanged; 200 tests pass.

Claude-Session: https://claude.ai/code/session_013pCNGDmUyfJia4tE4aWoYM
2026-07-14 23:03:43 +12:00
tim-hub
f8131d9517 refactor(plugin): replace ProviderFactory singleton with buildProvider (C4)
Delete the Gang-of-Four singleton (~40 of 60 lines were scaffolding
guarding a stateless dispatch) in favour of a plain buildProvider()
function. Update the 3 call sites; add a dispatch test asserting the
right provider per apiSource. 201 tests pass.

Claude-Session: https://claude.ai/code/session_013pCNGDmUyfJia4tE4aWoYM
2026-07-14 22:59:51 +12:00
tim-hub
49fe95120c refactor(plugin): derive verse counts from toolkit (C3)
Replace the 159-line hand-kept BIBLE_VERSE_COUNTS table with thin
getVerseCount/getChapterCount adapters over bible-reference-toolkit
(backed by bible-book-names-intl). Bible structure now lives in one
place. Also fixes two off-by-one errors in the old table
(1 Samuel 23: 28->29, 1 Kings 20: 42->43 verses; toolkit matches KJV).
splitBibleReference untouched; 54 range tests + full 197 suite pass.

Claude-Session: https://claude.ai/code/session_013pCNGDmUyfJia4tE4aWoYM
2026-07-14 22:57:54 +12:00
tim-hub
ed7dd97d5d refactor: single source of truth for book-name lookup (C2)
Retire the hardcoded php->50 / isa->23 branches in the plugin's
bookNameReference. Root causes fixed at the source instead:

- add "Php" to Philippians in bible-book-names-intl (data gap)
- toolkit matcher now does an exact name/abbreviation pass before the
  ordinal-variation pass, so "Isa" resolves to Isaiah instead of losing
  to the generated "I"+"Sa" variant of 1 Samuel

Book-name knowledge now lives only in the libs. Toolkit 38 tests +
full 197 suite pass; en.json snapshot updated for the new abbreviation.

Claude-Session: https://claude.ai/code/session_013pCNGDmUyfJia4tE4aWoYM
2026-07-14 22:55:20 +12:00
tim-hub
387911b93d refactor(plugin): delete dead book-name tables (C1)
Remove ALL_BOOKS, BOOKS_YOUVERSION, OSI_BOOKS, BOOK_NAMES,
LOGOS_BOOK_CODES, matchingBooks - all had zero references and
re-encoded data owned by bible-book-names-intl. Keep only the live
URL-code tables BLB_BOOK_CODES / STEPBIBLE_BOOK_CODES. 723->154 lines,
no behaviour change; 197 tests pass.

Claude-Session: https://claude.ai/code/session_013pCNGDmUyfJia4tE4aWoYM
2026-07-14 22:50:49 +12:00
tim-hub
eca4d8e13f fix(toolkit): parse reference without ReDoS-prone regex
A single greedy regex kept tripping CodeQL js/polynomial-redos: any
.-class quantifier adjacent to \s+ backtracks polynomially (latest
witness: 'aA !' + many 'aa !'). Replace it with a linear scan for the
last 'letter + whitespace + non-space' boundary using a non-overlapping
pattern, then slice. Behavior unchanged; 38 toolkit tests pass; witness
input now linear (200k reps in ~6ms).

Claude-Session: https://claude.ai/code/session_013pCNGDmUyfJia4tE4aWoYM
2026-07-14 22:24:50 +12:00
tim-hub
d1fd1d0414 fix(toolkit): remove separator/tail regex overlap for ReDoS
The anchored regex still let \s+ and the trailing (.+) both match
spaces, which CodeQL flagged (witness: 'aA ' + many spaces). Require
the chapter/verse group to start with \S so \s+ owns all separator
whitespace - no overlapping quantifiers, linear time. Behavior
unchanged; 38 toolkit tests pass.

Claude-Session: https://claude.ai/code/session_013pCNGDmUyfJia4tE4aWoYM
2026-07-14 22:24:50 +12:00
tim-hub
b5874be662 fix(toolkit): anchor reference regex to prevent ReDoS
Anchor the book/chapter-verse parsing regex with ^...$ so it no longer
restarts at every position. Resolves CodeQL js/polynomial-redos
(polynomial backtracking on long uncontrolled input). Behavior
unchanged; 38 toolkit tests pass.

Claude-Session: https://claude.ai/code/session_013pCNGDmUyfJia4tE4aWoYM
2026-07-14 22:24:49 +12:00
tim-hub
6f5e55821e feat: auto date-based version bump in version-bump script
- version-bump.mjs now derives today's YY.MM.DD, writes it into the plugin
  package.json (source of truth), and syncs manifest.json + versions.json.
- On same-day collision (base version already git-tagged) it appends -1, -2, …
- Optional explicit version override via CLI arg.
- Release skill updated: bump + sync is now a single command.

Claude-Session: https://claude.ai/code/session_013pCNGDmUyfJia4tE4aWoYM
2026-07-14 22:24:49 +12:00
tim-hub
03b56f9628 chore: gitignore .vscode; bun-ify release skill; plugin package.json as version source of truth
- .gitignore: ignore .vscode/
- version-bump.mjs: read the version from the plugin package.json (single
  source of truth) instead of the npm_package_version env var, and sync it
  into the root manifest.json + versions.json
- .claude release skill: use bun commands and the new version flow

Claude-Session: https://claude.ai/code/session_013pCNGDmUyfJia4tE4aWoYM
2026-07-14 22:24:49 +12:00
tim-hub
c0c395dc67 chore: drop .vscode folder
Claude-Session: https://claude.ai/code/session_013pCNGDmUyfJia4tE4aWoYM
2026-07-14 22:24:49 +12:00
tim-hub
21603faa26 refactor: convert to Bun monorepo; move plugin source into packages/
- Switch package manager/runtime/test-runner from pnpm+jest to Bun.
  Remove pnpm-workspace.yaml + pnpm-lock.yaml; root package.json is now a
  bun workspace ("workspaces": ["packages/*"]); add bun.lock.
- Move the Obsidian plugin source into packages/obsidian-bible-reference/
  (src, scripts, tsconfig, eslint, prettier). The repo root remains the
  installable plugin folder: manifest.json, versions.json, styles.css and
  the built main.js stay at root.
- esbuild + version-bump resolve repo-root paths so the build emits main.js
  to root and version-bump edits root manifest/versions from the package.
- Migrate plugin tests from jest to `bun test`. Only the provider test used
  jest mocking; convert to bun:test (mock/spyOn). Mock the types-only
  `obsidian` module via a bun test preload (bunfig.toml) since mock.module
  is not hoisted like jest.mock.
- Root build builds packages in dependency order then the plugin; CI builds
  before test because the plugin/tests import bible-reference-toolkit's dist.
- Update CI + release workflows to oven-sh/setup-bun; husky pre-commit,
  dev-setup/release docs and VS Code tasks to bun.
- Pin plugin prettier to 3.8.3 (3.9.x reformats unrelated union types).
- Add @types/node to bible-reference-toolkit (was hoisted under pnpm).

Claude-Session: https://claude.ai/code/session_013pCNGDmUyfJia4tE4aWoYM
2026-07-14 22:24:49 +12:00
tim-hub
8851194a49 chore: wire pnpm monorepo for merged bible-reference-toolkit packages
- pnpm-workspace.yaml declares packages/* (un-ignore it; now essential config)
- plugin depends on bible-reference-toolkit via workspace:*; toolkit -> bible-book-names-intl via workspace:*
- add rimraf devDep + skipLibCheck so packages build under this toolchain
- exclude packages/ from plugin tsconfig; ignore packages/*/dist build artifacts
- eslint + prettier ignore packages/ (they keep their own bun toolchain)
- README: document the packages contained in this monorepo

Claude-Session: https://claude.ai/code/session_013pCNGDmUyfJia4tE4aWoYM
2026-07-14 22:24:49 +12:00
tim-hub
893ca4cbaf bump version 2026-07-14 22:24:49 +12:00
Nea4321
2137eb6619 include ko translation 2026-07-14 22:24:49 +12:00
tim-hub
81f6546dc8 update reference toolkit 2026-07-14 22:24:49 +12:00
tim-hub
219d49f32c update version for names-intl 2026-07-14 22:24:49 +12:00
tim-hub
850fa73210 include new translation 2026-07-14 22:24:49 +12:00
tim-hub
d5ade585e4 fix build error 2026-07-14 22:24:49 +12:00
tim-hub
7cd1b24bc3 release 2026-07-14 22:24:49 +12:00
tim-hub
a6425fb7c6 format 2026-07-14 22:24:48 +12:00
tim-hub
69d0d3b6dd add hi.json 2026-07-14 22:24:48 +12:00
tim-hub
d9fcc41dc0 2.3.6 to include book name 3.2.3 2026-07-14 22:24:48 +12:00
tim-hub
8c52e8bafa 3.2.3 2026-07-14 22:24:48 +12:00
tim-hub
11d5825bf9 fix zh translations 2026-07-14 22:24:48 +12:00
tim-hub
64950b5b33 fix translation name 2026-07-14 22:24:48 +12:00
tim-hub
c1c9514ecf build 3.2.2 2026-07-14 22:24:48 +12:00
tim-hub
2682b3d36b fix translation naming and include more 2026-07-14 22:24:48 +12:00
tim-hub
dbcf383441 prettoer fix 2026-07-14 22:24:48 +12:00
tim-hub
6aaff0911d update reference toolkit
support more translation book names

- cn
- fr
- pt
- ro
- da
2026-07-14 22:24:48 +12:00
tim-hub
229df38790 prettier fix 2026-07-14 22:24:48 +12:00
tim-hub
b143451d33 3.2.0 add cn, fr, da, pt, ro languages 2026-07-14 22:24:48 +12:00
Nea4321
d9fb771783 [ + ] Add ko.json 2026-07-14 22:24:48 +12:00
tim-hub
515d8671f3 fix CN translation start number 2026-07-14 22:24:48 +12:00
tim-hub
f937375e50 fix da translation duplication 2026-07-14 22:24:48 +12:00
Nicolai Skødt Holmgaard
33f4292bab Danish translation 2026-07-14 22:24:48 +12:00